@barefootjs/erb 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 +14 -6
- package/dist/vite.js +39 -31
- package/package.json +5 -5
- package/src/adapter/expr/emitters.ts +19 -5
- package/src/conformance-pins.ts +13 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitters.d.ts","sourceRoot":"","sources":["../../../src/adapter/expr/emitters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EACL,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,cAAc,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"emitters.d.ts","sourceRoot":"","sources":["../../../src/adapter/expr/emitters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EACL,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,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAuDxD,qBAAa,gBAAiB,YAAW,iBAAiB;IASxD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IAMjD,OAA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,EAAE,UAAU,EACtB,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAC9B,MAAM,CAGR;IAED,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CAiB9E;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,CAE1B;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAKjD;IAED,aAAa,CAAC,UAAU,EAAE,qBAAqB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,MAAM,GAAG,MAAM,CAqBxG;CACF"}
|
package/dist/adapter/index.js
CHANGED
|
@@ -187732,6 +187732,11 @@ var PREDICATE_METHODS = new Set([
|
|
|
187732
187732
|
function unusedIsStringName(_n) {
|
|
187733
187733
|
return false;
|
|
187734
187734
|
}
|
|
187735
|
+
function flattenPropsMember(object, property) {
|
|
187736
|
+
if (object.kind === "identifier" && object.name === "props")
|
|
187737
|
+
return `v[${rubySymbolLiteral(property)}]`;
|
|
187738
|
+
return null;
|
|
187739
|
+
}
|
|
187735
187740
|
|
|
187736
187741
|
class ErbFilterEmitter {
|
|
187737
187742
|
param;
|
|
@@ -187768,6 +187773,9 @@ class ErbFilterEmitter {
|
|
|
187768
187773
|
return String(value);
|
|
187769
187774
|
}
|
|
187770
187775
|
member(object, property, _computed, optional, emit) {
|
|
187776
|
+
const flat = flattenPropsMember(object, property);
|
|
187777
|
+
if (flat !== null)
|
|
187778
|
+
return flat;
|
|
187771
187779
|
if (property === "length")
|
|
187772
187780
|
return `bf.length(${emit(object)})`;
|
|
187773
187781
|
if (optional)
|
|
@@ -187909,9 +187917,9 @@ class ErbTopLevelEmitter {
|
|
|
187909
187917
|
return String(value);
|
|
187910
187918
|
}
|
|
187911
187919
|
member(object, property, _computed, optional, emit) {
|
|
187912
|
-
|
|
187913
|
-
|
|
187914
|
-
|
|
187920
|
+
const flat = flattenPropsMember(object, property);
|
|
187921
|
+
if (flat !== null)
|
|
187922
|
+
return flat;
|
|
187915
187923
|
if (object.kind === "identifier") {
|
|
187916
187924
|
const staticValue = this.ctx.resolveStaticRecordLiteral(object.name, property);
|
|
187917
187925
|
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
|
@@ -187732,6 +187732,11 @@ var PREDICATE_METHODS = new Set([
|
|
|
187732
187732
|
function unusedIsStringName(_n) {
|
|
187733
187733
|
return false;
|
|
187734
187734
|
}
|
|
187735
|
+
function flattenPropsMember(object, property) {
|
|
187736
|
+
if (object.kind === "identifier" && object.name === "props")
|
|
187737
|
+
return `v[${rubySymbolLiteral(property)}]`;
|
|
187738
|
+
return null;
|
|
187739
|
+
}
|
|
187735
187740
|
|
|
187736
187741
|
class ErbFilterEmitter {
|
|
187737
187742
|
param;
|
|
@@ -187768,6 +187773,9 @@ class ErbFilterEmitter {
|
|
|
187768
187773
|
return String(value);
|
|
187769
187774
|
}
|
|
187770
187775
|
member(object, property, _computed, optional, emit) {
|
|
187776
|
+
const flat = flattenPropsMember(object, property);
|
|
187777
|
+
if (flat !== null)
|
|
187778
|
+
return flat;
|
|
187771
187779
|
if (property === "length")
|
|
187772
187780
|
return `bf.length(${emit(object)})`;
|
|
187773
187781
|
if (optional)
|
|
@@ -187909,9 +187917,9 @@ class ErbTopLevelEmitter {
|
|
|
187909
187917
|
return String(value);
|
|
187910
187918
|
}
|
|
187911
187919
|
member(object, property, _computed, optional, emit) {
|
|
187912
|
-
|
|
187913
|
-
|
|
187914
|
-
|
|
187920
|
+
const flat = flattenPropsMember(object, property);
|
|
187921
|
+
if (flat !== null)
|
|
187922
|
+
return flat;
|
|
187915
187923
|
if (object.kind === "identifier") {
|
|
187916
187924
|
const staticValue = this.ctx.resolveStaticRecordLiteral(object.name, property);
|
|
187917
187925
|
if (staticValue !== null)
|
|
@@ -189257,9 +189265,9 @@ var conformancePins = {
|
|
|
189257
189265
|
"filter-nested-find-predicate": [{ code: "BF101", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2320" }],
|
|
189258
189266
|
"date-method-uncatalogued": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2356" }],
|
|
189259
189267
|
"rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }],
|
|
189260
|
-
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error"
|
|
189261
|
-
"jsx-element-prop-array": [{ code: "BF021", severity: "error"
|
|
189262
|
-
"namespace-import-primitive": [{ code: "BF013", severity: "error"
|
|
189268
|
+
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error" }],
|
|
189269
|
+
"jsx-element-prop-array": [{ code: "BF021", severity: "error" }],
|
|
189270
|
+
"namespace-import-primitive": [{ code: "BF013", severity: "error" }]
|
|
189263
189271
|
};
|
|
189264
189272
|
// src/render-divergences.ts
|
|
189265
189273
|
var renderDivergences = {};
|
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;
|
|
@@ -5619,6 +5619,11 @@ var PREDICATE_METHODS = new Set([
|
|
|
5619
5619
|
function unusedIsStringName(_n) {
|
|
5620
5620
|
return false;
|
|
5621
5621
|
}
|
|
5622
|
+
function flattenPropsMember(object, property) {
|
|
5623
|
+
if (object.kind === "identifier" && object.name === "props")
|
|
5624
|
+
return `v[${rubySymbolLiteral(property)}]`;
|
|
5625
|
+
return null;
|
|
5626
|
+
}
|
|
5622
5627
|
|
|
5623
5628
|
class ErbFilterEmitter {
|
|
5624
5629
|
param;
|
|
@@ -5655,6 +5660,9 @@ class ErbFilterEmitter {
|
|
|
5655
5660
|
return String(value);
|
|
5656
5661
|
}
|
|
5657
5662
|
member(object, property, _computed, optional, emit) {
|
|
5663
|
+
const flat = flattenPropsMember(object, property);
|
|
5664
|
+
if (flat !== null)
|
|
5665
|
+
return flat;
|
|
5658
5666
|
if (property === "length")
|
|
5659
5667
|
return `bf.length(${emit(object)})`;
|
|
5660
5668
|
if (optional)
|
|
@@ -5796,9 +5804,9 @@ class ErbTopLevelEmitter {
|
|
|
5796
5804
|
return String(value);
|
|
5797
5805
|
}
|
|
5798
5806
|
member(object, property, _computed, optional, emit) {
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5807
|
+
const flat = flattenPropsMember(object, property);
|
|
5808
|
+
if (flat !== null)
|
|
5809
|
+
return flat;
|
|
5802
5810
|
if (object.kind === "identifier") {
|
|
5803
5811
|
const staticValue = this.ctx.resolveStaticRecordLiteral(object.name, property);
|
|
5804
5812
|
if (staticValue !== null)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/erb",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.2",
|
|
4
4
|
"description": "ERB (Embedded Ruby) adapter for BarefootJS — compiles IR to .erb templates and ships the Ruby rendering backend; runs under any Rack app (Sinatra, Rails)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"directory": "packages/adapter-erb"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@barefootjs/shared": "0.35.
|
|
57
|
+
"@barefootjs/shared": "0.35.2"
|
|
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.2",
|
|
75
|
+
"@barefootjs/vite": "0.35.2",
|
|
76
|
+
"@barefootjs/client": "0.35.2",
|
|
77
77
|
"typescript": "^5.0.0",
|
|
78
78
|
"vite": "^6.0.0"
|
|
79
79
|
}
|
|
@@ -92,6 +92,21 @@ function unusedIsStringName(_n: string): boolean {
|
|
|
92
92
|
return false
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* `props.x` on a bare-props-form component flattens to the `v[:x]` the ERB
|
|
97
|
+
* SSR caller seeds each prop under (props arrive as vars-Hash entries, not
|
|
98
|
+
* a nested `props` Hash). Single door for BOTH `member()` emitters below
|
|
99
|
+
* (#2886) — `ErbFilterEmitter` lacked this decision entirely (#2879's
|
|
100
|
+
* cross-adapter follow-up), silently reaching `v[:props][:x]`, which is
|
|
101
|
+
* `nil[...]` at runtime (`NoMethodError`). Returns null for any other
|
|
102
|
+
* receiver so callers fall through to their generic member lowering —
|
|
103
|
+
* `props.a.b` flattens only the inner hop.
|
|
104
|
+
*/
|
|
105
|
+
function flattenPropsMember(object: ParsedExpr, property: string): string | null {
|
|
106
|
+
if (object.kind === 'identifier' && object.name === 'props') return `v[${rubySymbolLiteral(property)}]`
|
|
107
|
+
return null
|
|
108
|
+
}
|
|
109
|
+
|
|
95
110
|
export class ErbFilterEmitter implements ParsedExprEmitter {
|
|
96
111
|
// Plain field declarations + assignment, NOT TS constructor-parameter-
|
|
97
112
|
// property shorthand: Vite's `bundleConfigFile` externalizes any bare
|
|
@@ -164,6 +179,8 @@ export class ErbFilterEmitter implements ParsedExprEmitter {
|
|
|
164
179
|
}
|
|
165
180
|
|
|
166
181
|
member(object: ParsedExpr, property: string, _computed: boolean, optional: boolean, emit: (e: ParsedExpr) => string): string {
|
|
182
|
+
const flat = flattenPropsMember(object, property)
|
|
183
|
+
if (flat !== null) return flat
|
|
167
184
|
// `.length` needs no special higher-order form here — see the file
|
|
168
185
|
// docstring's simplification (2): `.select { ... }.length` just works
|
|
169
186
|
// in Ruby, unlike Perl's anonymous-arrayref `scalar(@{...})` detour.
|
|
@@ -411,11 +428,8 @@ export class ErbTopLevelEmitter implements ParsedExprEmitter {
|
|
|
411
428
|
}
|
|
412
429
|
|
|
413
430
|
member(object: ParsedExpr, property: string, _computed: boolean, optional: boolean, emit: (e: ParsedExpr) => string): string {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
if (object.kind === 'identifier' && object.name === 'props') {
|
|
417
|
-
return `v[${rubySymbolLiteral(property)}]`
|
|
418
|
-
}
|
|
431
|
+
const flat = flattenPropsMember(object, property)
|
|
432
|
+
if (flat !== null) return flat
|
|
419
433
|
// Static property access on a module object-literal const
|
|
420
434
|
// (`variantClasses.ghost`) resolves at compile time — the generic Hash
|
|
421
435
|
// lowering below would read a vars-Hash key that doesn't exist
|
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
|
}
|