@barefootjs/rust 0.35.4 → 0.35.6
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/adapter/index.js +2 -2
- package/dist/adapter/minijinja-adapter.d.ts.map +1 -1
- package/dist/conformance-pins.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/render-divergences.d.ts.map +1 -1
- package/dist/vite.js +199 -182
- package/package.json +5 -5
- package/src/adapter/minijinja-adapter.ts +22 -29
- package/src/conformance-pins.ts +11 -0
- package/src/render-divergences.ts +6 -0
package/dist/adapter/index.js
CHANGED
|
@@ -188648,11 +188648,11 @@ ${whenTrue}
|
|
|
188648
188648
|
const arrayName = loop.array.trim();
|
|
188649
188649
|
if (staticArray === null && /^[A-Za-z_$][\w$]*$/.test(arrayName)) {
|
|
188650
188650
|
const arrayConst = (this.localConstants ?? []).find((c) => c.name === arrayName);
|
|
188651
|
-
if (arrayConst &&
|
|
188651
|
+
if (arrayConst && this._resolveLiteralConst(arrayName) === null) {
|
|
188652
188652
|
this.errors.push({
|
|
188653
188653
|
code: "BF101",
|
|
188654
188654
|
severity: "error",
|
|
188655
|
-
message: `Loop array \`${arrayName}\` is a
|
|
188655
|
+
message: `Loop array \`${arrayName}\` is a const (module- or function-scope) computed value (\`${arrayConst.value}\`) that the MiniJinja adapter cannot bind as a template variable — only numeric/string-literal locals inline at their use site.`,
|
|
188656
188656
|
loc: loop.loc ?? { file: this.componentName + ".tsx", start: { line: 1, column: 0 }, end: { line: 1, column: 0 } },
|
|
188657
188657
|
suggestion: {
|
|
188658
188658
|
message: "Pre-compute the array server-side and pass it as a prop, or mark the loop position as @client-only so it runs in JS on the client.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minijinja-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/minijinja-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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@@
|
|
|
1
|
-
{"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eAmF7B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -188648,11 +188648,11 @@ ${whenTrue}
|
|
|
188648
188648
|
const arrayName = loop.array.trim();
|
|
188649
188649
|
if (staticArray === null && /^[A-Za-z_$][\w$]*$/.test(arrayName)) {
|
|
188650
188650
|
const arrayConst = (this.localConstants ?? []).find((c) => c.name === arrayName);
|
|
188651
|
-
if (arrayConst &&
|
|
188651
|
+
if (arrayConst && this._resolveLiteralConst(arrayName) === null) {
|
|
188652
188652
|
this.errors.push({
|
|
188653
188653
|
code: "BF101",
|
|
188654
188654
|
severity: "error",
|
|
188655
|
-
message: `Loop array \`${arrayName}\` is a
|
|
188655
|
+
message: `Loop array \`${arrayName}\` is a const (module- or function-scope) computed value (\`${arrayConst.value}\`) that the MiniJinja adapter cannot bind as a template variable — only numeric/string-literal locals inline at their use site.`,
|
|
188656
188656
|
loc: loop.loc ?? { file: this.componentName + ".tsx", start: { line: 1, column: 0 }, end: { line: 1, column: 0 } },
|
|
188657
188657
|
suggestion: {
|
|
188658
188658
|
message: "Pre-compute the array server-side and pass it as a prop, or mark the loop position as @client-only so it runs in JS on the client.",
|
|
@@ -189241,6 +189241,13 @@ var conformancePins = {
|
|
|
189241
189241
|
issue: "https://github.com/piconic-ai/barefootjs/issues/2321"
|
|
189242
189242
|
}
|
|
189243
189243
|
],
|
|
189244
|
+
"module-const-loop-source-computed": [
|
|
189245
|
+
{
|
|
189246
|
+
code: "BF101",
|
|
189247
|
+
severity: "error",
|
|
189248
|
+
issue: "https://github.com/piconic-ai/barefootjs/issues/2946"
|
|
189249
|
+
}
|
|
189250
|
+
],
|
|
189244
189251
|
"filter-nested-callback-predicate": [
|
|
189245
189252
|
{ code: "BF101", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2320" }
|
|
189246
189253
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAcxD,eAAO,MAAM,iBAAiB,EAAE,iBAAsB,CAAA"}
|
package/dist/vite.js
CHANGED
|
@@ -5,10 +5,10 @@ import { barefoot as coreBarefoot } from "@barefootjs/vite";
|
|
|
5
5
|
import { devModuleUrl, loadManifest, resolveDevOrigin, resolveScriptAssets, toPosixRelative } from "@barefootjs/vite";
|
|
6
6
|
|
|
7
7
|
// ../jsx/src/compiler.ts
|
|
8
|
-
import
|
|
8
|
+
import ts26 from "typescript";
|
|
9
9
|
|
|
10
10
|
// ../jsx/src/analyzer.ts
|
|
11
|
-
import
|
|
11
|
+
import ts14 from "typescript";
|
|
12
12
|
|
|
13
13
|
// ../jsx/src/expression-parser.ts
|
|
14
14
|
import ts from "typescript";
|
|
@@ -2039,7 +2039,7 @@ function identifierPath(callee) {
|
|
|
2039
2039
|
}
|
|
2040
2040
|
|
|
2041
2041
|
// ../jsx/src/prop-rewrite.ts
|
|
2042
|
-
import
|
|
2042
|
+
import ts10 from "typescript";
|
|
2043
2043
|
|
|
2044
2044
|
// ../jsx/src/ir-to-client-js/utils.ts
|
|
2045
2045
|
import ts3 from "typescript";
|
|
@@ -2189,6 +2189,17 @@ function resolveJsxChildrenProp(props) {
|
|
|
2189
2189
|
return [];
|
|
2190
2190
|
return prop.value.children ?? [];
|
|
2191
2191
|
}
|
|
2192
|
+
// ../jsx/src/ir-to-client-js/utils.ts
|
|
2193
|
+
var NON_BUBBLING_EVENTS = new Set([
|
|
2194
|
+
"blur",
|
|
2195
|
+
"focus",
|
|
2196
|
+
"load",
|
|
2197
|
+
"unload",
|
|
2198
|
+
"mouseenter",
|
|
2199
|
+
"mouseleave",
|
|
2200
|
+
"pointerenter",
|
|
2201
|
+
"pointerleave"
|
|
2202
|
+
]);
|
|
2192
2203
|
// ../jsx/src/ir-to-client-js/component-scope.ts
|
|
2193
2204
|
function buildImportAliasMap(imports) {
|
|
2194
2205
|
const aliases = new Map;
|
|
@@ -2205,16 +2216,71 @@ function buildImportAliasMap(imports) {
|
|
|
2205
2216
|
}
|
|
2206
2217
|
|
|
2207
2218
|
// ../jsx/src/ir-to-client-js/csr-substitute.ts
|
|
2208
|
-
import
|
|
2219
|
+
import ts8 from "typescript";
|
|
2209
2220
|
|
|
2210
2221
|
// ../jsx/src/props-binding.ts
|
|
2222
|
+
import ts7 from "typescript";
|
|
2223
|
+
|
|
2224
|
+
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
2211
2225
|
import ts4 from "typescript";
|
|
2226
|
+
|
|
2227
|
+
// ../jsx/src/ir-to-client-js/identifiers.ts
|
|
2228
|
+
var KEYWORDS_AND_GLOBALS = new Set([
|
|
2229
|
+
"true",
|
|
2230
|
+
"false",
|
|
2231
|
+
"null",
|
|
2232
|
+
"undefined",
|
|
2233
|
+
"this",
|
|
2234
|
+
"const",
|
|
2235
|
+
"let",
|
|
2236
|
+
"var",
|
|
2237
|
+
"function",
|
|
2238
|
+
"return",
|
|
2239
|
+
"if",
|
|
2240
|
+
"else",
|
|
2241
|
+
"for",
|
|
2242
|
+
"while",
|
|
2243
|
+
"do",
|
|
2244
|
+
"switch",
|
|
2245
|
+
"case",
|
|
2246
|
+
"break",
|
|
2247
|
+
"continue",
|
|
2248
|
+
"new",
|
|
2249
|
+
"typeof",
|
|
2250
|
+
"instanceof",
|
|
2251
|
+
"void",
|
|
2252
|
+
"delete",
|
|
2253
|
+
"console",
|
|
2254
|
+
"window",
|
|
2255
|
+
"document",
|
|
2256
|
+
"Math",
|
|
2257
|
+
"String",
|
|
2258
|
+
"Number",
|
|
2259
|
+
"Array",
|
|
2260
|
+
"Object",
|
|
2261
|
+
"Boolean",
|
|
2262
|
+
"Date",
|
|
2263
|
+
"JSON",
|
|
2264
|
+
"Promise",
|
|
2265
|
+
"setTimeout",
|
|
2266
|
+
"setInterval",
|
|
2267
|
+
"clearTimeout",
|
|
2268
|
+
"clearInterval"
|
|
2269
|
+
]);
|
|
2270
|
+
|
|
2271
|
+
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
2272
|
+
import ts6 from "typescript";
|
|
2273
|
+
|
|
2274
|
+
// ../jsx/src/value-references.ts
|
|
2275
|
+
import ts5 from "typescript";
|
|
2276
|
+
|
|
2277
|
+
// ../jsx/src/props-binding.ts
|
|
2212
2278
|
function isIdentifierName(key) {
|
|
2213
2279
|
if (key.length === 0)
|
|
2214
2280
|
return false;
|
|
2215
2281
|
for (let i = 0;i < key.length; ) {
|
|
2216
2282
|
const cp = key.codePointAt(i);
|
|
2217
|
-
const ok = i === 0 ?
|
|
2283
|
+
const ok = i === 0 ? ts7.isIdentifierStart(cp, ts7.ScriptTarget.Latest) : ts7.isIdentifierPart(cp, ts7.ScriptTarget.Latest);
|
|
2218
2284
|
if (!ok)
|
|
2219
2285
|
return false;
|
|
2220
2286
|
i += cp > 65535 ? 2 : 1;
|
|
@@ -2233,16 +2299,16 @@ var EMPTY_SET = new Set;
|
|
|
2233
2299
|
function extractFreeIdentifiersFromText(text) {
|
|
2234
2300
|
if (!text || text.trim().length === 0)
|
|
2235
2301
|
return new Set;
|
|
2236
|
-
const sf =
|
|
2302
|
+
const sf = ts8.createSourceFile("__free_ids__.ts", `(${text});`, ts8.ScriptTarget.Latest, true, ts8.ScriptKind.TS);
|
|
2237
2303
|
const stmt = sf.statements[0];
|
|
2238
|
-
if (!stmt || !
|
|
2304
|
+
if (!stmt || !ts8.isExpressionStatement(stmt))
|
|
2239
2305
|
return new Set;
|
|
2240
|
-
const expr =
|
|
2306
|
+
const expr = ts8.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
|
|
2241
2307
|
return extractFreeIdentifiersFromNode(expr);
|
|
2242
2308
|
}
|
|
2243
2309
|
|
|
2244
2310
|
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
2245
|
-
import
|
|
2311
|
+
import ts9 from "typescript";
|
|
2246
2312
|
|
|
2247
2313
|
// ../jsx/src/adapters/child-scope.ts
|
|
2248
2314
|
function derivesScopeFromSlot(comp) {
|
|
@@ -2389,17 +2455,17 @@ function freshCounters() {
|
|
|
2389
2455
|
}
|
|
2390
2456
|
|
|
2391
2457
|
// ../jsx/src/analyzer-context.ts
|
|
2392
|
-
import
|
|
2458
|
+
import ts13 from "typescript";
|
|
2393
2459
|
|
|
2394
2460
|
// ../jsx/src/strip-types.ts
|
|
2395
|
-
import
|
|
2461
|
+
import ts11 from "typescript";
|
|
2396
2462
|
|
|
2397
2463
|
// ../jsx/src/reactivity-checker.ts
|
|
2398
|
-
import
|
|
2464
|
+
import ts12 from "typescript";
|
|
2399
2465
|
|
|
2400
2466
|
// ../jsx/src/analyzer-context.ts
|
|
2401
|
-
var _typePrinter =
|
|
2402
|
-
var _blankTypeSourceFile =
|
|
2467
|
+
var _typePrinter = ts13.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
|
2468
|
+
var _blankTypeSourceFile = ts13.createSourceFile("__bf_types__.ts", "", ts13.ScriptTarget.Latest);
|
|
2403
2469
|
|
|
2404
2470
|
// ../jsx/src/errors.ts
|
|
2405
2471
|
var ErrorCodes = {
|
|
@@ -2412,7 +2478,6 @@ var ErrorCodes = {
|
|
|
2412
2478
|
MISSING_KEY_IN_NESTED_LIST: "BF024",
|
|
2413
2479
|
UNSUPPORTED_DESTRUCTURE_REST: "BF025",
|
|
2414
2480
|
RETURN_VALUE_NOT_JSX: "BF027",
|
|
2415
|
-
PROPS_DESTRUCTURING: "BF043",
|
|
2416
2481
|
SIGNAL_GETTER_NOT_CALLED: "BF044",
|
|
2417
2482
|
JSX_IN_LOCAL_FUNCTION: "BF045",
|
|
2418
2483
|
COMPONENT_REQUIRED_PROP_MISSING: "BF046",
|
|
@@ -2445,7 +2510,6 @@ var errorMessages = {
|
|
|
2445
2510
|
[ErrorCodes.MISSING_KEY_IN_NESTED_LIST]: "Nested .map() loop requires key attribute for event delegation. Add a key prop to elements in the inner loop",
|
|
2446
2511
|
[ErrorCodes.UNSUPPORTED_DESTRUCTURE_REST]: "Computed property key in .map() callback destructure is not supported. Rewrite the callback to destructure explicit bindings (e.g., `({ a, b }) => ...`) so the compiler can rewrite references to per-item signal accessors.",
|
|
2447
2512
|
[ErrorCodes.RETURN_VALUE_NOT_JSX]: "Component's return value is not recognized as JSX — return the JSX expression directly instead of binding it to a local variable first.",
|
|
2448
|
-
[ErrorCodes.PROPS_DESTRUCTURING]: "Props destructuring in function parameters breaks reactivity. Use props object directly.",
|
|
2449
2513
|
[ErrorCodes.SIGNAL_GETTER_NOT_CALLED]: "Signal/memo getter passed without calling it. Use getter() to read the value.",
|
|
2450
2514
|
[ErrorCodes.JSX_IN_LOCAL_FUNCTION]: "Local function returns JSX but cannot be inlined. Extract it as a top-level PascalCase component or use a single return statement.",
|
|
2451
2515
|
[ErrorCodes.COMPONENT_REQUIRED_PROP_MISSING]: "Built-in component is missing a required prop.",
|
|
@@ -2599,6 +2663,21 @@ var datePlugin = {
|
|
|
2599
2663
|
};
|
|
2600
2664
|
|
|
2601
2665
|
// ../jsx/src/analyzer.ts
|
|
2666
|
+
var MUTATING_METHOD_NAMES = new Set([
|
|
2667
|
+
"push",
|
|
2668
|
+
"pop",
|
|
2669
|
+
"shift",
|
|
2670
|
+
"unshift",
|
|
2671
|
+
"splice",
|
|
2672
|
+
"sort",
|
|
2673
|
+
"reverse",
|
|
2674
|
+
"fill",
|
|
2675
|
+
"copyWithin",
|
|
2676
|
+
"set",
|
|
2677
|
+
"add",
|
|
2678
|
+
"delete",
|
|
2679
|
+
"clear"
|
|
2680
|
+
]);
|
|
2602
2681
|
var CLIENT_EXPORTS = new Set([
|
|
2603
2682
|
"createSignal",
|
|
2604
2683
|
"createEffect",
|
|
@@ -2632,46 +2711,46 @@ function extractFreeIdentifiersFromNode(node) {
|
|
|
2632
2711
|
const ids = new Set;
|
|
2633
2712
|
const boundNames = new Set;
|
|
2634
2713
|
function addBindingNames(name, out) {
|
|
2635
|
-
if (
|
|
2714
|
+
if (ts14.isIdentifier(name))
|
|
2636
2715
|
out.push(name.text);
|
|
2637
|
-
else if (
|
|
2716
|
+
else if (ts14.isObjectBindingPattern(name))
|
|
2638
2717
|
name.elements.forEach((e) => addBindingNames(e.name, out));
|
|
2639
|
-
else if (
|
|
2718
|
+
else if (ts14.isArrayBindingPattern(name))
|
|
2640
2719
|
name.elements.forEach((e) => {
|
|
2641
|
-
if (!
|
|
2720
|
+
if (!ts14.isOmittedExpression(e))
|
|
2642
2721
|
addBindingNames(e.name, out);
|
|
2643
2722
|
});
|
|
2644
2723
|
}
|
|
2645
2724
|
function visit(n) {
|
|
2646
|
-
if (
|
|
2725
|
+
if (ts14.isTypeNode(n))
|
|
2647
2726
|
return;
|
|
2648
|
-
if (
|
|
2727
|
+
if (ts14.isIdentifier(n)) {
|
|
2649
2728
|
const parent = n.parent;
|
|
2650
|
-
if (parent &&
|
|
2729
|
+
if (parent && ts14.isPropertyAccessExpression(parent) && parent.name === n)
|
|
2651
2730
|
return;
|
|
2652
|
-
if (parent &&
|
|
2731
|
+
if (parent && ts14.isPropertyAssignment(parent) && parent.name === n)
|
|
2653
2732
|
return;
|
|
2654
|
-
if (parent &&
|
|
2733
|
+
if (parent && ts14.isParameter(parent) && parent.name === n)
|
|
2655
2734
|
return;
|
|
2656
|
-
if (parent &&
|
|
2735
|
+
if (parent && ts14.isVariableDeclaration(parent) && parent.name === n)
|
|
2657
2736
|
return;
|
|
2658
2737
|
if (boundNames.has(n.text))
|
|
2659
2738
|
return;
|
|
2660
2739
|
ids.add(n.text);
|
|
2661
2740
|
return;
|
|
2662
2741
|
}
|
|
2663
|
-
if (
|
|
2742
|
+
if (ts14.isArrowFunction(n)) {
|
|
2664
2743
|
const params = [];
|
|
2665
2744
|
for (const p of n.parameters)
|
|
2666
2745
|
addBindingNames(p.name, params);
|
|
2667
2746
|
for (const name of params)
|
|
2668
2747
|
boundNames.add(name);
|
|
2669
|
-
|
|
2748
|
+
ts14.forEachChild(n, visit);
|
|
2670
2749
|
for (const name of params)
|
|
2671
2750
|
boundNames.delete(name);
|
|
2672
2751
|
return;
|
|
2673
2752
|
}
|
|
2674
|
-
|
|
2753
|
+
ts14.forEachChild(n, visit);
|
|
2675
2754
|
}
|
|
2676
2755
|
visit(node);
|
|
2677
2756
|
return ids;
|
|
@@ -2695,7 +2774,7 @@ var REACTIVE_PRIMITIVES = new Set([
|
|
|
2695
2774
|
]);
|
|
2696
2775
|
|
|
2697
2776
|
// ../jsx/src/jsx-to-ir.ts
|
|
2698
|
-
import
|
|
2777
|
+
import ts17 from "typescript";
|
|
2699
2778
|
|
|
2700
2779
|
// ../jsx/src/types.ts
|
|
2701
2780
|
var SCOPE_FORBIDDEN = {
|
|
@@ -2745,7 +2824,7 @@ function preambleAnalysisTemplateText(p) {
|
|
|
2745
2824
|
}
|
|
2746
2825
|
|
|
2747
2826
|
// ../jsx/src/module-exports.ts
|
|
2748
|
-
import
|
|
2827
|
+
import ts15 from "typescript";
|
|
2749
2828
|
function formatParamWithType(p) {
|
|
2750
2829
|
const rest = p.isRest ? "..." : "";
|
|
2751
2830
|
const optional = p.optional ? "?" : "";
|
|
@@ -2780,21 +2859,21 @@ function findAssignedNames(bodyText, candidates) {
|
|
|
2780
2859
|
const assigned = new Set;
|
|
2781
2860
|
if (candidates.size === 0)
|
|
2782
2861
|
return assigned;
|
|
2783
|
-
const sf =
|
|
2862
|
+
const sf = ts15.createSourceFile("bf-assignment-scan.tsx", bodyText, ts15.ScriptTarget.Latest, false, ts15.ScriptKind.TSX);
|
|
2784
2863
|
const record = (target) => {
|
|
2785
|
-
if (
|
|
2864
|
+
if (ts15.isIdentifier(target) && candidates.has(target.text)) {
|
|
2786
2865
|
assigned.add(target.text);
|
|
2787
2866
|
}
|
|
2788
2867
|
};
|
|
2789
2868
|
const visit = (node) => {
|
|
2790
|
-
if (
|
|
2869
|
+
if (ts15.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
|
|
2791
2870
|
record(node.left);
|
|
2792
|
-
} else if ((
|
|
2871
|
+
} else if ((ts15.isPrefixUnaryExpression(node) || ts15.isPostfixUnaryExpression(node)) && (node.operator === ts15.SyntaxKind.PlusPlusToken || node.operator === ts15.SyntaxKind.MinusMinusToken)) {
|
|
2793
2872
|
record(node.operand);
|
|
2794
2873
|
}
|
|
2795
|
-
|
|
2874
|
+
ts15.forEachChild(node, visit);
|
|
2796
2875
|
};
|
|
2797
|
-
|
|
2876
|
+
ts15.forEachChild(sf, visit);
|
|
2798
2877
|
return assigned;
|
|
2799
2878
|
}
|
|
2800
2879
|
function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
|
|
@@ -2817,11 +2896,11 @@ function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNam
|
|
|
2817
2896
|
return reachable;
|
|
2818
2897
|
}
|
|
2819
2898
|
function isAssignmentOperator(kind) {
|
|
2820
|
-
return kind >=
|
|
2899
|
+
return kind >= ts15.SyntaxKind.FirstAssignment && kind <= ts15.SyntaxKind.LastAssignment;
|
|
2821
2900
|
}
|
|
2822
2901
|
|
|
2823
2902
|
// ../jsx/src/free-refs.ts
|
|
2824
|
-
import
|
|
2903
|
+
import ts16 from "typescript";
|
|
2825
2904
|
var _bindingMapCache = new WeakMap;
|
|
2826
2905
|
|
|
2827
2906
|
// ../jsx/src/to-locale-date-lowering.ts
|
|
@@ -3224,61 +3303,11 @@ var MATHML_ROOT_TAGS = new Set([
|
|
|
3224
3303
|
// ../jsx/src/ir-to-client-js/collect-elements.ts
|
|
3225
3304
|
var EMPTY_RENDER_EXPRS = new Set(["null", "undefined", "false", "''", '""', "``"]);
|
|
3226
3305
|
|
|
3227
|
-
// ../jsx/src/ir-to-client-js/identifiers.ts
|
|
3228
|
-
var KEYWORDS_AND_GLOBALS = new Set([
|
|
3229
|
-
"true",
|
|
3230
|
-
"false",
|
|
3231
|
-
"null",
|
|
3232
|
-
"undefined",
|
|
3233
|
-
"this",
|
|
3234
|
-
"const",
|
|
3235
|
-
"let",
|
|
3236
|
-
"var",
|
|
3237
|
-
"function",
|
|
3238
|
-
"return",
|
|
3239
|
-
"if",
|
|
3240
|
-
"else",
|
|
3241
|
-
"for",
|
|
3242
|
-
"while",
|
|
3243
|
-
"do",
|
|
3244
|
-
"switch",
|
|
3245
|
-
"case",
|
|
3246
|
-
"break",
|
|
3247
|
-
"continue",
|
|
3248
|
-
"new",
|
|
3249
|
-
"typeof",
|
|
3250
|
-
"instanceof",
|
|
3251
|
-
"void",
|
|
3252
|
-
"delete",
|
|
3253
|
-
"console",
|
|
3254
|
-
"window",
|
|
3255
|
-
"document",
|
|
3256
|
-
"Math",
|
|
3257
|
-
"String",
|
|
3258
|
-
"Number",
|
|
3259
|
-
"Array",
|
|
3260
|
-
"Object",
|
|
3261
|
-
"Boolean",
|
|
3262
|
-
"Date",
|
|
3263
|
-
"JSON",
|
|
3264
|
-
"Promise",
|
|
3265
|
-
"setTimeout",
|
|
3266
|
-
"setInterval",
|
|
3267
|
-
"clearTimeout",
|
|
3268
|
-
"clearInterval"
|
|
3269
|
-
]);
|
|
3270
|
-
|
|
3271
|
-
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
3272
|
-
import ts15 from "typescript";
|
|
3273
|
-
|
|
3274
3306
|
// ../jsx/src/ir-to-client-js/imports.ts
|
|
3275
|
-
import
|
|
3276
|
-
|
|
3277
|
-
// ../jsx/src/value-references.ts
|
|
3278
|
-
import ts16 from "typescript";
|
|
3307
|
+
import ts18 from "typescript";
|
|
3279
3308
|
|
|
3280
3309
|
// ../jsx/src/relocate.ts
|
|
3281
|
-
import
|
|
3310
|
+
import ts19 from "typescript";
|
|
3282
3311
|
var REGISTRY_SAFE_BINDING_KINDS = new Set([
|
|
3283
3312
|
"global",
|
|
3284
3313
|
"module-import",
|
|
@@ -3470,14 +3499,8 @@ function matchSearchParamsMethodCall(callee, args, localNames) {
|
|
|
3470
3499
|
return { method: callee.property, args };
|
|
3471
3500
|
}
|
|
3472
3501
|
|
|
3473
|
-
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
3474
|
-
import ts19 from "typescript";
|
|
3475
|
-
|
|
3476
|
-
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
3477
|
-
import ts20 from "typescript";
|
|
3478
|
-
|
|
3479
3502
|
// ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
|
|
3480
|
-
import
|
|
3503
|
+
import ts20 from "typescript";
|
|
3481
3504
|
var NO_PREAMBLE = {
|
|
3482
3505
|
lazySafe: true,
|
|
3483
3506
|
facts: { declaredNames: new Set, freeNames: new Set }
|
|
@@ -3526,17 +3549,11 @@ var INERT_BINDING_GLOBALS = new Set([
|
|
|
3526
3549
|
"decodeURI"
|
|
3527
3550
|
]);
|
|
3528
3551
|
|
|
3529
|
-
// ../jsx/src/ir-to-client-js/
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
"unload",
|
|
3535
|
-
"mouseenter",
|
|
3536
|
-
"mouseleave",
|
|
3537
|
-
"pointerenter",
|
|
3538
|
-
"pointerleave"
|
|
3539
|
-
]);
|
|
3552
|
+
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
3553
|
+
import ts21 from "typescript";
|
|
3554
|
+
|
|
3555
|
+
// ../jsx/src/ir-to-client-js/rewrite-destructured-props.ts
|
|
3556
|
+
import ts22 from "typescript";
|
|
3540
3557
|
|
|
3541
3558
|
// ../jsx/src/ir-to-client-js/source-map.ts
|
|
3542
3559
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -3627,15 +3644,15 @@ class SourceMapGenerator {
|
|
|
3627
3644
|
}
|
|
3628
3645
|
|
|
3629
3646
|
// ../jsx/src/preprocess-inline-jsx-callbacks.ts
|
|
3630
|
-
import
|
|
3647
|
+
import ts23 from "typescript";
|
|
3631
3648
|
|
|
3632
3649
|
// ../jsx/src/ssr-defaults.ts
|
|
3633
|
-
import
|
|
3650
|
+
import ts24 from "typescript";
|
|
3634
3651
|
var UNRESOLVED = Symbol("unresolved");
|
|
3635
3652
|
var NO_RETURN = Symbol("no-return");
|
|
3636
3653
|
|
|
3637
3654
|
// ../jsx/src/augment-inherited-props.ts
|
|
3638
|
-
import
|
|
3655
|
+
import ts25 from "typescript";
|
|
3639
3656
|
function collectContextConsumers(metadata) {
|
|
3640
3657
|
const constants = metadata.localConstants ?? [];
|
|
3641
3658
|
const contextDefaults = new Map;
|
|
@@ -3667,47 +3684,47 @@ function collectContextConsumers(metadata) {
|
|
|
3667
3684
|
}
|
|
3668
3685
|
function parseUseContextArg(source) {
|
|
3669
3686
|
const expr = parseSingleExpression(source);
|
|
3670
|
-
if (!expr || !
|
|
3687
|
+
if (!expr || !ts25.isCallExpression(expr))
|
|
3671
3688
|
return null;
|
|
3672
|
-
if (!
|
|
3689
|
+
if (!ts25.isIdentifier(expr.expression) || expr.expression.text !== "useContext")
|
|
3673
3690
|
return null;
|
|
3674
3691
|
if (expr.arguments.length !== 1)
|
|
3675
3692
|
return null;
|
|
3676
3693
|
const arg = expr.arguments[0];
|
|
3677
|
-
return
|
|
3694
|
+
return ts25.isIdentifier(arg) ? arg.text : null;
|
|
3678
3695
|
}
|
|
3679
3696
|
function parseCreateContextDefault(source) {
|
|
3680
3697
|
const expr = parseSingleExpression(source);
|
|
3681
|
-
if (!expr || !
|
|
3698
|
+
if (!expr || !ts25.isCallExpression(expr))
|
|
3682
3699
|
return null;
|
|
3683
3700
|
if (expr.arguments.length === 0)
|
|
3684
3701
|
return null;
|
|
3685
3702
|
const arg = expr.arguments[0];
|
|
3686
|
-
if (
|
|
3703
|
+
if (ts25.isStringLiteral(arg) || ts25.isNoSubstitutionTemplateLiteral(arg))
|
|
3687
3704
|
return arg.text;
|
|
3688
|
-
if (
|
|
3705
|
+
if (ts25.isNumericLiteral(arg))
|
|
3689
3706
|
return Number(arg.text);
|
|
3690
|
-
if (arg.kind ===
|
|
3707
|
+
if (arg.kind === ts25.SyntaxKind.TrueKeyword)
|
|
3691
3708
|
return true;
|
|
3692
|
-
if (arg.kind ===
|
|
3709
|
+
if (arg.kind === ts25.SyntaxKind.FalseKeyword)
|
|
3693
3710
|
return false;
|
|
3694
3711
|
return null;
|
|
3695
3712
|
}
|
|
3696
3713
|
function isObjectLiteralCreateContextDefault(source) {
|
|
3697
3714
|
const expr = parseSingleExpression(source);
|
|
3698
|
-
if (!expr || !
|
|
3715
|
+
if (!expr || !ts25.isCallExpression(expr))
|
|
3699
3716
|
return false;
|
|
3700
3717
|
if (expr.arguments.length === 0)
|
|
3701
3718
|
return false;
|
|
3702
|
-
return
|
|
3719
|
+
return ts25.isObjectLiteralExpression(expr.arguments[0]);
|
|
3703
3720
|
}
|
|
3704
3721
|
function parseSingleExpression(source) {
|
|
3705
|
-
const sf =
|
|
3722
|
+
const sf = ts25.createSourceFile("__ctx.ts", `(${source})`, ts25.ScriptTarget.Latest, false);
|
|
3706
3723
|
const stmt = sf.statements[0];
|
|
3707
|
-
if (!stmt || !
|
|
3724
|
+
if (!stmt || !ts25.isExpressionStatement(stmt))
|
|
3708
3725
|
return null;
|
|
3709
3726
|
let e = stmt.expression;
|
|
3710
|
-
while (
|
|
3727
|
+
while (ts25.isParenthesizedExpression(e))
|
|
3711
3728
|
e = e.expression;
|
|
3712
3729
|
return e;
|
|
3713
3730
|
}
|
|
@@ -3732,25 +3749,25 @@ function augmentInheritedPropAccesses(ir) {
|
|
|
3732
3749
|
const pinCoalesceLiterals = (s) => {
|
|
3733
3750
|
if (!s || !s.includes(propsObj))
|
|
3734
3751
|
return;
|
|
3735
|
-
const sf =
|
|
3752
|
+
const sf = ts25.createSourceFile("__aug.ts", `(${s})`, ts25.ScriptTarget.Latest, false);
|
|
3736
3753
|
const visit = (n) => {
|
|
3737
|
-
if (
|
|
3754
|
+
if (ts25.isBinaryExpression(n) && (n.operatorToken.kind === ts25.SyntaxKind.QuestionQuestionToken || n.operatorToken.kind === ts25.SyntaxKind.BarBarToken)) {
|
|
3738
3755
|
let left = n.left;
|
|
3739
|
-
while (
|
|
3756
|
+
while (ts25.isParenthesizedExpression(left))
|
|
3740
3757
|
left = left.expression;
|
|
3741
|
-
if (
|
|
3758
|
+
if (ts25.isPropertyAccessExpression(left) && ts25.isIdentifier(left.expression) && left.expression.text === propsObj) {
|
|
3742
3759
|
const name = left.name.text;
|
|
3743
3760
|
let right = n.right;
|
|
3744
|
-
while (
|
|
3761
|
+
while (ts25.isParenthesizedExpression(right))
|
|
3745
3762
|
right = right.expression;
|
|
3746
|
-
if (
|
|
3763
|
+
if (ts25.isPrefixUnaryExpression(right))
|
|
3747
3764
|
right = right.operand;
|
|
3748
|
-
const kind =
|
|
3765
|
+
const kind = ts25.isNumericLiteral(right) ? "number" : right.kind === ts25.SyntaxKind.TrueKeyword || right.kind === ts25.SyntaxKind.FalseKeyword ? "boolean" : ts25.isStringLiteralLike(right) ? "string" : null;
|
|
3749
3766
|
if (kind && !coalesceLiteralTypes.has(name))
|
|
3750
3767
|
coalesceLiteralTypes.set(name, kind);
|
|
3751
3768
|
}
|
|
3752
3769
|
}
|
|
3753
|
-
|
|
3770
|
+
ts25.forEachChild(n, visit);
|
|
3754
3771
|
};
|
|
3755
3772
|
visit(sf);
|
|
3756
3773
|
};
|
|
@@ -3861,33 +3878,33 @@ function augmentInheritedPropAccesses(ir) {
|
|
|
3861
3878
|
}
|
|
3862
3879
|
}
|
|
3863
3880
|
function parseStaticStringConst(source) {
|
|
3864
|
-
const sf =
|
|
3881
|
+
const sf = ts25.createSourceFile("__const.ts", `const __x = (${source});`, ts25.ScriptTarget.Latest, false);
|
|
3865
3882
|
const stmt = sf.statements[0];
|
|
3866
|
-
if (!stmt || !
|
|
3883
|
+
if (!stmt || !ts25.isVariableStatement(stmt))
|
|
3867
3884
|
return null;
|
|
3868
3885
|
let init = stmt.declarationList.declarations[0]?.initializer;
|
|
3869
|
-
while (init &&
|
|
3886
|
+
while (init && ts25.isParenthesizedExpression(init))
|
|
3870
3887
|
init = init.expression;
|
|
3871
3888
|
if (!init)
|
|
3872
3889
|
return null;
|
|
3873
|
-
if (
|
|
3890
|
+
if (ts25.isStringLiteral(init) || ts25.isNoSubstitutionTemplateLiteral(init)) {
|
|
3874
3891
|
return init.text;
|
|
3875
3892
|
}
|
|
3876
3893
|
return evalStringArrayJoin(source);
|
|
3877
3894
|
}
|
|
3878
3895
|
function evalTemplateOfStringConsts(source, resolved) {
|
|
3879
|
-
const sf =
|
|
3896
|
+
const sf = ts25.createSourceFile("__const.ts", `const __x = (${source});`, ts25.ScriptTarget.Latest, false);
|
|
3880
3897
|
const stmt = sf.statements[0];
|
|
3881
|
-
if (!stmt || !
|
|
3898
|
+
if (!stmt || !ts25.isVariableStatement(stmt))
|
|
3882
3899
|
return null;
|
|
3883
3900
|
let init = stmt.declarationList.declarations[0]?.initializer;
|
|
3884
|
-
while (init &&
|
|
3901
|
+
while (init && ts25.isParenthesizedExpression(init))
|
|
3885
3902
|
init = init.expression;
|
|
3886
|
-
if (!init || !
|
|
3903
|
+
if (!init || !ts25.isTemplateExpression(init))
|
|
3887
3904
|
return null;
|
|
3888
3905
|
let out = init.head.text;
|
|
3889
3906
|
for (const span of init.templateSpans) {
|
|
3890
|
-
if (!
|
|
3907
|
+
if (!ts25.isIdentifier(span.expression))
|
|
3891
3908
|
return null;
|
|
3892
3909
|
const value = resolved.get(span.expression.text);
|
|
3893
3910
|
if (value === undefined)
|
|
@@ -3920,30 +3937,30 @@ function lookupStaticRecordLiteral(objectName, key, constants, isShadowed) {
|
|
|
3920
3937
|
const constInfo = (constants ?? []).find((c) => c.name === objectName && c.isModule);
|
|
3921
3938
|
if (constInfo?.value === undefined)
|
|
3922
3939
|
return null;
|
|
3923
|
-
const sf =
|
|
3940
|
+
const sf = ts25.createSourceFile("__rec.ts", `(${constInfo.value})`, ts25.ScriptTarget.Latest, true);
|
|
3924
3941
|
if (sf.statements.length !== 1)
|
|
3925
3942
|
return null;
|
|
3926
3943
|
const stmt = sf.statements[0];
|
|
3927
|
-
if (!
|
|
3944
|
+
if (!ts25.isExpressionStatement(stmt))
|
|
3928
3945
|
return null;
|
|
3929
3946
|
let parsed = stmt.expression;
|
|
3930
|
-
while (
|
|
3947
|
+
while (ts25.isParenthesizedExpression(parsed))
|
|
3931
3948
|
parsed = parsed.expression;
|
|
3932
|
-
if (!
|
|
3949
|
+
if (!ts25.isObjectLiteralExpression(parsed))
|
|
3933
3950
|
return null;
|
|
3934
3951
|
for (const prop of parsed.properties) {
|
|
3935
|
-
if (!
|
|
3952
|
+
if (!ts25.isPropertyAssignment(prop))
|
|
3936
3953
|
continue;
|
|
3937
3954
|
const name = prop.name;
|
|
3938
|
-
const propKey =
|
|
3955
|
+
const propKey = ts25.isIdentifier(name) || ts25.isStringLiteral(name) || ts25.isNoSubstitutionTemplateLiteral(name) ? name.text : null;
|
|
3939
3956
|
if (propKey !== key)
|
|
3940
3957
|
continue;
|
|
3941
3958
|
let v = prop.initializer;
|
|
3942
|
-
while (
|
|
3959
|
+
while (ts25.isParenthesizedExpression(v))
|
|
3943
3960
|
v = v.expression;
|
|
3944
|
-
if (
|
|
3961
|
+
if (ts25.isNumericLiteral(v))
|
|
3945
3962
|
return { kind: "number", text: v.text };
|
|
3946
|
-
if (
|
|
3963
|
+
if (ts25.isStringLiteral(v) || ts25.isNoSubstitutionTemplateLiteral(v)) {
|
|
3947
3964
|
return { kind: "string", text: v.text };
|
|
3948
3965
|
}
|
|
3949
3966
|
return null;
|
|
@@ -3951,28 +3968,28 @@ function lookupStaticRecordLiteral(objectName, key, constants, isShadowed) {
|
|
|
3951
3968
|
return null;
|
|
3952
3969
|
}
|
|
3953
3970
|
function evalStringArrayJoin(source) {
|
|
3954
|
-
const sf =
|
|
3971
|
+
const sf = ts25.createSourceFile("__join.ts", `const __x = (${source});`, ts25.ScriptTarget.Latest, false);
|
|
3955
3972
|
const stmt = sf.statements[0];
|
|
3956
|
-
if (!stmt || !
|
|
3973
|
+
if (!stmt || !ts25.isVariableStatement(stmt))
|
|
3957
3974
|
return null;
|
|
3958
3975
|
let node = stmt.declarationList.declarations[0]?.initializer;
|
|
3959
|
-
while (node &&
|
|
3976
|
+
while (node && ts25.isParenthesizedExpression(node))
|
|
3960
3977
|
node = node.expression;
|
|
3961
|
-
if (!node || !
|
|
3978
|
+
if (!node || !ts25.isCallExpression(node))
|
|
3962
3979
|
return null;
|
|
3963
3980
|
const callee = node.expression;
|
|
3964
|
-
if (!
|
|
3981
|
+
if (!ts25.isPropertyAccessExpression(callee))
|
|
3965
3982
|
return null;
|
|
3966
3983
|
if (callee.name.text !== "join")
|
|
3967
3984
|
return null;
|
|
3968
3985
|
let recv = callee.expression;
|
|
3969
|
-
while (
|
|
3986
|
+
while (ts25.isParenthesizedExpression(recv))
|
|
3970
3987
|
recv = recv.expression;
|
|
3971
|
-
if (!
|
|
3988
|
+
if (!ts25.isArrayLiteralExpression(recv))
|
|
3972
3989
|
return null;
|
|
3973
3990
|
const parts = [];
|
|
3974
3991
|
for (const el of recv.elements) {
|
|
3975
|
-
if (
|
|
3992
|
+
if (ts25.isStringLiteral(el) || ts25.isNoSubstitutionTemplateLiteral(el)) {
|
|
3976
3993
|
parts.push(el.text);
|
|
3977
3994
|
} else {
|
|
3978
3995
|
return null;
|
|
@@ -3981,7 +3998,7 @@ function evalStringArrayJoin(source) {
|
|
|
3981
3998
|
let sep = ",";
|
|
3982
3999
|
if (node.arguments.length >= 1) {
|
|
3983
4000
|
const arg = node.arguments[0];
|
|
3984
|
-
if (
|
|
4001
|
+
if (ts25.isStringLiteral(arg) || ts25.isNoSubstitutionTemplateLiteral(arg))
|
|
3985
4002
|
sep = arg.text;
|
|
3986
4003
|
else
|
|
3987
4004
|
return null;
|
|
@@ -3989,11 +4006,11 @@ function evalStringArrayJoin(source) {
|
|
|
3989
4006
|
return parts.join(sep);
|
|
3990
4007
|
}
|
|
3991
4008
|
function parseRecordIndexAccess(val, localConstants, propsParams, resolveKey) {
|
|
3992
|
-
if (!
|
|
4009
|
+
if (!ts25.isElementAccessExpression(val))
|
|
3993
4010
|
return null;
|
|
3994
4011
|
const obj = val.expression;
|
|
3995
4012
|
const arg = val.argumentExpression;
|
|
3996
|
-
if (!
|
|
4013
|
+
if (!ts25.isIdentifier(obj) || !ts25.isIdentifier(arg))
|
|
3997
4014
|
return null;
|
|
3998
4015
|
let indexPropName;
|
|
3999
4016
|
let defaultKey;
|
|
@@ -4009,35 +4026,35 @@ function parseRecordIndexAccess(val, localConstants, propsParams, resolveKey) {
|
|
|
4009
4026
|
const constInfo = localConstants.find((c) => c.name === obj.text && c.isModule);
|
|
4010
4027
|
if (constInfo?.value === undefined)
|
|
4011
4028
|
return null;
|
|
4012
|
-
const sf =
|
|
4029
|
+
const sf = ts25.createSourceFile("__rec.ts", `(${constInfo.value})`, ts25.ScriptTarget.Latest, true);
|
|
4013
4030
|
if (sf.statements.length !== 1)
|
|
4014
4031
|
return null;
|
|
4015
4032
|
const stmt = sf.statements[0];
|
|
4016
|
-
if (!
|
|
4033
|
+
if (!ts25.isExpressionStatement(stmt))
|
|
4017
4034
|
return null;
|
|
4018
4035
|
let parsed = stmt.expression;
|
|
4019
|
-
while (
|
|
4036
|
+
while (ts25.isParenthesizedExpression(parsed))
|
|
4020
4037
|
parsed = parsed.expression;
|
|
4021
|
-
if (!
|
|
4038
|
+
if (!ts25.isObjectLiteralExpression(parsed))
|
|
4022
4039
|
return null;
|
|
4023
4040
|
const entries = [];
|
|
4024
4041
|
for (const prop of parsed.properties) {
|
|
4025
|
-
if (!
|
|
4042
|
+
if (!ts25.isPropertyAssignment(prop))
|
|
4026
4043
|
return null;
|
|
4027
4044
|
let key;
|
|
4028
|
-
if (
|
|
4045
|
+
if (ts25.isIdentifier(prop.name)) {
|
|
4029
4046
|
key = prop.name.text;
|
|
4030
|
-
} else if (
|
|
4047
|
+
} else if (ts25.isStringLiteral(prop.name) || ts25.isNoSubstitutionTemplateLiteral(prop.name)) {
|
|
4031
4048
|
key = prop.name.text;
|
|
4032
4049
|
} else {
|
|
4033
4050
|
return null;
|
|
4034
4051
|
}
|
|
4035
4052
|
let v = prop.initializer;
|
|
4036
|
-
while (
|
|
4053
|
+
while (ts25.isParenthesizedExpression(v))
|
|
4037
4054
|
v = v.expression;
|
|
4038
|
-
if (
|
|
4055
|
+
if (ts25.isNumericLiteral(v)) {
|
|
4039
4056
|
entries.push({ key, value: { kind: "number", text: v.text } });
|
|
4040
|
-
} else if (
|
|
4057
|
+
} else if (ts25.isStringLiteral(v) || ts25.isNoSubstitutionTemplateLiteral(v)) {
|
|
4041
4058
|
entries.push({ key, value: { kind: "string", text: v.text } });
|
|
4042
4059
|
} else {
|
|
4043
4060
|
return null;
|
|
@@ -4126,7 +4143,7 @@ function computeSsrSeedPlan(metadata) {
|
|
|
4126
4143
|
// ../jsx/src/rich-type-refusal.ts
|
|
4127
4144
|
var EMPTY_BINDINGS2 = new Map;
|
|
4128
4145
|
// ../jsx/src/shared-program.ts
|
|
4129
|
-
import
|
|
4146
|
+
import ts27 from "typescript";
|
|
4130
4147
|
// ../jsx/src/adapters/interface.ts
|
|
4131
4148
|
class BaseAdapter {
|
|
4132
4149
|
renderChildren(children) {
|
|
@@ -4408,7 +4425,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
4408
4425
|
}
|
|
4409
4426
|
|
|
4410
4427
|
// ../jsx/src/adapters/template-imports.ts
|
|
4411
|
-
import
|
|
4428
|
+
import ts28 from "typescript";
|
|
4412
4429
|
var CLIENT_PACKAGE_SOURCES = new Set([
|
|
4413
4430
|
"@barefootjs/client",
|
|
4414
4431
|
"@barefootjs/client/runtime"
|
|
@@ -4865,7 +4882,7 @@ function resolveStaticLoopSource(arrayParsed, localConstants, opts) {
|
|
|
4865
4882
|
if (opts?.isNameShadowed?.(arrayParsed.name))
|
|
4866
4883
|
return null;
|
|
4867
4884
|
const local = localConstants?.find((c) => c.name === arrayParsed.name);
|
|
4868
|
-
if (!local || local.
|
|
4885
|
+
if (!local?.parsed || local.mutatedAfterDeclaration)
|
|
4869
4886
|
return null;
|
|
4870
4887
|
target = local.parsed;
|
|
4871
4888
|
}
|
|
@@ -5112,7 +5129,7 @@ function dangerousInnerHtmlDiagnostic(expr, loc, reason) {
|
|
|
5112
5129
|
};
|
|
5113
5130
|
}
|
|
5114
5131
|
// ../jsx/src/combine-client-js.ts
|
|
5115
|
-
import
|
|
5132
|
+
import ts29 from "typescript";
|
|
5116
5133
|
// ../jsx/src/loop-destructure.ts
|
|
5117
5134
|
function isLowerableLoopDestructure(loop) {
|
|
5118
5135
|
const bindings = loop.paramBindings;
|
|
@@ -5252,9 +5269,9 @@ function escapeRe(s) {
|
|
|
5252
5269
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5253
5270
|
}
|
|
5254
5271
|
// ../jsx/src/debug.ts
|
|
5255
|
-
import ts29 from "typescript";
|
|
5256
|
-
// ../jsx/src/profiler.ts
|
|
5257
5272
|
import ts30 from "typescript";
|
|
5273
|
+
// ../jsx/src/profiler.ts
|
|
5274
|
+
import ts31 from "typescript";
|
|
5258
5275
|
|
|
5259
5276
|
// ../jsx/src/index.ts
|
|
5260
5277
|
registerBuiltinLoweringPlugins();
|
|
@@ -6048,7 +6065,7 @@ function collectImportedLoopChildComponentErrors(ir, componentName) {
|
|
|
6048
6065
|
}
|
|
6049
6066
|
|
|
6050
6067
|
// src/adapter/spread/spread-codegen.ts
|
|
6051
|
-
import
|
|
6068
|
+
import ts32 from "typescript";
|
|
6052
6069
|
function conditionalSpreadToJinja(ctx, expr) {
|
|
6053
6070
|
if (!expr || expr.kind !== "conditional")
|
|
6054
6071
|
return null;
|
|
@@ -6105,7 +6122,7 @@ function recordIndexAccessToJinja(ctx, val) {
|
|
|
6105
6122
|
if (val.kind !== "index-access" || val.object.kind !== "identifier" || val.index.kind !== "identifier") {
|
|
6106
6123
|
return null;
|
|
6107
6124
|
}
|
|
6108
|
-
const tsVal =
|
|
6125
|
+
const tsVal = ts32.factory.createElementAccessExpression(ts32.factory.createIdentifier(val.object.name), ts32.factory.createIdentifier(val.index.name));
|
|
6109
6126
|
const parsed = parseRecordIndexAccess(tsVal, ctx.localConstants ?? [], ctx.propsParams);
|
|
6110
6127
|
if (!parsed)
|
|
6111
6128
|
return null;
|
|
@@ -6564,11 +6581,11 @@ ${whenTrue}
|
|
|
6564
6581
|
const arrayName = loop.array.trim();
|
|
6565
6582
|
if (staticArray === null && /^[A-Za-z_$][\w$]*$/.test(arrayName)) {
|
|
6566
6583
|
const arrayConst = (this.localConstants ?? []).find((c) => c.name === arrayName);
|
|
6567
|
-
if (arrayConst &&
|
|
6584
|
+
if (arrayConst && this._resolveLiteralConst(arrayName) === null) {
|
|
6568
6585
|
this.errors.push({
|
|
6569
6586
|
code: "BF101",
|
|
6570
6587
|
severity: "error",
|
|
6571
|
-
message: `Loop array \`${arrayName}\` is a
|
|
6588
|
+
message: `Loop array \`${arrayName}\` is a const (module- or function-scope) computed value (\`${arrayConst.value}\`) that the MiniJinja adapter cannot bind as a template variable — only numeric/string-literal locals inline at their use site.`,
|
|
6572
6589
|
loc: loop.loc ?? { file: this.componentName + ".tsx", start: { line: 1, column: 0 }, end: { line: 1, column: 0 } },
|
|
6573
6590
|
suggestion: {
|
|
6574
6591
|
message: "Pre-compute the array server-side and pass it as a prop, or mark the loop position as @client-only so it runs in JS on the client.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/rust",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.6",
|
|
4
4
|
"description": "minijinja (Rust) adapter for BarefootJS — compiles IR to .j2 templates and ships a Rust rendering runtime (packages/adapter-rust/runtime/); runs under any Rust web framework (axum, etc.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"directory": "packages/adapter-rust"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@barefootjs/shared": "0.35.
|
|
57
|
+
"@barefootjs/shared": "0.35.6"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@barefootjs/jsx": ">=0.2.0",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
74
|
-
"@barefootjs/jsx": "0.35.
|
|
75
|
-
"@barefootjs/vite": "0.35.
|
|
76
|
-
"@barefootjs/client": "0.35.
|
|
74
|
+
"@barefootjs/jsx": "0.35.6",
|
|
75
|
+
"@barefootjs/vite": "0.35.6",
|
|
76
|
+
"@barefootjs/client": "0.35.6",
|
|
77
77
|
"typescript": "^5.0.0",
|
|
78
78
|
"vite": "^6.0.0"
|
|
79
79
|
}
|
|
@@ -848,17 +848,11 @@ export class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitter<Jinja
|
|
|
848
848
|
})
|
|
849
849
|
}
|
|
850
850
|
|
|
851
|
-
// A `.map()` loop whose array is a bare identifier bound to a
|
|
852
|
-
//
|
|
853
|
-
// that reads props/signals (e.g.
|
|
854
|
-
// Object.entries(props.x ?? {}).filter(...)`) can't
|
|
855
|
-
//
|
|
856
|
-
// top of the file) are a DIFFERENT, already-working case — the shared
|
|
857
|
-
// `ssr-defaults.ts` statically evaluates those and seeds them straight
|
|
858
|
-
// into the render context, so a bare `payments` reference resolves for
|
|
859
|
-
// free (data-table demo). Function-scope locals get no such seeding
|
|
860
|
-
// (`ssr-defaults.ts`: "component-scope locals can depend on
|
|
861
|
-
// signals/props and are evaluated lazily elsewhere") — and this
|
|
851
|
+
// A `.map()` loop whose array is a bare identifier bound to a local
|
|
852
|
+
// const (module- or function-scope, #2946) with a non-statically-
|
|
853
|
+
// evaluable initializer that reads props/signals/a function call (e.g.
|
|
854
|
+
// `const entries = Object.entries(props.x ?? {}).filter(...)`) can't
|
|
855
|
+
// render correctly. Locals get no per-render stash slot — this
|
|
862
856
|
// adapter's only "elsewhere" is inlining a const's value at its use
|
|
863
857
|
// site (`_resolveLiteralConst`'s numeric/single-quoted-string fast
|
|
864
858
|
// path, or a static-record-literal lookup), never binding one as a
|
|
@@ -871,22 +865,21 @@ export class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitter<Jinja
|
|
|
871
865
|
// corpus only because the widened destructure gate (#2087 Phase A/B)
|
|
872
866
|
// no longer refuses this fixture's `([emoji, users]) => ...` param
|
|
873
867
|
// first. Mirrors adapter-jinja's identical check.
|
|
874
|
-
// #2208: a loop source that is a fully-static array literal —
|
|
875
|
-
// inline (`[{ label: 'Alpha' }, ...].map(...)`) or a bare
|
|
876
|
-
// bound to a
|
|
877
|
-
// prop/signal/function-call dependency — inlines as
|
|
878
|
-
// list/dict literal below
|
|
879
|
-
//
|
|
880
|
-
//
|
|
881
|
-
//
|
|
882
|
-
//
|
|
883
|
-
//
|
|
884
|
-
//
|
|
885
|
-
//
|
|
886
|
-
//
|
|
887
|
-
//
|
|
888
|
-
//
|
|
889
|
-
// union.
|
|
868
|
+
// #2208/#2946: a loop source that is a fully-static array literal —
|
|
869
|
+
// either inline (`[{ label: 'Alpha' }, ...].map(...)`) or a bare
|
|
870
|
+
// identifier bound to a local const (module- or function-scope) whose
|
|
871
|
+
// initializer has no prop/signal/function-call dependency — inlines as
|
|
872
|
+
// a native MiniJinja list/dict literal below. A runtime-computed local
|
|
873
|
+
// (#2069, e.g. `Object.entries(props.tags).filter(...)`) still refuses
|
|
874
|
+
// below, whichever scope it's declared in. `isNameShadowed` guards a
|
|
875
|
+
// DIFFERENT, enclosing loop's own callback param shadowing this
|
|
876
|
+
// identifier (fable review) — never resolve the static const in that
|
|
877
|
+
// case. `rawArray` then falls through to the bare identifier expression
|
|
878
|
+
// below, same as before #2208 — which still trips the pre-existing
|
|
879
|
+
// BF101 gate for an unresolvable local const reference (a loud,
|
|
880
|
+
// conservative refusal, not a silent wrong value). Canonical,
|
|
881
|
+
// position-accurate predicate (#2482 Stage 2) — the enclosing loop
|
|
882
|
+
// scope's own membership, not a coarse whole-component union.
|
|
890
883
|
const staticItems = resolveStaticLoopSource(loop.arrayParsed, this.localConstants, {
|
|
891
884
|
isNameShadowed: this.scope.asShadowPredicate(),
|
|
892
885
|
})
|
|
@@ -895,11 +888,11 @@ export class MinijinjaAdapter extends BaseAdapter implements IRNodeEmitter<Jinja
|
|
|
895
888
|
const arrayName = loop.array.trim()
|
|
896
889
|
if (staticArray === null && /^[A-Za-z_$][\w$]*$/.test(arrayName)) {
|
|
897
890
|
const arrayConst = (this.localConstants ?? []).find(c => c.name === arrayName)
|
|
898
|
-
if (arrayConst &&
|
|
891
|
+
if (arrayConst && this._resolveLiteralConst(arrayName) === null) {
|
|
899
892
|
this.errors.push({
|
|
900
893
|
code: 'BF101',
|
|
901
894
|
severity: 'error',
|
|
902
|
-
message: `Loop array \`${arrayName}\` is a
|
|
895
|
+
message: `Loop array \`${arrayName}\` is a const (module- or function-scope) computed value (\`${arrayConst.value}\`) that the MiniJinja adapter cannot bind as a template variable — only numeric/string-literal locals inline at their use site.`,
|
|
903
896
|
loc: loop.loc ?? { file: this.componentName + '.tsx', start: { line: 1, column: 0 }, end: { line: 1, column: 0 } },
|
|
904
897
|
suggestion: {
|
|
905
898
|
message:
|
package/src/conformance-pins.ts
CHANGED
|
@@ -48,6 +48,17 @@ export const conformancePins: ConformancePins = {
|
|
|
48
48
|
issue: 'https://github.com/piconic-ai/barefootjs/issues/2321',
|
|
49
49
|
},
|
|
50
50
|
],
|
|
51
|
+
// #2946: the module-scope const is computed via a function call, not a
|
|
52
|
+
// static literal — genuinely unresolvable at SSR render time, same
|
|
53
|
+
// policy as an unresolvable FUNCTION-scope const above. Escape twin:
|
|
54
|
+
// `module-const-loop-source-computed-client`.
|
|
55
|
+
'module-const-loop-source-computed': [
|
|
56
|
+
{
|
|
57
|
+
code: 'BF101',
|
|
58
|
+
severity: 'error',
|
|
59
|
+
issue: 'https://github.com/piconic-ai/barefootjs/issues/2946',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
51
62
|
// #2038: no inline comprehension-with-nested-callback form via the
|
|
52
63
|
// evaluator-JSON `*_eval` mechanism (`minijinja-adapter.ts`'s header,
|
|
53
64
|
// divergence 3) — loud BF101 instead of lossy.
|
|
@@ -17,4 +17,10 @@ import type { RenderDivergences } from '@barefootjs/jsx'
|
|
|
17
17
|
// at value position and the runtime evaluator's `object-literal` case
|
|
18
18
|
// now merges it, so the seed classifies `derived` and SSRs identically
|
|
19
19
|
// to Hono.
|
|
20
|
+
// #2943 graduated: a BODY-destructured prop's default now reaches
|
|
21
|
+
// `ParamInfo.defaultValue` directly (the analyzer overlays it onto
|
|
22
|
+
// `propsParams` at the binding's own declaration), so `extractSsrDefaults`
|
|
23
|
+
// seeds the evaluated default and the adapter's presence guard no longer
|
|
24
|
+
// treats the prop as defaultless — `data-label` now renders `'none'` here
|
|
25
|
+
// exactly like Hono, both for a plain default and a renamed one.
|
|
20
26
|
export const renderDivergences: RenderDivergences = {}
|