chore: restore production release gate
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
// Generated by scripts/build-editor-compiler.mjs. Do not edit directly.
|
||||
// WRN editor compiler source hash: 1e7593d6b6bd1c9b8439fc34a30f9db9f7ae64f1788365a74115170aa34cd185
|
||||
// WRN editor compiler source hash: 884c9faffb5517c907321484014e00562654ea0ba96e432bec319e0001934446
|
||||
// WRN editor compiler generator hash: a54ca847c758bc98d8e353ad6d70088df31de1820f6cf9d1c3462505f563e6b8
|
||||
// Generated with TypeScript: 6.0.3
|
||||
const __nodeRequire = require;
|
||||
@@ -1148,6 +1148,31 @@ function componentEventAttribute(name) {
|
||||
}
|
||||
return `data-wrn-out-${name}`;
|
||||
}
|
||||
/** Expand bind:value/bind:checked into a reactive prop plus assignment handler. */
|
||||
function expandBindings(attrs) {
|
||||
const output = [];
|
||||
for (const attr of attrs) {
|
||||
if (attr.event || !attr.name.startsWith("bind:")) {
|
||||
output.push(attr);
|
||||
continue;
|
||||
}
|
||||
const target = attr.name.slice("bind:".length);
|
||||
if (target !== "value" && target !== "checked") {
|
||||
throw new Error(`Unknown .wrn binding '${attr.name}'. Use bind:value or bind:checked.`);
|
||||
}
|
||||
const expression = wholeAttributeExpression(attr.value) ?? attr.value.trim();
|
||||
if (!/^[A-Za-z_$][\w$]*$/.test(expression)) {
|
||||
throw new Error(`${attr.name} requires a writable state name, received '${expression}'.`);
|
||||
}
|
||||
output.push({ name: target, value: `{${expression}}`, event: false });
|
||||
output.push({
|
||||
name: target === "checked" ? "change" : "input",
|
||||
value: `${expression} = payload.${target}`,
|
||||
event: true,
|
||||
});
|
||||
}
|
||||
return output;
|
||||
}
|
||||
function reactiveAttrValue(raw, reactive) {
|
||||
let found = false;
|
||||
const value = raw.replace(/\{([^{}]+)\}/g, (whole, inner) => {
|
||||
@@ -1166,6 +1191,7 @@ function reactiveAttrValue(raw, reactive) {
|
||||
return found ? value : null;
|
||||
}
|
||||
function renderAttrs(attrs, csrId, reactive = null, dynamicExpressions) {
|
||||
attrs = expandBindings(attrs);
|
||||
let bindIndex = 0;
|
||||
const rendered = attrs
|
||||
.map((attr) => {
|
||||
@@ -1302,7 +1328,7 @@ function renderLoopBody(node, locals = []) {
|
||||
return compileIfExpr(node, locals);
|
||||
}
|
||||
const componentTag = isComponentTag(node.tag);
|
||||
const attrs = node.attrs
|
||||
const attrs = expandBindings(node.attrs)
|
||||
.filter((attr) => attr.name !== "data-component")
|
||||
.map((attr) => {
|
||||
const name = attr.event
|
||||
@@ -1562,9 +1588,9 @@ function renderPageComponentInvocation(node, ssrBindings, csrBindings, apiBindin
|
||||
const island = islandMarkerFor(node);
|
||||
if (island)
|
||||
return island;
|
||||
const attrs = node.attrs
|
||||
const attrs = expandBindings(node.attrs)
|
||||
.filter((attr) => attr.name !== "data-component")
|
||||
.map((attr) => renderPageComponentAttr(attr, loops))
|
||||
.map((attr) => renderPageComponentAttr(attr, loops, reactive))
|
||||
.join("");
|
||||
const inner = node.children
|
||||
.map((child) => renderNode(child, ssrBindings, csrBindings, apiBindings, loops, reactive))
|
||||
@@ -1577,7 +1603,7 @@ function renderNestedComponentInvocation(node, ctx) {
|
||||
if (island)
|
||||
return island;
|
||||
let bindIndex = 0;
|
||||
const attrs = node.attrs
|
||||
const attrs = expandBindings(node.attrs)
|
||||
.filter((attr) => attr.name !== "data-component")
|
||||
.map((attr) => {
|
||||
const spread = /^\{\.\.\.([A-Za-z_$][\w$]*)\}$/.exec(attr.name);
|
||||
@@ -2446,6 +2472,8 @@ ${exposed
|
||||
${declarations}
|
||||
${visible.length
|
||||
? ` const __values = await Promise.all([${visible.map((entry) => `__load_${entry.name}()`).join(", ")}]);
|
||||
const __response = __values.find((value) => value instanceof Response);
|
||||
if (__response) return __response;
|
||||
return { ${visible.map((entry, index) => `${JSON.stringify(entry.name)}: __values[${index}]`).join(", ")} };`
|
||||
: ""}
|
||||
}`;
|
||||
@@ -2765,7 +2793,7 @@ function renderClientControlTemplate(nodes) {
|
||||
}
|
||||
const componentTag = isComponentTag(node.tag);
|
||||
let bindIndex = 0;
|
||||
const attrs = node.attrs
|
||||
const attrs = expandBindings(node.attrs)
|
||||
.map((attribute) => {
|
||||
const name = attribute.event
|
||||
? componentTag
|
||||
@@ -2803,19 +2831,21 @@ function encodeClientControl(value) {
|
||||
}
|
||||
function renderComponentIfNode(node, ctx) {
|
||||
let expression = "``";
|
||||
const clientBranches = [];
|
||||
for (let index = node.branches.length - 1; index >= 0; index--) {
|
||||
const branch = node.branches[index];
|
||||
const body = branch.body.map((child) => renderComponentNode(child, ctx)).join("");
|
||||
const bodyExpression = "`" + body + "`";
|
||||
clientBranches.unshift(`{ cond: ${branch.cond === null ? "null" : JSON.stringify(branch.cond)}, body: ${bodyExpression} }`);
|
||||
expression =
|
||||
branch.cond === null
|
||||
? bodyExpression
|
||||
: `(${ctx.resolveExpr(branch.cond)}) ? ${bodyExpression} : ${expression}`;
|
||||
}
|
||||
const definition = encodeClientControl(node.branches.map((branch) => ({
|
||||
cond: branch.cond,
|
||||
body: renderClientControlTemplate(branch.body),
|
||||
})));
|
||||
// Render all branches on the server into an inert, encoded definition.
|
||||
// A branch first selected in the browser therefore contains the real nested
|
||||
// component HTML and scope metadata, not a data-component placeholder.
|
||||
const definition = `\${__wrnexusEncodeControl([${clientBranches.join(",")}])}`;
|
||||
return `<template data-wrn-if="${definition}"></template>${"${" + expression + "}"}<template data-wrn-control-end></template>`;
|
||||
}
|
||||
function renderComponentEachNode(node, ctx) {
|
||||
@@ -2955,7 +2985,7 @@ function renderComponentNode(node, ctx) {
|
||||
}
|
||||
}
|
||||
const isExplicitComponentMount = node.attrs.some((attribute) => attribute.name === "data-component");
|
||||
const attrs = node.attrs
|
||||
const attrs = expandBindings(node.attrs)
|
||||
.filter((a) => a.name !== "class" && !a.name.startsWith("class:"))
|
||||
.map((a) => {
|
||||
const spread = /^\{\.\.\.([A-Za-z_$][\w$]*)\}$/.exec(a.name);
|
||||
@@ -3413,6 +3443,9 @@ function __wrnRaw(v: unknown): string {
|
||||
}`);
|
||||
}
|
||||
if (needsScope) {
|
||||
out.push(`function __wrnexusEncodeControl(value: unknown): string {
|
||||
return __WrnexusBuffer.from(JSON.stringify(value), "utf8").toString("base64");
|
||||
}`);
|
||||
out.push(`function __wrnexusSerializeScopeValue(value: unknown): string {
|
||||
if (value === undefined) {
|
||||
return "undefined";
|
||||
@@ -3495,7 +3528,7 @@ function __wrnProp(v) {
|
||||
const value = v !== null && typeof v === "object" ? JSON.stringify(v) : String(v == null ? "" : v);
|
||||
return __wrnAttr(value);
|
||||
}
|
||||
function renderPageComponentAttr(attr, dynamicExpressions) {
|
||||
function renderPageComponentAttr(attr, dynamicExpressions, _reactive) {
|
||||
if (attr.event) {
|
||||
return ` ${componentEventAttribute(attr.name)}="${attrEscape(attr.value)}"`;
|
||||
}
|
||||
@@ -3508,7 +3541,11 @@ function renderPageComponentAttr(attr, dynamicExpressions) {
|
||||
}
|
||||
dynamicExpressions.push(`\${__wrnexusPropAttr(${expression})}`);
|
||||
const marker = `\x00WRNEACH${dynamicExpressions.length - 1}\x00`;
|
||||
return ` ${attr.name}="${marker}"`;
|
||||
// The mount disappears during SSR. Preserve every dynamic component prop
|
||||
// as a parent-owned binding; server-only expressions simply fail closed in
|
||||
// the browser, while page state can continue driving the mounted child.
|
||||
const binding = ` data-wrn-prop-bind-${dynamicExpressions.length - 1}="${attrEscape(JSON.stringify([attr.name, attr.value]))}"`;
|
||||
return ` ${attr.name}="${marker}"${binding}`;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user