@barefootjs/mojolicious 0.35.0 → 0.35.2
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/expr/emitters.d.ts.map +1 -1
- package/dist/adapter/index.js +11 -3
- package/dist/conformance-pins.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/render-divergences.d.ts.map +1 -1
- package/dist/vite.js +39 -31
- package/lib/BarefootJS/Backend/Mojo.pm +1 -1
- package/lib/Mojolicious/Plugin/BarefootJS/DevReload.pm +1 -1
- package/lib/Mojolicious/Plugin/BarefootJS.pm +1 -1
- package/package.json +5 -5
- package/src/adapter/expr/emitters.ts +20 -6
- package/src/conformance-pins.ts +13 -7
- package/src/render-divergences.ts +12 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitters.d.ts","sourceRoot":"","sources":["../../../src/adapter/expr/emitters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAGL,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,YAAY,EAMjB,KAAK,eAAe,EAIrB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"emitters.d.ts","sourceRoot":"","sources":["../../../src/adapter/expr/emitters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAGL,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,YAAY,EAMjB,KAAK,eAAe,EAIrB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAgEzD,qBAA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AE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,CAER;IAED,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CA6B9E;IAED,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CAOpF;IAED,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK1B;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOjD;IAED,aAAa,CAAC,UAAU,EAAE,qBAAqB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CAoBxG;CACF"}
|
package/dist/adapter/index.js
CHANGED
|
@@ -381,6 +381,11 @@ var PREDICATE_METHODS = new Set([
|
|
|
381
381
|
"every",
|
|
382
382
|
"some"
|
|
383
383
|
]);
|
|
384
|
+
function flattenPropsMember(object, property) {
|
|
385
|
+
if (object.kind === "identifier" && object.name === "props")
|
|
386
|
+
return `$${property}`;
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
384
389
|
|
|
385
390
|
class MojoFilterEmitter {
|
|
386
391
|
param;
|
|
@@ -411,6 +416,9 @@ class MojoFilterEmitter {
|
|
|
411
416
|
return String(value);
|
|
412
417
|
}
|
|
413
418
|
member(object, property, _computed, _optional, emit) {
|
|
419
|
+
const flat = flattenPropsMember(object, property);
|
|
420
|
+
if (flat !== null)
|
|
421
|
+
return flat;
|
|
414
422
|
if (property === "length" && (asCallbackMethodCall(object) !== null || object.kind === "array-literal")) {
|
|
415
423
|
return `scalar(@{${emit(object)}})`;
|
|
416
424
|
}
|
|
@@ -561,9 +569,9 @@ class MojoTopLevelEmitter {
|
|
|
561
569
|
return String(value);
|
|
562
570
|
}
|
|
563
571
|
member(object, property, _computed, _optional, emit) {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
572
|
+
const flat = flattenPropsMember(object, property);
|
|
573
|
+
if (flat !== null)
|
|
574
|
+
return flat;
|
|
567
575
|
if (object.kind === "identifier") {
|
|
568
576
|
const staticValue = this.ctx.resolveStaticRecordLiteral(object.name, property);
|
|
569
577
|
if (staticValue !== null)
|
|
@@ -1 +1 @@
|
|
|
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,eAgE7B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -381,6 +381,11 @@ var PREDICATE_METHODS = new Set([
|
|
|
381
381
|
"every",
|
|
382
382
|
"some"
|
|
383
383
|
]);
|
|
384
|
+
function flattenPropsMember(object, property) {
|
|
385
|
+
if (object.kind === "identifier" && object.name === "props")
|
|
386
|
+
return `$${property}`;
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
384
389
|
|
|
385
390
|
class MojoFilterEmitter {
|
|
386
391
|
param;
|
|
@@ -411,6 +416,9 @@ class MojoFilterEmitter {
|
|
|
411
416
|
return String(value);
|
|
412
417
|
}
|
|
413
418
|
member(object, property, _computed, _optional, emit) {
|
|
419
|
+
const flat = flattenPropsMember(object, property);
|
|
420
|
+
if (flat !== null)
|
|
421
|
+
return flat;
|
|
414
422
|
if (property === "length" && (asCallbackMethodCall(object) !== null || object.kind === "array-literal")) {
|
|
415
423
|
return `scalar(@{${emit(object)}})`;
|
|
416
424
|
}
|
|
@@ -561,9 +569,9 @@ class MojoTopLevelEmitter {
|
|
|
561
569
|
return String(value);
|
|
562
570
|
}
|
|
563
571
|
member(object, property, _computed, _optional, emit) {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
572
|
+
const flat = flattenPropsMember(object, property);
|
|
573
|
+
if (flat !== null)
|
|
574
|
+
return flat;
|
|
567
575
|
if (object.kind === "identifier") {
|
|
568
576
|
const staticValue = this.ctx.resolveStaticRecordLiteral(object.name, property);
|
|
569
577
|
if (staticValue !== null)
|
|
@@ -1909,12 +1917,14 @@ var conformancePins = {
|
|
|
1909
1917
|
"filter-nested-find-predicate": [{ code: "BF101", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2320" }],
|
|
1910
1918
|
"date-method-uncatalogued": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2356" }],
|
|
1911
1919
|
"rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }],
|
|
1912
|
-
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error"
|
|
1913
|
-
"jsx-element-prop-array": [{ code: "BF021", severity: "error"
|
|
1914
|
-
"namespace-import-primitive": [{ code: "BF013", severity: "error"
|
|
1920
|
+
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error" }],
|
|
1921
|
+
"jsx-element-prop-array": [{ code: "BF021", severity: "error" }],
|
|
1922
|
+
"namespace-import-primitive": [{ code: "BF013", severity: "error" }]
|
|
1915
1923
|
};
|
|
1916
1924
|
// src/render-divergences.ts
|
|
1917
|
-
var renderDivergences = {
|
|
1925
|
+
var renderDivergences = {
|
|
1926
|
+
"filter-predicate-renamed-prop": "https://github.com/piconic-ai/barefootjs/issues/2883"
|
|
1927
|
+
};
|
|
1918
1928
|
export {
|
|
1919
1929
|
renderDivergences,
|
|
1920
1930
|
mojoAdapter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAQxD,eAAO,MAAM,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"render-divergences.d.ts","sourceRoot":"","sources":["../src/render-divergences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAQxD,eAAO,MAAM,iBAAiB,EAAE,iBAW/B,CAAA"}
|
package/dist/vite.js
CHANGED
|
@@ -8,7 +8,7 @@ import { devModuleUrl, loadManifest, resolveDevOrigin, resolveScriptAssets, toPo
|
|
|
8
8
|
import ts25 from "typescript";
|
|
9
9
|
|
|
10
10
|
// ../jsx/src/analyzer.ts
|
|
11
|
-
import
|
|
11
|
+
import ts11 from "typescript";
|
|
12
12
|
|
|
13
13
|
// ../jsx/src/expression-parser.ts
|
|
14
14
|
import ts from "typescript";
|
|
@@ -2337,14 +2337,17 @@ function freshCounters() {
|
|
|
2337
2337
|
}
|
|
2338
2338
|
|
|
2339
2339
|
// ../jsx/src/analyzer-context.ts
|
|
2340
|
-
import
|
|
2340
|
+
import ts10 from "typescript";
|
|
2341
2341
|
|
|
2342
2342
|
// ../jsx/src/strip-types.ts
|
|
2343
2343
|
import ts8 from "typescript";
|
|
2344
2344
|
|
|
2345
|
+
// ../jsx/src/reactivity-checker.ts
|
|
2346
|
+
import ts9 from "typescript";
|
|
2347
|
+
|
|
2345
2348
|
// ../jsx/src/analyzer-context.ts
|
|
2346
|
-
var _typePrinter =
|
|
2347
|
-
var _blankTypeSourceFile =
|
|
2349
|
+
var _typePrinter = ts10.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
|
2350
|
+
var _blankTypeSourceFile = ts10.createSourceFile("__bf_types__.ts", "", ts10.ScriptTarget.Latest);
|
|
2348
2351
|
|
|
2349
2352
|
// ../jsx/src/errors.ts
|
|
2350
2353
|
var ErrorCodes = {
|
|
@@ -2577,46 +2580,46 @@ function extractFreeIdentifiersFromNode(node) {
|
|
|
2577
2580
|
const ids = new Set;
|
|
2578
2581
|
const boundNames = new Set;
|
|
2579
2582
|
function addBindingNames(name, out) {
|
|
2580
|
-
if (
|
|
2583
|
+
if (ts11.isIdentifier(name))
|
|
2581
2584
|
out.push(name.text);
|
|
2582
|
-
else if (
|
|
2585
|
+
else if (ts11.isObjectBindingPattern(name))
|
|
2583
2586
|
name.elements.forEach((e) => addBindingNames(e.name, out));
|
|
2584
|
-
else if (
|
|
2587
|
+
else if (ts11.isArrayBindingPattern(name))
|
|
2585
2588
|
name.elements.forEach((e) => {
|
|
2586
|
-
if (!
|
|
2589
|
+
if (!ts11.isOmittedExpression(e))
|
|
2587
2590
|
addBindingNames(e.name, out);
|
|
2588
2591
|
});
|
|
2589
2592
|
}
|
|
2590
2593
|
function visit(n) {
|
|
2591
|
-
if (
|
|
2594
|
+
if (ts11.isTypeNode(n))
|
|
2592
2595
|
return;
|
|
2593
|
-
if (
|
|
2596
|
+
if (ts11.isIdentifier(n)) {
|
|
2594
2597
|
const parent = n.parent;
|
|
2595
|
-
if (parent &&
|
|
2598
|
+
if (parent && ts11.isPropertyAccessExpression(parent) && parent.name === n)
|
|
2596
2599
|
return;
|
|
2597
|
-
if (parent &&
|
|
2600
|
+
if (parent && ts11.isPropertyAssignment(parent) && parent.name === n)
|
|
2598
2601
|
return;
|
|
2599
|
-
if (parent &&
|
|
2602
|
+
if (parent && ts11.isParameter(parent) && parent.name === n)
|
|
2600
2603
|
return;
|
|
2601
|
-
if (parent &&
|
|
2604
|
+
if (parent && ts11.isVariableDeclaration(parent) && parent.name === n)
|
|
2602
2605
|
return;
|
|
2603
2606
|
if (boundNames.has(n.text))
|
|
2604
2607
|
return;
|
|
2605
2608
|
ids.add(n.text);
|
|
2606
2609
|
return;
|
|
2607
2610
|
}
|
|
2608
|
-
if (
|
|
2611
|
+
if (ts11.isArrowFunction(n)) {
|
|
2609
2612
|
const params = [];
|
|
2610
2613
|
for (const p of n.parameters)
|
|
2611
2614
|
addBindingNames(p.name, params);
|
|
2612
2615
|
for (const name of params)
|
|
2613
2616
|
boundNames.add(name);
|
|
2614
|
-
|
|
2617
|
+
ts11.forEachChild(n, visit);
|
|
2615
2618
|
for (const name of params)
|
|
2616
2619
|
boundNames.delete(name);
|
|
2617
2620
|
return;
|
|
2618
2621
|
}
|
|
2619
|
-
|
|
2622
|
+
ts11.forEachChild(n, visit);
|
|
2620
2623
|
}
|
|
2621
2624
|
visit(node);
|
|
2622
2625
|
return ids;
|
|
@@ -2690,7 +2693,7 @@ function preambleAnalysisTemplateText(p) {
|
|
|
2690
2693
|
}
|
|
2691
2694
|
|
|
2692
2695
|
// ../jsx/src/module-exports.ts
|
|
2693
|
-
import
|
|
2696
|
+
import ts12 from "typescript";
|
|
2694
2697
|
function formatParamWithType(p) {
|
|
2695
2698
|
const rest = p.isRest ? "..." : "";
|
|
2696
2699
|
const optional = p.optional ? "?" : "";
|
|
@@ -2725,21 +2728,21 @@ function findAssignedNames(bodyText, candidates) {
|
|
|
2725
2728
|
const assigned = new Set;
|
|
2726
2729
|
if (candidates.size === 0)
|
|
2727
2730
|
return assigned;
|
|
2728
|
-
const sf =
|
|
2731
|
+
const sf = ts12.createSourceFile("bf-assignment-scan.tsx", bodyText, ts12.ScriptTarget.Latest, false, ts12.ScriptKind.TSX);
|
|
2729
2732
|
const record = (target) => {
|
|
2730
|
-
if (
|
|
2733
|
+
if (ts12.isIdentifier(target) && candidates.has(target.text)) {
|
|
2731
2734
|
assigned.add(target.text);
|
|
2732
2735
|
}
|
|
2733
2736
|
};
|
|
2734
2737
|
const visit = (node) => {
|
|
2735
|
-
if (
|
|
2738
|
+
if (ts12.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
|
|
2736
2739
|
record(node.left);
|
|
2737
|
-
} else if ((
|
|
2740
|
+
} else if ((ts12.isPrefixUnaryExpression(node) || ts12.isPostfixUnaryExpression(node)) && (node.operator === ts12.SyntaxKind.PlusPlusToken || node.operator === ts12.SyntaxKind.MinusMinusToken)) {
|
|
2738
2741
|
record(node.operand);
|
|
2739
2742
|
}
|
|
2740
|
-
|
|
2743
|
+
ts12.forEachChild(node, visit);
|
|
2741
2744
|
};
|
|
2742
|
-
|
|
2745
|
+
ts12.forEachChild(sf, visit);
|
|
2743
2746
|
return assigned;
|
|
2744
2747
|
}
|
|
2745
2748
|
function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
|
|
@@ -2762,12 +2765,9 @@ function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNam
|
|
|
2762
2765
|
return reachable;
|
|
2763
2766
|
}
|
|
2764
2767
|
function isAssignmentOperator(kind) {
|
|
2765
|
-
return kind >=
|
|
2768
|
+
return kind >= ts12.SyntaxKind.FirstAssignment && kind <= ts12.SyntaxKind.LastAssignment;
|
|
2766
2769
|
}
|
|
2767
2770
|
|
|
2768
|
-
// ../jsx/src/reactivity-checker.ts
|
|
2769
|
-
import ts12 from "typescript";
|
|
2770
|
-
|
|
2771
2771
|
// ../jsx/src/free-refs.ts
|
|
2772
2772
|
import ts13 from "typescript";
|
|
2773
2773
|
var _bindingMapCache = new WeakMap;
|
|
@@ -5624,6 +5624,11 @@ var PREDICATE_METHODS = new Set([
|
|
|
5624
5624
|
"every",
|
|
5625
5625
|
"some"
|
|
5626
5626
|
]);
|
|
5627
|
+
function flattenPropsMember(object, property) {
|
|
5628
|
+
if (object.kind === "identifier" && object.name === "props")
|
|
5629
|
+
return `$${property}`;
|
|
5630
|
+
return null;
|
|
5631
|
+
}
|
|
5627
5632
|
|
|
5628
5633
|
class MojoFilterEmitter {
|
|
5629
5634
|
param;
|
|
@@ -5654,6 +5659,9 @@ class MojoFilterEmitter {
|
|
|
5654
5659
|
return String(value);
|
|
5655
5660
|
}
|
|
5656
5661
|
member(object, property, _computed, _optional, emit) {
|
|
5662
|
+
const flat = flattenPropsMember(object, property);
|
|
5663
|
+
if (flat !== null)
|
|
5664
|
+
return flat;
|
|
5657
5665
|
if (property === "length" && (asCallbackMethodCall(object) !== null || object.kind === "array-literal")) {
|
|
5658
5666
|
return `scalar(@{${emit(object)}})`;
|
|
5659
5667
|
}
|
|
@@ -5804,9 +5812,9 @@ class MojoTopLevelEmitter {
|
|
|
5804
5812
|
return String(value);
|
|
5805
5813
|
}
|
|
5806
5814
|
member(object, property, _computed, _optional, emit) {
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5815
|
+
const flat = flattenPropsMember(object, property);
|
|
5816
|
+
if (flat !== null)
|
|
5817
|
+
return flat;
|
|
5810
5818
|
if (object.kind === "identifier") {
|
|
5811
5819
|
const staticValue = this.ctx.resolveStaticRecordLiteral(object.name, property);
|
|
5812
5820
|
if (staticValue !== null)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/mojolicious",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.2",
|
|
4
4
|
"description": "Mojolicious EP template adapter for BarefootJS - generates .html.ep files from IR",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"directory": "packages/adapter-mojolicious"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@barefootjs/shared": "0.35.
|
|
55
|
+
"@barefootjs/shared": "0.35.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@barefootjs/jsx": ">=0.2.0",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
73
|
-
"@barefootjs/jsx": "0.35.
|
|
74
|
-
"@barefootjs/vite": "0.35.
|
|
75
|
-
"@barefootjs/client": "0.35.
|
|
73
|
+
"@barefootjs/jsx": "0.35.2",
|
|
74
|
+
"@barefootjs/vite": "0.35.2",
|
|
75
|
+
"@barefootjs/client": "0.35.2",
|
|
76
76
|
"vite": "^6.0.0"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -81,6 +81,22 @@ const PREDICATE_METHODS: ReadonlySet<string> = new Set([
|
|
|
81
81
|
'filter', 'find', 'findIndex', 'findLast', 'findLastIndex', 'every', 'some',
|
|
82
82
|
])
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* `props.x` on a bare-props-form component flattens to the bare `$x` the
|
|
86
|
+
* Mojo SSR caller binds each prop to (props arrive as individual `my $x`
|
|
87
|
+
* vars, not a `$props` hashref). Single door for BOTH `member()` emitters
|
|
88
|
+
* below (#2886) — `MojoFilterEmitter` lacked this decision entirely
|
|
89
|
+
* (#2879's cross-adapter follow-up), silently reaching `$props->{x}`, a
|
|
90
|
+
* Perl variable never declared under `use strict`. Returns null for any
|
|
91
|
+
* other receiver so callers fall through to their generic member
|
|
92
|
+
* lowering — `props.a.b` flattens only the inner hop, then the caller's
|
|
93
|
+
* own recursion appends `.b`.
|
|
94
|
+
*/
|
|
95
|
+
function flattenPropsMember(object: ParsedExpr, property: string): string | null {
|
|
96
|
+
if (object.kind === 'identifier' && object.name === 'props') return `$${property}`
|
|
97
|
+
return null
|
|
98
|
+
}
|
|
99
|
+
|
|
84
100
|
export class MojoFilterEmitter implements ParsedExprEmitter {
|
|
85
101
|
// Plain field declarations + assignment, NOT TS constructor-parameter-
|
|
86
102
|
// property shorthand: Vite's `bundleConfigFile` externalizes any bare
|
|
@@ -129,6 +145,8 @@ export class MojoFilterEmitter implements ParsedExprEmitter {
|
|
|
129
145
|
}
|
|
130
146
|
|
|
131
147
|
member(object: ParsedExpr, property: string, _computed: boolean, _optional: boolean, emit: (e: ParsedExpr) => string): string {
|
|
148
|
+
const flat = flattenPropsMember(object, property)
|
|
149
|
+
if (flat !== null) return flat
|
|
132
150
|
// `.length` on a higher-order result (e.g.
|
|
133
151
|
// `x.tags.filter(t => t.active).length > 0` inside the outer
|
|
134
152
|
// filter predicate, #1443). The higher-order emit produces an
|
|
@@ -381,12 +399,8 @@ export class MojoTopLevelEmitter implements ParsedExprEmitter {
|
|
|
381
399
|
}
|
|
382
400
|
|
|
383
401
|
member(object: ParsedExpr, property: string, _computed: boolean, _optional: boolean, emit: (e: ParsedExpr) => string): string {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
// `$props` hashref).
|
|
387
|
-
if (object.kind === 'identifier' && object.name === 'props') {
|
|
388
|
-
return `$${property}`
|
|
389
|
-
}
|
|
402
|
+
const flat = flattenPropsMember(object, property)
|
|
403
|
+
if (flat !== null) return flat
|
|
390
404
|
// Static property access on a module object-literal const
|
|
391
405
|
// (`variantClasses.ghost`, #1897) resolves at compile time — the
|
|
392
406
|
// generic hash lowering below would dereference a Perl var that
|
package/src/conformance-pins.ts
CHANGED
|
@@ -53,18 +53,24 @@ export const conformancePins: ConformancePins = {
|
|
|
53
53
|
'filter-nested-find-predicate': [{ code: 'BF101', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2320' }],
|
|
54
54
|
'date-method-uncatalogued': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2356' }],
|
|
55
55
|
'rich-prop-client-read': [{ code: 'BF049', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2648' }],
|
|
56
|
-
//
|
|
56
|
+
// A ternary or array literal LITERALLY WRAPPING JSX at a non-children prop
|
|
57
57
|
// position (e.g. `header={cond ? <a/> : <b/>}`) is refused ahead of
|
|
58
58
|
// `adapter.generate()` in the shared jsx-to-ir.ts phase, so it is pinned
|
|
59
59
|
// identically on every adapter (including Hono) — same reasoning as
|
|
60
|
-
// `rich-prop-client-read` above.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
//
|
|
60
|
+
// `rich-prop-client-read` above. This is the permanent, intended behavior
|
|
61
|
+
// (formerly tracked as #2667, closed): the issue's own acceptance criteria
|
|
62
|
+
// treated a loud refusal as fully resolving the silent-divergence bug, so
|
|
63
|
+
// no open issue tracks further work here.
|
|
64
|
+
'jsx-element-prop-ternary': [{ code: 'BF021', severity: 'error' }],
|
|
65
|
+
'jsx-element-prop-array': [{ code: 'BF021', severity: 'error' }],
|
|
66
|
+
// A reactive primitive invoked through a namespace import
|
|
64
67
|
// (`import * as bf from '@barefootjs/client'`, `bf.createSignal(...)`)
|
|
65
68
|
// that the analyzer's checker-less fast path cannot recognize refuses
|
|
66
69
|
// loudly (BF013) instead of silently dropping the declaration — fired
|
|
67
70
|
// in the shared analyzer pass ahead of any adapter's `adapter.generate()`,
|
|
68
|
-
// so all nine adapters (including Hono) pin this identically.
|
|
69
|
-
|
|
71
|
+
// so all nine adapters (including Hono) pin this identically. A compile
|
|
72
|
+
// that supplies a shared `ts.Program` (e.g. via `@barefootjs/vite`)
|
|
73
|
+
// resolves the primitive normally and never reaches this refusal (formerly
|
|
74
|
+
// tracked as #2771, closed) — no open issue tracks further work.
|
|
75
|
+
'namespace-import-primitive': [{ code: 'BF013', severity: 'error' }],
|
|
70
76
|
}
|
|
@@ -15,4 +15,15 @@ import type { RenderDivergences } from '@barefootjs/jsx'
|
|
|
15
15
|
// at value position and the runtime evaluator's `object-literal` case
|
|
16
16
|
// now merges it, so the seed classifies `derived` and SSRs identically
|
|
17
17
|
// to Hono.
|
|
18
|
-
export const renderDivergences: RenderDivergences = {
|
|
18
|
+
export const renderDivergences: RenderDivergences = {
|
|
19
|
+
// #2883: `MojoFilterEmitter.identifier()` (expr/emitters.ts) resolves a
|
|
20
|
+
// `.filter()` predicate identifier against only the loop param and
|
|
21
|
+
// `localVarMap` — a bare-props-form renamed prop destructure (`const {
|
|
22
|
+
// fallbackLabel: skipLabel } = props`, the #2788 alias family) falls
|
|
23
|
+
// through to a bare `$skipLabel`, a Perl variable never declared in the
|
|
24
|
+
// generated `.html.ep`. Every row is filtered out (the fixture's
|
|
25
|
+
// reference expects only the non-matching row to survive). Unrelated to
|
|
26
|
+
// #2857's Go Template adapter fix that this fixture was added for — this
|
|
27
|
+
// fixture is a shared cross-adapter conformance fixture, not Go-specific.
|
|
28
|
+
'filter-predicate-renamed-prop': 'https://github.com/piconic-ai/barefootjs/issues/2883',
|
|
29
|
+
}
|