@barefootjs/jsx 0.39.0 → 0.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/interface.d.ts +19 -0
- package/dist/adapters/interface.d.ts.map +1 -1
- package/dist/adapters/jsx-adapter.d.ts.map +1 -1
- package/dist/analyzer.d.ts +19 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/compiler.d.ts.map +1 -1
- package/dist/debug.d.ts.map +1 -1
- package/dist/html-types.d.ts +5 -0
- package/dist/html-types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +195 -68
- package/dist/ir-to-client-js/collect-elements.d.ts +17 -1
- package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
- package/dist/ir-to-client-js/reactivity.d.ts +10 -2
- package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
- package/dist/ir-to-client-js/utils.d.ts +11 -7
- package/dist/ir-to-client-js/utils.d.ts.map +1 -1
- package/dist/ssr-defaults.d.ts.map +1 -1
- package/dist/ssr-seed-plan.d.ts.map +1 -1
- package/dist/types.d.ts +44 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +4 -4
- package/src/__tests__/adapter-output.test.ts +142 -0
- package/src/__tests__/create-mutation.test.ts +30 -0
- package/src/__tests__/create-query.test.ts +52 -0
- package/src/__tests__/debug.test.ts +83 -0
- package/src/__tests__/ir-fragment-transparency.test.ts +23 -0
- package/src/__tests__/issue-3240-nested-static-map-event-delegation.test.ts +245 -0
- package/src/__tests__/jsx-text-linebreak-whitespace.test.ts +80 -0
- package/src/__tests__/loop-param-accessor-key-member-safety.test.ts +445 -0
- package/src/adapters/interface.ts +19 -0
- package/src/adapters/jsx-adapter.ts +30 -20
- package/src/analyzer.ts +35 -11
- package/src/compiler.ts +78 -46
- package/src/debug.ts +34 -2
- package/src/html-types.ts +14 -0
- package/src/index.ts +1 -0
- package/src/ir-to-client-js/collect-elements.ts +64 -4
- package/src/ir-to-client-js/control-flow/stringify/event-delegation.ts +112 -3
- package/src/ir-to-client-js/reactivity.ts +31 -1
- package/src/ir-to-client-js/utils.ts +130 -15
- package/src/jsx-to-ir.ts +75 -12
- package/src/ssr-defaults.ts +10 -0
- package/src/ssr-seed-plan.ts +12 -1
- package/src/types.ts +47 -0
package/dist/index.js
CHANGED
|
@@ -3082,8 +3082,7 @@ function wrapLoopParamAsAccessor(expr, paramName, bindings, indexParam) {
|
|
|
3082
3082
|
if (bindings && bindings.length > 0) {
|
|
3083
3083
|
result = rewriteLoopBindingRefs(expr, bindings, "__bfItem()");
|
|
3084
3084
|
} else {
|
|
3085
|
-
|
|
3086
|
-
result = replaceInExprContexts(expr, re, () => `${paramName}()`);
|
|
3085
|
+
result = rewriteIdentifierAsAccessor(expr, paramName);
|
|
3087
3086
|
}
|
|
3088
3087
|
if (indexParam && indexParam !== paramName) {
|
|
3089
3088
|
result = wrapIndexParamAsAccessor(result, indexParam);
|
|
@@ -3091,8 +3090,44 @@ function wrapLoopParamAsAccessor(expr, paramName, bindings, indexParam) {
|
|
|
3091
3090
|
return result;
|
|
3092
3091
|
}
|
|
3093
3092
|
function wrapIndexParamAsAccessor(expr, indexParam) {
|
|
3094
|
-
|
|
3095
|
-
|
|
3093
|
+
return rewriteIdentifierAsAccessor(expr, indexParam);
|
|
3094
|
+
}
|
|
3095
|
+
function rewriteIdentifierAsAccessor(expr, name) {
|
|
3096
|
+
if (!expr.includes(name))
|
|
3097
|
+
return expr;
|
|
3098
|
+
const wrapped = `(${expr})`;
|
|
3099
|
+
const sf = ts5.createSourceFile("__bf_expr.ts", wrapped, ts5.ScriptTarget.Latest, true);
|
|
3100
|
+
const edits = [];
|
|
3101
|
+
const visit = (node) => {
|
|
3102
|
+
if (ts5.isFunctionExpression(node) && node.name?.text === name)
|
|
3103
|
+
return;
|
|
3104
|
+
if (ts5.isIdentifier(node) && node.text === name) {
|
|
3105
|
+
const p = node.parent;
|
|
3106
|
+
if (isNonReferenceIdentifierPosition(node))
|
|
3107
|
+
return;
|
|
3108
|
+
if (ts5.isFunctionDeclaration(p) && p.name === node)
|
|
3109
|
+
return;
|
|
3110
|
+
if (ts5.isCallExpression(p) && p.expression === node)
|
|
3111
|
+
return;
|
|
3112
|
+
if (ts5.isNewExpression(p) && p.expression === node)
|
|
3113
|
+
return;
|
|
3114
|
+
const isShorthand = ts5.isShorthandPropertyAssignment(p) && p.name === node;
|
|
3115
|
+
const start = node.getStart(sf) - 1;
|
|
3116
|
+
const end = node.getEnd() - 1;
|
|
3117
|
+
edits.push({ start, end, replacement: isShorthand ? `${name}: ${name}()` : `${name}()` });
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
3120
|
+
ts5.forEachChild(node, visit);
|
|
3121
|
+
};
|
|
3122
|
+
visit(sf);
|
|
3123
|
+
if (edits.length === 0)
|
|
3124
|
+
return expr;
|
|
3125
|
+
edits.sort((a, b) => b.start - a.start);
|
|
3126
|
+
let out = expr;
|
|
3127
|
+
for (const e of edits) {
|
|
3128
|
+
out = out.slice(0, e.start) + e.replacement + out.slice(e.end);
|
|
3129
|
+
}
|
|
3130
|
+
return out;
|
|
3096
3131
|
}
|
|
3097
3132
|
function rewriteLoopBindingRefs(expr, bindings, accessor) {
|
|
3098
3133
|
const byName = new Map;
|
|
@@ -7137,6 +7172,24 @@ var { default: fs} = (() => ({}));
|
|
|
7137
7172
|
var REACTIVE_BRAND_PACKAGES = [
|
|
7138
7173
|
"@barefootjs/form"
|
|
7139
7174
|
];
|
|
7175
|
+
function isNonReferenceIdentifierPosition(id) {
|
|
7176
|
+
const p = id.parent;
|
|
7177
|
+
if (ts15.isPropertyAccessExpression(p) && p.name === id)
|
|
7178
|
+
return true;
|
|
7179
|
+
if (ts15.isPropertyAssignment(p) && p.name === id)
|
|
7180
|
+
return true;
|
|
7181
|
+
if (ts15.isBindingElement(p) && p.propertyName === id)
|
|
7182
|
+
return true;
|
|
7183
|
+
if ((ts15.isMethodDeclaration(p) || ts15.isGetAccessorDeclaration(p) || ts15.isSetAccessorDeclaration(p) || ts15.isPropertyDeclaration(p) || ts15.isEnumMember(p)) && p.name === id)
|
|
7184
|
+
return true;
|
|
7185
|
+
if (ts15.isJsxAttribute(p) && p.name === id)
|
|
7186
|
+
return true;
|
|
7187
|
+
if (ts15.isLabeledStatement(p) && p.label === id || (ts15.isBreakStatement(p) || ts15.isContinueStatement(p)) && p.label === id)
|
|
7188
|
+
return true;
|
|
7189
|
+
if ((ts15.isJsxOpeningElement(p) || ts15.isJsxSelfClosingElement(p) || ts15.isJsxClosingElement(p)) && p.tagName === id && /^[a-z]/.test(id.text))
|
|
7190
|
+
return true;
|
|
7191
|
+
return false;
|
|
7192
|
+
}
|
|
7140
7193
|
function needsTypeBasedDetection(source) {
|
|
7141
7194
|
if (REACTIVE_BRAND_PACKAGES.some((pkg) => source.includes(pkg)))
|
|
7142
7195
|
return true;
|
|
@@ -10375,19 +10428,7 @@ function detectReactiveFactory(node, sourceFile, filePath) {
|
|
|
10375
10428
|
if (!relevantNames.has(id.text))
|
|
10376
10429
|
return;
|
|
10377
10430
|
const p = id.parent;
|
|
10378
|
-
if (
|
|
10379
|
-
return;
|
|
10380
|
-
if (ts15.isPropertyAssignment(p) && p.name === id)
|
|
10381
|
-
return;
|
|
10382
|
-
if (ts15.isBindingElement(p) && p.propertyName === id)
|
|
10383
|
-
return;
|
|
10384
|
-
if ((ts15.isMethodDeclaration(p) || ts15.isGetAccessorDeclaration(p) || ts15.isSetAccessorDeclaration(p) || ts15.isPropertyDeclaration(p) || ts15.isEnumMember(p)) && p.name === id)
|
|
10385
|
-
return;
|
|
10386
|
-
if (ts15.isJsxAttribute(p) && p.name === id)
|
|
10387
|
-
return;
|
|
10388
|
-
if (ts15.isLabeledStatement(p) && p.label === id || (ts15.isBreakStatement(p) || ts15.isContinueStatement(p)) && p.label === id)
|
|
10389
|
-
return;
|
|
10390
|
-
if ((ts15.isJsxOpeningElement(p) || ts15.isJsxSelfClosingElement(p) || ts15.isJsxClosingElement(p)) && p.tagName === id && /^[a-z]/.test(id.text))
|
|
10431
|
+
if (isNonReferenceIdentifierPosition(id))
|
|
10391
10432
|
return;
|
|
10392
10433
|
if (ts15.isShorthandPropertyAssignment(p) && p.name === id) {
|
|
10393
10434
|
push(id, "shorthand");
|
|
@@ -11064,6 +11105,9 @@ function pickAttrMetaFromIR(src) {
|
|
|
11064
11105
|
...src.freeIdentifiers !== undefined && { freeIdentifiers: src.freeIdentifiers }
|
|
11065
11106
|
};
|
|
11066
11107
|
}
|
|
11108
|
+
function isElidedFactoryGetter(signal) {
|
|
11109
|
+
return Boolean(signal.factory && signal.getterElided);
|
|
11110
|
+
}
|
|
11067
11111
|
var ESCAPE_SSR_COST = {
|
|
11068
11112
|
"client-directive": "client-render",
|
|
11069
11113
|
"prop-precompute": "none",
|
|
@@ -13055,7 +13099,7 @@ function transformSelfClosingComponent(node, ctx, name) {
|
|
|
13055
13099
|
function isTransparentFragment(node, ctx) {
|
|
13056
13100
|
const children = node.children.filter((child2) => {
|
|
13057
13101
|
if (ts18.isJsxText(child2)) {
|
|
13058
|
-
return child2.text
|
|
13102
|
+
return cleanJsxWhitespace(child2.text) !== "";
|
|
13059
13103
|
}
|
|
13060
13104
|
return true;
|
|
13061
13105
|
});
|
|
@@ -13143,9 +13187,6 @@ function transformChildren(children, ctx) {
|
|
|
13143
13187
|
}
|
|
13144
13188
|
const transformed = transformNode(child, ctx);
|
|
13145
13189
|
if (transformed) {
|
|
13146
|
-
if (transformed.type === "text" && transformed.value.trim() === "") {
|
|
13147
|
-
continue;
|
|
13148
|
-
}
|
|
13149
13190
|
result.push(transformed);
|
|
13150
13191
|
}
|
|
13151
13192
|
}
|
|
@@ -13159,8 +13200,8 @@ function isRenderNothingLiteral(expr, ctx) {
|
|
|
13159
13200
|
return e.kind === ts18.SyntaxKind.NullKeyword || e.kind === ts18.SyntaxKind.TrueKeyword || e.kind === ts18.SyntaxKind.FalseKeyword || ts18.isIdentifier(e) && e.text === "undefined" && !isNameBound("undefined", makeBindingEnv(ctx));
|
|
13160
13201
|
}
|
|
13161
13202
|
function transformText(node, ctx) {
|
|
13162
|
-
const text = node.text
|
|
13163
|
-
if (text
|
|
13203
|
+
const text = cleanJsxWhitespace(node.text);
|
|
13204
|
+
if (text === "") {
|
|
13164
13205
|
return null;
|
|
13165
13206
|
}
|
|
13166
13207
|
return {
|
|
@@ -13169,6 +13210,22 @@ function transformText(node, ctx) {
|
|
|
13169
13210
|
loc: getSourceLocation(node, ctx.sourceFile, ctx.filePath)
|
|
13170
13211
|
};
|
|
13171
13212
|
}
|
|
13213
|
+
function cleanJsxWhitespace(raw) {
|
|
13214
|
+
const lines = raw.split(/\r\n|\n|\r/);
|
|
13215
|
+
const kept = [];
|
|
13216
|
+
for (let i = 0;i < lines.length; i++) {
|
|
13217
|
+
const isFirstLine = i === 0;
|
|
13218
|
+
const isLastLine = i === lines.length - 1;
|
|
13219
|
+
let line = lines[i].replace(/\t/g, " ");
|
|
13220
|
+
if (!isFirstLine)
|
|
13221
|
+
line = line.replace(/^ +/, "");
|
|
13222
|
+
if (!isLastLine)
|
|
13223
|
+
line = line.replace(/ +$/, "");
|
|
13224
|
+
if (line !== "")
|
|
13225
|
+
kept.push(line);
|
|
13226
|
+
}
|
|
13227
|
+
return kept.join(" ");
|
|
13228
|
+
}
|
|
13172
13229
|
function transformExpression(node, ctx) {
|
|
13173
13230
|
if (!node.expression)
|
|
13174
13231
|
return null;
|
|
@@ -15331,7 +15388,8 @@ function expandSpreadAttribute(attr, ctx) {
|
|
|
15331
15388
|
name: key,
|
|
15332
15389
|
value: AttrValueOf.expression(`${restName}.${key}`),
|
|
15333
15390
|
loc,
|
|
15334
|
-
freeIdentifiers: perKeyFreeIds
|
|
15391
|
+
freeIdentifiers: perKeyFreeIds,
|
|
15392
|
+
restExpandedKey: true
|
|
15335
15393
|
}));
|
|
15336
15394
|
}
|
|
15337
15395
|
const slotId = generateSpreadSlotId(ctx);
|
|
@@ -16173,7 +16231,7 @@ function processComponentProps(attributes, ctx) {
|
|
|
16173
16231
|
const props = [];
|
|
16174
16232
|
for (const attr of attributes.properties) {
|
|
16175
16233
|
if (ts18.isJsxSpreadAttribute(attr)) {
|
|
16176
|
-
props.push(...expandSpreadAttribute(attr, ctx));
|
|
16234
|
+
props.push(...expandSpreadAttribute(attr, ctx).map(({ restExpandedKey: _restExpandedKey, ...prop }) => prop));
|
|
16177
16235
|
continue;
|
|
16178
16236
|
}
|
|
16179
16237
|
if (!ts18.isJsxAttribute(attr))
|
|
@@ -17048,7 +17106,7 @@ function emptyLoopChildBindings() {
|
|
|
17048
17106
|
conditionals: []
|
|
17049
17107
|
};
|
|
17050
17108
|
}
|
|
17051
|
-
function collectLoopChildEventsWithNesting(node, initialNestingStack = []) {
|
|
17109
|
+
function collectLoopChildEventsWithNesting(node, initialNestingStack = [], siblingOffsets) {
|
|
17052
17110
|
const events = [];
|
|
17053
17111
|
const initialScope = {
|
|
17054
17112
|
nestingStack: initialNestingStack,
|
|
@@ -17088,7 +17146,8 @@ function collectLoopChildEventsWithNesting(node, initialNestingStack = []) {
|
|
|
17088
17146
|
key: l.key,
|
|
17089
17147
|
markerId: l.markerId,
|
|
17090
17148
|
containerSlotId: scope.lastElementSlotId,
|
|
17091
|
-
bindings: emptyLoopChildBindings()
|
|
17149
|
+
bindings: emptyLoopChildBindings(),
|
|
17150
|
+
offset: siblingOffsets ? resolveLoopOffset(siblingOffsets.get(l)) : undefined
|
|
17092
17151
|
}
|
|
17093
17152
|
]
|
|
17094
17153
|
});
|
|
@@ -17562,7 +17621,7 @@ function collectInnerLoops(nodes, siblingOffsets, outerLoopParam, ctx, options)
|
|
|
17562
17621
|
}));
|
|
17563
17622
|
}
|
|
17564
17623
|
for (const child of n.children) {
|
|
17565
|
-
bindings.events.push(...collectLoopChildEventsWithNesting(child));
|
|
17624
|
+
bindings.events.push(...collectLoopChildEventsWithNesting(child, [], siblingOffsets));
|
|
17566
17625
|
}
|
|
17567
17626
|
}
|
|
17568
17627
|
result.push({
|
|
@@ -17944,6 +18003,20 @@ function collectFromElement(element, ctx, insideConditional = false) {
|
|
|
17944
18003
|
const valueStr = attrValueToString(attr.value);
|
|
17945
18004
|
if (!valueStr)
|
|
17946
18005
|
continue;
|
|
18006
|
+
const restKeyHtmlName = toHtmlAttrName(attr.name);
|
|
18007
|
+
const collidesWithExplicitAttr = element.attrs.some((other) => other !== attr && other.name !== "..." && toHtmlAttrName(other.name) === restKeyHtmlName);
|
|
18008
|
+
const restKeyDomKind = classifyDOMProp2(attr.name).kind;
|
|
18009
|
+
if (attr.restExpandedKey && !collidesWithExplicitAttr && restKeyDomKind !== "ref" && restKeyDomKind !== "event" && restKeyDomKind !== "skip") {
|
|
18010
|
+
if (insideConditional)
|
|
18011
|
+
continue;
|
|
18012
|
+
ctx.reactiveAttrs.push({
|
|
18013
|
+
slotId: element.slotId,
|
|
18014
|
+
attrName: attr.name,
|
|
18015
|
+
expression: `${PROPS_PARAM}.${attr.name}`,
|
|
18016
|
+
...pickAttrMetaFromIR(attr)
|
|
18017
|
+
});
|
|
18018
|
+
continue;
|
|
18019
|
+
}
|
|
17947
18020
|
const expandedResult = expandConstantForReactivity(valueStr, ctx, attr.freeIdentifiers);
|
|
17948
18021
|
const expandedValueStr = expandedResult.expr;
|
|
17949
18022
|
if (attr.clientOnly || decideWrapForAttr(expandedValueStr, ctx, attr).wrap) {
|
|
@@ -18124,7 +18197,7 @@ function preambleNamesOf(loop) {
|
|
|
18124
18197
|
function collectLoopChildBindings(children, ctx, siblingOffsets, loopParam, loopParamBindings, preambleNames, loopIndex) {
|
|
18125
18198
|
const bindings = emptyLoopChildBindings();
|
|
18126
18199
|
for (const child of children) {
|
|
18127
|
-
bindings.events.push(...collectLoopChildEventsWithNesting(child));
|
|
18200
|
+
bindings.events.push(...collectLoopChildEventsWithNesting(child, [], siblingOffsets));
|
|
18128
18201
|
bindings.reactiveAttrs.push(...collectLoopChildReactiveAttrs(child, ctx, loopParam, loopParamBindings, true, preambleNames, loopIndex));
|
|
18129
18202
|
bindings.reactiveTexts.push(...collectLoopChildReactiveTexts(child, ctx, loopParam, loopParamBindings, true, preambleNames, loopIndex));
|
|
18130
18203
|
bindings.refs.push(...collectLoopChildRefs(child));
|
|
@@ -24045,14 +24118,44 @@ function emitStaticIndexLookup(ls, ev, handlerCall, lookup, containerVar) {
|
|
|
24045
24118
|
ls.push(` const __idx = Array.from(${containerVar}.children).indexOf(__el)${idxOffset}`);
|
|
24046
24119
|
ls.push(` const ${param} = ${arrayExpr}[__idx]`);
|
|
24047
24120
|
ls.push(` if (${param}) {`);
|
|
24121
|
+
const { guardNames: nestedGuardNames, paramLines: nestedParamLines } = emitNestedIndexParams(ls, ev, "__el", " ");
|
|
24122
|
+
const guarded = nestedGuardNames.length > 0;
|
|
24123
|
+
if (guarded)
|
|
24124
|
+
ls.push(` if (${nestedGuardNames.join(" && ")}) {`);
|
|
24125
|
+
const bodyIndent = guarded ? " " : " ";
|
|
24126
|
+
for (const line of nestedParamLines)
|
|
24127
|
+
ls.push(`${bodyIndent}${line}`);
|
|
24048
24128
|
if (preambleLine)
|
|
24049
|
-
ls.push(
|
|
24129
|
+
ls.push(`${bodyIndent}${preambleLine}`);
|
|
24050
24130
|
if (idxLine)
|
|
24051
|
-
ls.push(
|
|
24052
|
-
ls.push(
|
|
24131
|
+
ls.push(`${bodyIndent}${idxLine}`);
|
|
24132
|
+
ls.push(`${bodyIndent};${handlerCall}`);
|
|
24133
|
+
if (guarded)
|
|
24134
|
+
ls.push(` }`);
|
|
24053
24135
|
ls.push(` }`);
|
|
24054
24136
|
ls.push(` }`);
|
|
24055
24137
|
}
|
|
24138
|
+
function emitNestedIndexParams(ls, ev, baseScopeVar, indent) {
|
|
24139
|
+
const evVar = varSlotId(ev.childSlotId);
|
|
24140
|
+
const guardNames = [];
|
|
24141
|
+
const paramLines = [];
|
|
24142
|
+
let scopeVar = baseScopeVar;
|
|
24143
|
+
for (const nested of ev.nestedLoops) {
|
|
24144
|
+
const containerVarName = `__ic${nested.depth}`;
|
|
24145
|
+
const rowVarName = `__ir${nested.depth}`;
|
|
24146
|
+
const idxVarName = `__iidx${nested.depth}`;
|
|
24147
|
+
const containerExpr = nested.containerSlotId ? `${scopeVar}.querySelector('[bf="${nested.containerSlotId}"]') || ${scopeVar}` : scopeVar;
|
|
24148
|
+
ls.push(`${indent}const ${containerVarName} = ${containerExpr}`);
|
|
24149
|
+
ls.push(`${indent}let ${rowVarName} = ${evVar}El`);
|
|
24150
|
+
ls.push(`${indent}while (${rowVarName}.parentElement && ${rowVarName}.parentElement !== ${containerVarName}) ${rowVarName} = ${rowVarName}.parentElement`);
|
|
24151
|
+
const offsetSuffix = buildLoopChildIndexSubtraction(nested.offset);
|
|
24152
|
+
ls.push(`${indent}const ${idxVarName} = ${rowVarName}.parentElement === ${containerVarName} ? Array.from(${containerVarName}.children).indexOf(${rowVarName})${offsetSuffix} : -1`);
|
|
24153
|
+
guardNames.push(`${idxVarName} >= 0`);
|
|
24154
|
+
paramLines.push(`const ${nested.param} = ${nested.array}[${idxVarName}]`);
|
|
24155
|
+
scopeVar = rowVarName;
|
|
24156
|
+
}
|
|
24157
|
+
return { guardNames, paramLines };
|
|
24158
|
+
}
|
|
24056
24159
|
|
|
24057
24160
|
// src/ir-to-client-js/control-flow/stringify/branch-loop.ts
|
|
24058
24161
|
function stringifyBranchLoop(lines, plan) {
|
|
@@ -25719,6 +25822,8 @@ function extractSsrDefaults(metadata) {
|
|
|
25719
25822
|
continue;
|
|
25720
25823
|
if (sig.envReader)
|
|
25721
25824
|
continue;
|
|
25825
|
+
if (isElidedFactoryGetter(sig))
|
|
25826
|
+
continue;
|
|
25722
25827
|
const value = tryStaticEval(sig.initialValue, { bindings, propsLike });
|
|
25723
25828
|
if (metadata.propsObjectName !== null && referencesOwnProp(sig.initialValue, metadata.propsObjectName, sig.getter, localConsts)) {
|
|
25724
25829
|
if (!(sig.getter in out)) {
|
|
@@ -26583,7 +26688,7 @@ function computeSsrSeedPlan(metadata) {
|
|
|
26583
26688
|
}
|
|
26584
26689
|
}
|
|
26585
26690
|
const expr = signal.initialValue.trim();
|
|
26586
|
-
steps.push(expr === "" ? { kind: "opaque", name: signal.getter, origin: "signal" } : classify2(signal.getter, "signal", expr, resolveThroughLocalConsts(signal.parsed ?? parseExpression(`(${expr})`), localConsts), available));
|
|
26691
|
+
steps.push(expr === "" || isElidedFactoryGetter(signal) ? { kind: "opaque", name: signal.getter, origin: "signal" } : classify2(signal.getter, "signal", expr, resolveThroughLocalConsts(signal.parsed ?? parseExpression(`(${expr})`), localConsts), available));
|
|
26587
26692
|
available.add(signal.getter);
|
|
26588
26693
|
}
|
|
26589
26694
|
for (const memo of metadata.memos) {
|
|
@@ -27164,6 +27269,7 @@ function compileMultipleComponents(source, filePath, componentNames, options) {
|
|
|
27164
27269
|
const files = [];
|
|
27165
27270
|
const errors = [];
|
|
27166
27271
|
const adapter = options.adapter;
|
|
27272
|
+
const skipTemplateAssembly = adapter.emitsTemplates === false;
|
|
27167
27273
|
const entries = [];
|
|
27168
27274
|
const callerProgram = options.program?.getSourceFile(filePath)?.text === source ? options.program : undefined;
|
|
27169
27275
|
const program = callerProgram ?? (needsTypeBasedDetection(source) ? createProgramForFile(source, filePath)?.program : undefined);
|
|
@@ -27296,7 +27402,7 @@ function compileMultipleComponents(source, filePath, componentNames, options) {
|
|
|
27296
27402
|
scriptAssets: options.scriptAssets,
|
|
27297
27403
|
preloadAssets: options.preloadAssets
|
|
27298
27404
|
});
|
|
27299
|
-
const moduleExports = generateModuleExports(componentIR, fileWideInlineExported, options.rewriteRelativeImport, { skipValueDeclarations: adapterOutput.sections.moduleConstantsIncludeExports });
|
|
27405
|
+
const moduleExports = skipTemplateAssembly ? "" : generateModuleExports(componentIR, fileWideInlineExported, options.rewriteRelativeImport, { skipValueDeclarations: adapterOutput.sections.moduleConstantsIncludeExports });
|
|
27300
27406
|
const s = adapterOutput.sections;
|
|
27301
27407
|
const imports = s.imports;
|
|
27302
27408
|
const types = s.types;
|
|
@@ -27362,43 +27468,48 @@ function compileMultipleComponents(source, filePath, componentNames, options) {
|
|
|
27362
27468
|
}
|
|
27363
27469
|
return { files, errors };
|
|
27364
27470
|
}
|
|
27365
|
-
|
|
27471
|
+
let combinedTemplate;
|
|
27472
|
+
if (skipTemplateAssembly) {
|
|
27473
|
+
combinedTemplate = "";
|
|
27474
|
+
} else {
|
|
27475
|
+
const mergedImports = mergeTemplateImports(allOutputs.flatMap((o) => o.imports ? o.imports.split(`
|
|
27366
27476
|
`) : []));
|
|
27367
|
-
|
|
27368
|
-
|
|
27369
|
-
|
|
27370
|
-
|
|
27371
|
-
|
|
27372
|
-
|
|
27373
|
-
|
|
27374
|
-
|
|
27375
|
-
|
|
27376
|
-
|
|
27377
|
-
|
|
27378
|
-
|
|
27379
|
-
|
|
27477
|
+
const seenTypes = new Set;
|
|
27478
|
+
const uniqueTypes = [];
|
|
27479
|
+
for (const output of allOutputs) {
|
|
27480
|
+
if (output.types && !seenTypes.has(output.types)) {
|
|
27481
|
+
seenTypes.add(output.types);
|
|
27482
|
+
uniqueTypes.push(output.types);
|
|
27483
|
+
}
|
|
27484
|
+
}
|
|
27485
|
+
const seenModuleExports = new Set;
|
|
27486
|
+
const uniqueModuleExports = [];
|
|
27487
|
+
for (const output of allOutputs) {
|
|
27488
|
+
if (output.moduleExports) {
|
|
27489
|
+
for (const line of output.moduleExports.split(`
|
|
27380
27490
|
`)) {
|
|
27381
|
-
|
|
27382
|
-
|
|
27383
|
-
|
|
27491
|
+
if (line.trim() && !seenModuleExports.has(line)) {
|
|
27492
|
+
seenModuleExports.add(line);
|
|
27493
|
+
uniqueModuleExports.push(line);
|
|
27494
|
+
}
|
|
27384
27495
|
}
|
|
27385
27496
|
}
|
|
27386
27497
|
}
|
|
27387
|
-
|
|
27388
|
-
|
|
27389
|
-
|
|
27390
|
-
moduleStatementsOrdered.join(`
|
|
27498
|
+
combinedTemplate = [
|
|
27499
|
+
mergedImports,
|
|
27500
|
+
moduleStatementsOrdered.join(`
|
|
27391
27501
|
|
|
27392
27502
|
`),
|
|
27393
|
-
|
|
27503
|
+
uniqueTypes.join(`
|
|
27394
27504
|
|
|
27395
27505
|
`),
|
|
27396
|
-
|
|
27506
|
+
uniqueModuleExports.length > 0 ? uniqueModuleExports.join(`
|
|
27397
27507
|
`) : "",
|
|
27398
|
-
|
|
27399
|
-
|
|
27508
|
+
...allOutputs.map((o) => o.component)
|
|
27509
|
+
].filter(Boolean).join(`
|
|
27400
27510
|
|
|
27401
27511
|
`);
|
|
27512
|
+
}
|
|
27402
27513
|
files.push({
|
|
27403
27514
|
path: filePath.replace(/\.tsx?$/, adapter.extension),
|
|
27404
27515
|
content: combinedTemplate,
|
|
@@ -27590,6 +27701,8 @@ function compileJSX(source, filePath, options) {
|
|
|
27590
27701
|
let content;
|
|
27591
27702
|
if (adapter.templatesPerComponent) {
|
|
27592
27703
|
content = adapterOutput.template;
|
|
27704
|
+
} else if (adapter.emitsTemplates === false) {
|
|
27705
|
+
content = "";
|
|
27593
27706
|
} else {
|
|
27594
27707
|
const moduleExports = generateModuleExports(componentIR, undefined, options.rewriteRelativeImport, {
|
|
27595
27708
|
skipValueDeclarations: s.moduleConstantsIncludeExports
|
|
@@ -27777,13 +27890,15 @@ class JsxAdapter extends BaseAdapter {
|
|
|
27777
27890
|
}
|
|
27778
27891
|
continue;
|
|
27779
27892
|
}
|
|
27780
|
-
|
|
27781
|
-
|
|
27782
|
-
|
|
27783
|
-
|
|
27784
|
-
|
|
27785
|
-
|
|
27786
|
-
|
|
27893
|
+
if (!isElidedFactoryGetter(signal)) {
|
|
27894
|
+
const rawInitialValue = preserveTypes ? signal.typedInitialValue ?? signal.initialValue : signal.initialValue;
|
|
27895
|
+
const initialValue = rawInitialValue.trim().startsWith("{") ? `(${rawInitialValue})` : rawInitialValue;
|
|
27896
|
+
const needsTypeAssertion = preserveTypes && !signal.typedInitialValue && signal.type.kind !== "unknown" && signal.type.kind !== "primitive" && signal.type.raw !== "object";
|
|
27897
|
+
if (needsTypeAssertion) {
|
|
27898
|
+
lines.push(` const ${signal.getter} = () => ${initialValue} as ${signal.type.raw}`);
|
|
27899
|
+
} else {
|
|
27900
|
+
lines.push(` const ${signal.getter} = () => ${initialValue}`);
|
|
27901
|
+
}
|
|
27787
27902
|
}
|
|
27788
27903
|
const action = signal.factory?.action;
|
|
27789
27904
|
if (action && identifierPattern(action).test(setterRefText)) {
|
|
@@ -29225,7 +29340,7 @@ function buildGraphFromIR(ir) {
|
|
|
29225
29340
|
addConsumer(dep, `query:${f.key}`, true);
|
|
29226
29341
|
for (const m of memos)
|
|
29227
29342
|
m.consumers = memoConsumers.get(m.name) ?? [];
|
|
29228
|
-
const signals = meta.signals.filter((s) => !(s
|
|
29343
|
+
const signals = meta.signals.filter((s) => !isElidedFactoryGetter(s)).map((s) => {
|
|
29229
29344
|
const factory = factoryOf.get(s);
|
|
29230
29345
|
return {
|
|
29231
29346
|
kind: "signal",
|
|
@@ -30445,7 +30560,18 @@ function collectDomBindings(node, bindings, signalGetters, memoNames, parentTag,
|
|
|
30445
30560
|
}
|
|
30446
30561
|
case "loop": {
|
|
30447
30562
|
if (node.slotId) {
|
|
30448
|
-
const
|
|
30563
|
+
const { filterPredicate, sortComparator } = node;
|
|
30564
|
+
const callbackDeps = (raw, params) => {
|
|
30565
|
+
const callbackScope = scope.enterCallback(params);
|
|
30566
|
+
return extractReactiveDeps(raw, signalGetters, memoNames).filter((name) => !callbackScope.isBound(name));
|
|
30567
|
+
};
|
|
30568
|
+
const deps = [
|
|
30569
|
+
...new Set([
|
|
30570
|
+
...extractReactiveDeps(node.array, signalGetters, memoNames),
|
|
30571
|
+
...filterPredicate ? callbackDeps(filterPredicate.raw, [filterPredicate.param]) : [],
|
|
30572
|
+
...sortComparator ? callbackDeps(sortComparator.raw, [sortComparator.paramA, sortComparator.paramB]) : []
|
|
30573
|
+
])
|
|
30574
|
+
];
|
|
30449
30575
|
const loopReactive = boundNames.size > 0 && node.arrayFreeIdentifiers !== undefined && setSomeIn(boundNames, node.arrayFreeIdentifiers);
|
|
30450
30576
|
const isReactive = deps.length > 0 || node.callsReactiveGetters === true || loopReactive;
|
|
30451
30577
|
const isFallback = !isReactive && node.hasFunctionCalls === true;
|
|
@@ -31904,6 +32030,7 @@ export {
|
|
|
31904
32030
|
isFunctionShapedExpression,
|
|
31905
32031
|
isFullyStaticLiteral,
|
|
31906
32032
|
isEventHandlerName,
|
|
32033
|
+
isElidedFactoryGetter,
|
|
31907
32034
|
isDangerousInnerHtmlAttr,
|
|
31908
32035
|
isBooleanAttr,
|
|
31909
32036
|
importsSearchParams,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* IR tree traversal → collect elements into ClientJsContext.
|
|
3
3
|
*/
|
|
4
4
|
import { type IRNode, type IRLoop } from '../types.ts';
|
|
5
|
-
import type { ClientJsContext, LoopChildBindings, LoopChildConditional, NestedLoop } from './types.ts';
|
|
5
|
+
import type { ClientJsContext, LoopChildBindings, LoopChildConditional, LoopOffset, NestedLoop } from './types.ts';
|
|
6
6
|
import { type LoopParamSpec } from './utils.ts';
|
|
7
7
|
import type { BindingScope } from '../scope/binding-scope.ts';
|
|
8
8
|
/**
|
|
@@ -38,6 +38,22 @@ import type { BindingScope } from '../scope/binding-scope.ts';
|
|
|
38
38
|
* two separate traversals.
|
|
39
39
|
*/
|
|
40
40
|
export declare function computeLoopSiblingOffsets(root: IRNode): Map<IRLoop, IRNode[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Resolve a loop's preceding-sibling run into the `LoopOffset` value object
|
|
43
|
+
* stored on `TopLevelLoop` / `NestedLoop`: the folded static element count
|
|
44
|
+
* plus one dynamic term (`(arr).length`, `(cond ? … : …)`) per sibling whose
|
|
45
|
+
* count is only known at runtime. Siblings whose count is statically
|
|
46
|
+
* undecidable fall back to `legacyElementCount` (the pre-#1693 behaviour).
|
|
47
|
+
* Returns `undefined` when nothing precedes the loop (or only non-element
|
|
48
|
+
* nodes do), so the loop keeps bare `children[idx]`.
|
|
49
|
+
*
|
|
50
|
+
* Exported for `collectLoopChildEventsWithNesting` (`reactivity.ts`), which
|
|
51
|
+
* builds its own `NestedLoop` chain for delegated-event metadata and needs
|
|
52
|
+
* the same static-sibling-count resolution the hydration side
|
|
53
|
+
* (`collectInnerLoops`, below) already applies — see that call site's
|
|
54
|
+
* comment (#3240 follow-up).
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveLoopOffset(preceding: IRNode[] | undefined): LoopOffset | undefined;
|
|
41
57
|
/**
|
|
42
58
|
* Options controlling `collectInnerLoops` traversal and payload collection.
|
|
43
59
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-elements.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/collect-elements.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAwD,KAAK,MAAM,EAAmC,MAAM,aAAa,CAAA;AAC7I,OAAO,KAAK,EAAE,eAAe,EAA+H,iBAAiB,EAA0B,oBAAoB,
|
|
1
|
+
{"version":3,"file":"collect-elements.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/collect-elements.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAwD,KAAK,MAAM,EAAmC,MAAM,aAAa,CAAA;AAC7I,OAAO,KAAK,EAAE,eAAe,EAA+H,iBAAiB,EAA0B,oBAAoB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACvQ,OAAO,EAAkF,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAS/H,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAmG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAA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C,EAAE,MAAM,GAAG,IAAI,GACxB,iBAAiB,CAenB;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,eAAe,EACpB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACrC,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,SAAS,OAAO,aAAa,EAAE,gBAAgB,EAAE;AACrE;;;;;;;;GAQG;AACH,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;AACnC;;;GAGG;AACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;AACzB;;;;;;;;;;;;;;GAcG;AACH,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC;AAClD,uFAAuF;AACvF,WAAW,CAAC,EAAE,YAAY,GACzB,oBAAoB,EAAE,CAsFxB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reactivity detection: reactive expression checking, event/ref collection.
|
|
3
3
|
*/
|
|
4
|
-
import { type IRNode, type IRComponent, type IRProp, type LoopParamBinding, type OriginInfo } from '../types.ts';
|
|
4
|
+
import { type IRNode, type IRComponent, type IRLoop, type IRProp, type LoopParamBinding, type OriginInfo } from '../types.ts';
|
|
5
5
|
import type { ClientJsContext, ConditionalBranchEvent, ConditionalBranchRef, LoopChildBindings, LoopChildEvent, LoopChildReactiveAttr, LoopChildRef, LoopChildReactiveText, NestedLoop } from './types.ts';
|
|
6
6
|
import { BindingScope } from '../scope/binding-scope.ts';
|
|
7
7
|
/**
|
|
@@ -267,7 +267,15 @@ export declare function collectLoopChildEvents(node: IRNode): LoopChildEvent[];
|
|
|
267
267
|
* Recursively descends into nested IRLoop nodes, building NestedLoop
|
|
268
268
|
* for multi-level event delegation (data-key-N resolution).
|
|
269
269
|
*/
|
|
270
|
-
export declare function collectLoopChildEventsWithNesting(node: IRNode, initialNestingStack?: NestedLoop[]
|
|
270
|
+
export declare function collectLoopChildEventsWithNesting(node: IRNode, initialNestingStack?: NestedLoop[],
|
|
271
|
+
/**
|
|
272
|
+
* The whole-component sibling-offset pre-pass (`computeLoopSiblingOffsets`,
|
|
273
|
+
* `collect-elements.ts`), keyed by IR loop-node identity. Optional — a
|
|
274
|
+
* caller with no sibling-offset data (none exist today) gets `nested.offset`
|
|
275
|
+
* left `undefined`, same as before #3240's follow-up fix, rather than a
|
|
276
|
+
* required param forcing every call site to thread an empty Map.
|
|
277
|
+
*/
|
|
278
|
+
siblingOffsets?: Map<IRLoop, IRNode[]>): LoopChildEvent[];
|
|
271
279
|
/**
|
|
272
280
|
* Collect child component nodes from a conditional branch for use with insert().
|
|
273
281
|
* These components will be re-initialized via initChild() in the branch's bindEvents callback.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactivity.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/reactivity.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAkB,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,KAAK,UAAU,EAAwC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"reactivity.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/reactivity.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAkB,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,KAAK,UAAU,EAAwC,MAAM,aAAa,CAAA;AACnL,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,qBAAqB,EACrB,UAAU,EACX,MAAM,YAAY,CAAA;AAenB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAIxD;;;;;;;;;;;;;;;;;;;;;;;;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e,EACpB,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,SAAS,gBAAgB,EAAE,EAC/C,0BAA0B,UAAQ,EAClC,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EACnC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;AACzB,uFAAuF;AACvF,WAAW,CAAC,EAAE,YAAY,GACzB,qBAAqB,EAAE,CAsEzB"}
|
|
@@ -347,9 +347,12 @@ export declare function tokenContainsIdent(expr: string, ident: string): boolean
|
|
|
347
347
|
* e.g., "item.text" → "item().text", "item" → "item()"
|
|
348
348
|
* Does not double-wrap: "item().text" stays "item().text"
|
|
349
349
|
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
350
|
+
* The plain-param branch (`rewriteIdentifierAsAccessor`) walks the real AST,
|
|
351
|
+
* so it is inherently string/template-literal-context aware (a CSS class
|
|
352
|
+
* name like "preview-field" never surfaces as an `Identifier` node when
|
|
353
|
+
* `paramName` is "field") AND skips object-literal keys, shorthand
|
|
354
|
+
* properties, and member/property names — tokens that spell `paramName`
|
|
355
|
+
* without referencing it (#3239).
|
|
353
356
|
*
|
|
354
357
|
* When `bindings` is supplied (destructured `.map()` callback, #951), each
|
|
355
358
|
* binding name is rewritten to `__bfItem()${path}` instead of wrapping the
|
|
@@ -373,10 +376,11 @@ export declare function tokenContainsIdent(expr: string, ident: string): boolean
|
|
|
373
376
|
*/
|
|
374
377
|
export declare function wrapLoopParamAsAccessor(expr: string, paramName: string, bindings?: readonly LoopParamBinding[], indexParam?: string | null): string;
|
|
375
378
|
/**
|
|
376
|
-
* The index-only half of `wrapLoopParamAsAccessor` — same
|
|
377
|
-
* identifier
|
|
378
|
-
*
|
|
379
|
-
*
|
|
379
|
+
* The index-only half of `wrapLoopParamAsAccessor` — same AST-aware
|
|
380
|
+
* identifier rewrite (`rewriteIdentifierAsAccessor`), own identifier.
|
|
381
|
+
* Factored out so `wrapLoopParamAsAccessor` can run it as a second pass
|
|
382
|
+
* regardless of which item-rewrite branch (bindings vs. plain param) ran
|
|
383
|
+
* first (#2859).
|
|
380
384
|
*
|
|
381
385
|
* Also exported standalone for `build-loop.ts`/`build-branch-loop.ts`: a
|
|
382
386
|
* plain loop's `template`/`mapPreambleWrapped` are built ONCE, before lazy
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAkB,gBAAgB,EAAE,aAAa,EAAE,MAAM,EAAc,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9H,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/ir-to-client-js/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAkB,gBAAgB,EAAE,aAAa,EAAE,MAAM,EAAc,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9H,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAGtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAQ5D,OAAO,EACL,MAAM,IAAI,QAAQ,EAClB,aAAa,IAAI,eAAe,EAChC,cAAc,IAAI,UAAU,EAC5B,aAAa,EACb,WAAW,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,cAAc,IAAI,cAAc,EAChC,WAAW,IAAI,iBAAiB,EAEjC,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,CAAA;AAE5I;;;GAGG;AACH,eAAO,MAAM,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IACtE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,MAAM,CAQ/G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-defaults.d.ts","sourceRoot":"","sources":["../src/ssr-defaults.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"ssr-defaults.d.ts","sourceRoot":"","sources":["../src/ssr-defaults.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAG5C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,KAAK,EAAE,OAAO,CAAA;IACd;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB;AAkBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,CAuQ/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr-seed-plan.d.ts","sourceRoot":"","sources":["../src/ssr-seed-plan.ts"],"names":[],"mappings":"AAAA;;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