|
|
|
@@ -1,6 +1,6 @@
|
|
|
|
|
"use strict";
|
|
|
|
|
// Generated by scripts/build-editor-compiler.mjs. Do not edit directly.
|
|
|
|
|
// WRN editor compiler source hash: 196a514b18fb6e31fdd8f4ca667a76b0b62cab547af33725ba78564d70bbc01b
|
|
|
|
|
// WRN editor compiler source hash: 55b8301cff11aaee86a6692d86801e583eae0764af059dc10fdd83c047f4891b
|
|
|
|
|
// WRN editor compiler generator hash: c71e7fe4258c97b73b384ff14b321f0cf0b30cc2ed0322f5f84b04e757159b18
|
|
|
|
|
// Generated with TypeScript: 5.9.3
|
|
|
|
|
const __nodeRequire = require;
|
|
|
|
@@ -1172,7 +1172,7 @@ function compileIfExpr(node) {
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Collect every server-control expression in a view (recursively): `{#each}` list
|
|
|
|
|
* expressions and `{#if}` conditions. Used to wire up raw SSR data consts.
|
|
|
|
|
* expressions and `{#if}` conditions. Used to wrn up raw SSR data consts.
|
|
|
|
|
*/
|
|
|
|
|
function collectControlExprs(nodes, out = []) {
|
|
|
|
|
for (const node of nodes) {
|
|
|
|
@@ -1330,7 +1330,7 @@ function renderNestedComponentInvocation(node, ctx) {
|
|
|
|
|
.map((attr) => {
|
|
|
|
|
const spread = /^\{\.\.\.([A-Za-z_$][\w$]*)\}$/.exec(attr.name);
|
|
|
|
|
if (spread) {
|
|
|
|
|
return `\${__wireSpreadAttrs(${ctx.resolveExpr(spread[1])})}`;
|
|
|
|
|
return `\${__wrnSpreadAttrs(${ctx.resolveExpr(spread[1])})}`;
|
|
|
|
|
}
|
|
|
|
|
if (attr.event) {
|
|
|
|
|
return (escLit(` ${componentEventAttribute(attr.name)}="`) +
|
|
|
|
@@ -1342,7 +1342,7 @@ function renderNestedComponentInvocation(node, ctx) {
|
|
|
|
|
}
|
|
|
|
|
const wholeExpression = wholeAttributeExpression(attr.value);
|
|
|
|
|
const compiledValue = wholeExpression
|
|
|
|
|
? `\${__wireProp(${ctx.resolveExpr(wholeExpression)})}`
|
|
|
|
|
? `\${__wrnProp(${ctx.resolveExpr(wholeExpression)})}`
|
|
|
|
|
: compileAttrValue(attr.value, ctx);
|
|
|
|
|
const rendered = ` ${attr.name}="${compiledValue}"`;
|
|
|
|
|
if (!attr.value.includes("{") ||
|
|
|
|
@@ -1363,7 +1363,7 @@ function renderNestedComponentInvocation(node, ctx) {
|
|
|
|
|
: { ...ctx, forwardRestAttrs: false };
|
|
|
|
|
const inner = node.children.map((child) => renderComponentNode(child, childCtx)).join("");
|
|
|
|
|
return (`<div data-component="${attrEscape(node.tag)}"` +
|
|
|
|
|
`${ctx.forwardRestAttrs ? "${__wireSpreadAttrs(__attrs)}" : ""}` +
|
|
|
|
|
`${ctx.forwardRestAttrs ? "${__wrnSpreadAttrs(__attrs)}" : ""}` +
|
|
|
|
|
`${attrs}>${inner}</div>`);
|
|
|
|
|
}
|
|
|
|
|
function ssrMarker(bindings, binding) {
|
|
|
|
@@ -2291,7 +2291,7 @@ function viewHasRestAttributeSpread(nodes) {
|
|
|
|
|
/**
|
|
|
|
|
* Compile a text node. Interpolations that reference state stay as client
|
|
|
|
|
* mustaches (`{expr}`, hydrated by the reactive runtime); interpolations of
|
|
|
|
|
* props/constants are baked server-side (`${__wireHtml(expr)}`), so static
|
|
|
|
|
* props/constants are baked server-side (`${__wrnHtml(expr)}`), so static
|
|
|
|
|
* components render correct HTML with zero JavaScript.
|
|
|
|
|
*/
|
|
|
|
|
function compileText(raw, ctx) {
|
|
|
|
@@ -2312,7 +2312,7 @@ function compileText(raw, ctx) {
|
|
|
|
|
out += escLit(`{${expr}}`);
|
|
|
|
|
}
|
|
|
|
|
else if (expr === "content") {
|
|
|
|
|
out += `\${__wireRaw(${ctx.resolveExpr(expr)})}`;
|
|
|
|
|
out += `\${__wrnRaw(${ctx.resolveExpr(expr)})}`;
|
|
|
|
|
}
|
|
|
|
|
else if (exprRefsComponentReactiveValue(expr, ctx)) {
|
|
|
|
|
// State interpolation: bake the initial value AND keep it reactive via a
|
|
|
|
@@ -2320,11 +2320,11 @@ function compileText(raw, ctx) {
|
|
|
|
|
// updates it in place. `count` → `<span data-text="count">0</span>`.
|
|
|
|
|
out +=
|
|
|
|
|
escLit(`<span data-text="${attrEscape(expr)}">`) +
|
|
|
|
|
`\${__wireHtml(${ctx.resolveExpr(expr)})}` +
|
|
|
|
|
`\${__wrnHtml(${ctx.resolveExpr(expr)})}` +
|
|
|
|
|
escLit(`</span>`);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
out += `\${__wireHtml(${ctx.resolveExpr(expr)})}`;
|
|
|
|
|
out += `\${__wrnHtml(${ctx.resolveExpr(expr)})}`;
|
|
|
|
|
}
|
|
|
|
|
last = m.index + m[0].length;
|
|
|
|
|
}
|
|
|
|
@@ -2345,7 +2345,7 @@ function compileAttrValue(raw, ctx) {
|
|
|
|
|
out += escLit(`{${expr}}`); // hydrated per-item by the list renderer
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
out += `\${__wireAttr(${ctx.resolveExpr(expr)})}`;
|
|
|
|
|
out += `\${__wrnAttr(${ctx.resolveExpr(expr)})}`;
|
|
|
|
|
}
|
|
|
|
|
last = m.index + m[0].length;
|
|
|
|
|
}
|
|
|
|
@@ -2497,7 +2497,7 @@ function renderComponentNode(node, ctx) {
|
|
|
|
|
.map((a) => {
|
|
|
|
|
const spread = /^\{\.\.\.([A-Za-z_$][\w$]*)\}$/.exec(a.name);
|
|
|
|
|
if (spread) {
|
|
|
|
|
return `\${__wireSpreadAttrs(${elementContext.resolveExpr(spread[1])})}`;
|
|
|
|
|
return `\${__wrnSpreadAttrs(${elementContext.resolveExpr(spread[1])})}`;
|
|
|
|
|
}
|
|
|
|
|
if (a.event) {
|
|
|
|
|
return ` ${eventAttribute(a.name)}="${escLit(attrEscape(a.value))}"`;
|
|
|
|
@@ -2520,7 +2520,7 @@ function renderComponentNode(node, ctx) {
|
|
|
|
|
: "";
|
|
|
|
|
/*
|
|
|
|
|
* A boolean attribute whose expression names a loop variable cannot
|
|
|
|
|
* be resolved on the server: __wireBooleanAttr runs at render time,
|
|
|
|
|
* be resolved on the server: __wrnBooleanAttr runs at render time,
|
|
|
|
|
* where `row` or `item` simply does not exist, and the emitted
|
|
|
|
|
* module blew up. Leave the attribute off the server output and let
|
|
|
|
|
* the client bind set it -- the runtime toggles boolean attributes
|
|
|
|
@@ -2530,7 +2530,7 @@ function renderComponentNode(node, ctx) {
|
|
|
|
|
if (referencesLoopVariable) {
|
|
|
|
|
return ` data-wrn-bind-${bindIndex++}="${escLit(attrEscape(JSON.stringify([a.name, a.value])))}"`;
|
|
|
|
|
}
|
|
|
|
|
return `\${__wireBooleanAttr(${JSON.stringify(a.name)}, ${elementContext.resolveExpr(expression)})}${marker}`;
|
|
|
|
|
return `\${__wrnBooleanAttr(${JSON.stringify(a.name)}, ${elementContext.resolveExpr(expression)})}${marker}`;
|
|
|
|
|
}
|
|
|
|
|
if (a.value === "false")
|
|
|
|
|
return "";
|
|
|
|
@@ -2553,7 +2553,7 @@ function renderComponentNode(node, ctx) {
|
|
|
|
|
return ` data-show="${escLit(attrEscape(wholeExpression))}"`;
|
|
|
|
|
}
|
|
|
|
|
const compiledValue = isExplicitComponentMount && wholeExpression
|
|
|
|
|
? `\${__wireProp(${elementContext.resolveExpr(wholeExpression)})}`
|
|
|
|
|
? `\${__wrnProp(${elementContext.resolveExpr(wholeExpression)})}`
|
|
|
|
|
: compileAttrValue(a.value, elementContext);
|
|
|
|
|
const rendered = ` ${a.name}="${compiledValue}"`;
|
|
|
|
|
const referencesState = exprRefsComponentReactiveValue(a.value, ctx);
|
|
|
|
@@ -2608,7 +2608,7 @@ function renderComponentNode(node, ctx) {
|
|
|
|
|
.join("");
|
|
|
|
|
const loopLocalsAttribute = serverLoopLocalsAttribute(ctx);
|
|
|
|
|
const allAttrs = `${loopLocalsAttribute}` +
|
|
|
|
|
`${ctx.forwardRestAttrs ? "${__wireSpreadAttrs(__attrs)}" : ""}` +
|
|
|
|
|
`${ctx.forwardRestAttrs ? "${__wrnSpreadAttrs(__attrs)}" : ""}` +
|
|
|
|
|
`${ctx.eventNames?.length ? ` data-wrn-events="${attrEscape(ctx.eventNames.join(","))}"` : ""}` +
|
|
|
|
|
`${classAttribute}` +
|
|
|
|
|
`${classReactiveBinding}` +
|
|
|
|
@@ -2843,7 +2843,7 @@ function __restProps(
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function __wireHtml(v: unknown): string {
|
|
|
|
|
function __wrnHtml(v: unknown): string {
|
|
|
|
|
return String(v == null ? "" : v).replace(
|
|
|
|
|
/[&<>]/g,
|
|
|
|
|
(c) =>
|
|
|
|
@@ -2855,7 +2855,7 @@ function __wireHtml(v: unknown): string {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function __wireAttr(v: unknown): string {
|
|
|
|
|
function __wrnAttr(v: unknown): string {
|
|
|
|
|
return String(v == null ? "" : v).replace(
|
|
|
|
|
/[&<>"]/g,
|
|
|
|
|
(c) =>
|
|
|
|
@@ -2869,7 +2869,7 @@ function __wireAttr(v: unknown): string {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function __wireBooleanAttr(name: string, value: unknown): string {
|
|
|
|
|
function __wrnBooleanAttr(name: string, value: unknown): string {
|
|
|
|
|
return value === true ||
|
|
|
|
|
value === "true" ||
|
|
|
|
|
value === "" ||
|
|
|
|
@@ -2880,7 +2880,7 @@ function __wireBooleanAttr(name: string, value: unknown): string {
|
|
|
|
|
: "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function __wireSpreadAttrs(value: unknown): string {
|
|
|
|
|
function __wrnSpreadAttrs(value: unknown): string {
|
|
|
|
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return "";
|
|
|
|
|
|
|
|
|
|
const booleanAttributes = new Set(${JSON.stringify([...HTML_BOOLEAN_ATTRIBUTES])});
|
|
|
|
@@ -2905,27 +2905,27 @@ function __wireSpreadAttrs(value: unknown): string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (booleanAttributes.has(lowerName)) {
|
|
|
|
|
attributes.push(__wireBooleanAttr(name, raw));
|
|
|
|
|
attributes.push(__wrnBooleanAttr(name, raw));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (raw === false || raw === null || raw === undefined) continue;
|
|
|
|
|
attributes.push(" " + name + '="' + __wireAttr(raw) + '"');
|
|
|
|
|
attributes.push(" " + name + '="' + __wrnAttr(raw) + '"');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return attributes.join("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function __wireProp(v: unknown): string {
|
|
|
|
|
function __wrnProp(v: unknown): string {
|
|
|
|
|
const value =
|
|
|
|
|
v !== null && typeof v === "object"
|
|
|
|
|
? JSON.stringify(v)
|
|
|
|
|
: String(v == null ? "" : v);
|
|
|
|
|
|
|
|
|
|
return __wireAttr(value);
|
|
|
|
|
return __wrnAttr(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function __wireRaw(v: unknown): string {
|
|
|
|
|
function __wrnRaw(v: unknown): string {
|
|
|
|
|
return String(v == null ? "" : v);
|
|
|
|
|
}`);
|
|
|
|
|
if (hasServerEach) {
|
|
|
|
@@ -2996,22 +2996,22 @@ function __wireRaw(v: unknown): string {
|
|
|
|
|
out.push(`export default { name: ${JSON.stringify(ast.name)}, kind: ${JSON.stringify(ast.kind)}, render };`);
|
|
|
|
|
return out.join("\n\n") + "\n";
|
|
|
|
|
}
|
|
|
|
|
function __wireRaw(v) {
|
|
|
|
|
function __wrnRaw(v) {
|
|
|
|
|
return String(v == null ? "" : v);
|
|
|
|
|
}
|
|
|
|
|
function wholeAttributeExpression(value) {
|
|
|
|
|
const match = /^\s*\{([\s\S]+)\}\s*$/.exec(value);
|
|
|
|
|
return match?.[1]?.trim() || null;
|
|
|
|
|
}
|
|
|
|
|
function __wireHtml(v) {
|
|
|
|
|
function __wrnHtml(v) {
|
|
|
|
|
return String(v == null ? "" : v).replace(/[&<>]/g, (c) => c === "&" ? "&" : c === "<" ? "<" : ">");
|
|
|
|
|
}
|
|
|
|
|
function __wireAttr(v) {
|
|
|
|
|
function __wrnAttr(v) {
|
|
|
|
|
return String(v == null ? "" : v).replace(/[&<>"]/g, (c) => c === "&" ? "&" : c === "<" ? "<" : c === ">" ? ">" : """);
|
|
|
|
|
}
|
|
|
|
|
function __wireProp(v) {
|
|
|
|
|
function __wrnProp(v) {
|
|
|
|
|
const value = v !== null && typeof v === "object" ? JSON.stringify(v) : String(v == null ? "" : v);
|
|
|
|
|
return __wireAttr(value);
|
|
|
|
|
return __wrnAttr(value);
|
|
|
|
|
}
|
|
|
|
|
function renderPageComponentAttr(attr, dynamicExpressions) {
|
|
|
|
|
if (attr.event) {
|
|
|
|
@@ -3163,8 +3163,8 @@ function resolveWrnImports(declarations, importer, options) {
|
|
|
|
|
*/
|
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
|
exports.DependencyGraph = exports.createCompilationCache = exports.compilationKey = exports.runtimeTypeOf = exports.inferredRuntimeType = exports.eraseFunctionTypes = exports.LexError = exports.Lexer = exports.NativeCompileError = exports.generateNative = exports.runtimeCapabilities = exports.analyzeRuntimeImports = exports.optimizeAst = exports.analyzeRuntimeRequirements = exports.analyzeOptimizations = exports.createWrnSourceMap = exports.resolveWrnImports = exports.resolveWrnImport = exports.createComponentContract = exports.generateStoreModule = exports.generateStoreBrowserModule = exports.generateDeclarations = exports.rpcManifest = exports.generateServerFunctionsModule = exports.generateBrowserModule = exports.generateTargets = exports.generate = exports.ParseError = exports.parse = exports.formatDiagnostic = exports.diagnosticFromError = exports.diagnose = exports.assertValidAst = exports.formatWrn = void 0;
|
|
|
|
|
exports.compileNativeWireFile = compileNativeWireFile;
|
|
|
|
|
exports.compileWireFile = compileWireFile;
|
|
|
|
|
exports.compileNativeWrnFile = compileNativeWrnFile;
|
|
|
|
|
exports.compileWrnFile = compileWrnFile;
|
|
|
|
|
exports.compile = compile;
|
|
|
|
|
const syntax_1 = require("@wrnexus/syntax");
|
|
|
|
|
var syntax_2 = require("@wrnexus/syntax");
|
|
|
|
@@ -3217,7 +3217,7 @@ Object.defineProperty(exports, "eraseFunctionTypes", { enumerable: true, get: fu
|
|
|
|
|
Object.defineProperty(exports, "inferredRuntimeType", { enumerable: true, get: function () { return syntax_5.inferredRuntimeType; } });
|
|
|
|
|
Object.defineProperty(exports, "runtimeTypeOf", { enumerable: true, get: function () { return syntax_5.runtimeTypeOf; } });
|
|
|
|
|
/** Compile `.wrn` source into an Expo Router React Native screen. */
|
|
|
|
|
function compileNativeWireFile(source) {
|
|
|
|
|
function compileNativeWrnFile(source) {
|
|
|
|
|
const ast = (0, syntax_1.parse)(source);
|
|
|
|
|
(0, syntax_1.assertValidAst)(ast);
|
|
|
|
|
return (0, native_codegen_ts_1.generateNative)(ast);
|
|
|
|
@@ -3226,7 +3226,7 @@ function compileNativeWireFile(source) {
|
|
|
|
|
* Compile `.wrn` source into TypeScript source. Errors include a stable code,
|
|
|
|
|
* source location, code frame, and actionable hint whenever available.
|
|
|
|
|
*/
|
|
|
|
|
function compileWireFile(source, filePath = "<inline .wrn>") {
|
|
|
|
|
function compileWrnFile(source, filePath = "<inline .wrn>") {
|
|
|
|
|
try {
|
|
|
|
|
const ast = (0, syntax_1.parse)(source);
|
|
|
|
|
(0, syntax_1.assertValidAst)(ast, { file: filePath, accessibility: true });
|
|
|
|
@@ -3829,7 +3829,7 @@ function __diagnostic(code, message, details) {
|
|
|
|
|
}
|
|
|
|
|
function __csrfToken() {
|
|
|
|
|
if (typeof document === "undefined") return undefined;
|
|
|
|
|
const match = /(?:^|;\\s*)wire-csrf=([^;]+)/.exec(document.cookie || "");
|
|
|
|
|
const match = /(?:^|;\\s*)wrn-csrf=([^;]+)/.exec(document.cookie || "");
|
|
|
|
|
return match ? decodeURIComponent(match[1]) : undefined;
|
|
|
|
|
}
|
|
|
|
|
async function __callServerFunction(storeName, functionName, args, options) {
|
|
|
|
|