@barefootjs/hono 0.33.4 → 0.33.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/conformance-pins.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/test-render.d.ts.map +1 -1
- package/dist/vite.js +69 -64
- package/package.json +2 -2
- package/src/conformance-pins.ts +7 -0
- package/src/test-render.ts +39 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformance-pins.d.ts","sourceRoot":"","sources":["../src/conformance-pins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;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;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD,eAAO,MAAM,eAAe,EAAE,eAiB7B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -667,7 +667,8 @@ var conformancePins = {
|
|
|
667
667
|
"date-method-uncatalogued": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2356" }],
|
|
668
668
|
"rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }],
|
|
669
669
|
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
670
|
-
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }]
|
|
670
|
+
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
671
|
+
"namespace-import-primitive": [{ code: "BF013", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2771" }]
|
|
671
672
|
};
|
|
672
673
|
export {
|
|
673
674
|
honoAdapter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-render.d.ts","sourceRoot":"","sources":["../src/test-render.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAStD,MAAM,WAAW,aAAa;IAC5B,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,8BAA8B;IAC9B,OAAO,EAAE,eAAe,CAAA;IACxB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACnC;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;
|
|
1
|
+
{"version":3,"file":"test-render.d.ts","sourceRoot":"","sources":["../src/test-render.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAStD,MAAM,WAAW,aAAa;IAC5B,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,8BAA8B;IAC9B,OAAO,EAAE,eAAe,CAAA;IACxB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACnC;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAkDD,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAqMjF"}
|
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 ts10 from "typescript";
|
|
12
12
|
|
|
13
13
|
// ../jsx/src/expression-parser.ts
|
|
14
14
|
import ts from "typescript";
|
|
@@ -84,7 +84,7 @@ var EVAL_MATH_METHODS = new Set([
|
|
|
84
84
|
]);
|
|
85
85
|
|
|
86
86
|
// ../jsx/src/prop-rewrite.ts
|
|
87
|
-
import
|
|
87
|
+
import ts7 from "typescript";
|
|
88
88
|
|
|
89
89
|
// ../jsx/src/ir-to-client-js/utils.ts
|
|
90
90
|
import ts3 from "typescript";
|
|
@@ -242,18 +242,45 @@ function escapeHtml(text) {
|
|
|
242
242
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
243
243
|
}
|
|
244
244
|
// ../jsx/src/ir-to-client-js/csr-substitute.ts
|
|
245
|
+
import ts5 from "typescript";
|
|
246
|
+
|
|
247
|
+
// ../jsx/src/props-binding.ts
|
|
245
248
|
import ts4 from "typescript";
|
|
249
|
+
function isIdentifierName(key) {
|
|
250
|
+
if (key.length === 0)
|
|
251
|
+
return false;
|
|
252
|
+
for (let i = 0;i < key.length; ) {
|
|
253
|
+
const cp = key.codePointAt(i);
|
|
254
|
+
const ok = i === 0 ? ts4.isIdentifierStart(cp, ts4.ScriptTarget.Latest) : ts4.isIdentifierPart(cp, ts4.ScriptTarget.Latest);
|
|
255
|
+
if (!ok)
|
|
256
|
+
return false;
|
|
257
|
+
i += cp > 65535 ? 2 : 1;
|
|
258
|
+
}
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
function propsDestructureBinding(p) {
|
|
262
|
+
const callerKey = p.sourceName ?? p.name;
|
|
263
|
+
const localName = p.name;
|
|
264
|
+
const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
|
|
265
|
+
return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
|
|
266
|
+
}
|
|
267
|
+
var EMPTY_SET = new Set;
|
|
268
|
+
|
|
269
|
+
// ../jsx/src/ir-to-client-js/csr-substitute.ts
|
|
246
270
|
function extractFreeIdentifiersFromText(text) {
|
|
247
271
|
if (!text || text.trim().length === 0)
|
|
248
272
|
return new Set;
|
|
249
|
-
const sf =
|
|
273
|
+
const sf = ts5.createSourceFile("__free_ids__.ts", `(${text});`, ts5.ScriptTarget.Latest, true, ts5.ScriptKind.TS);
|
|
250
274
|
const stmt = sf.statements[0];
|
|
251
|
-
if (!stmt || !
|
|
275
|
+
if (!stmt || !ts5.isExpressionStatement(stmt))
|
|
252
276
|
return new Set;
|
|
253
|
-
const expr =
|
|
277
|
+
const expr = ts5.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
|
|
254
278
|
return extractFreeIdentifiersFromNode(expr);
|
|
255
279
|
}
|
|
256
280
|
|
|
281
|
+
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
282
|
+
import ts6 from "typescript";
|
|
283
|
+
|
|
257
284
|
// ../jsx/src/scope/binding-scope.ts
|
|
258
285
|
class BindingScope {
|
|
259
286
|
frames;
|
|
@@ -375,27 +402,6 @@ var SKELETON_PATH_FORCE_CLOSE_GROUPS = [
|
|
|
375
402
|
new Set(["li"])
|
|
376
403
|
];
|
|
377
404
|
|
|
378
|
-
// ../jsx/src/props-binding.ts
|
|
379
|
-
import ts6 from "typescript";
|
|
380
|
-
function isIdentifierName(key) {
|
|
381
|
-
if (key.length === 0)
|
|
382
|
-
return false;
|
|
383
|
-
for (let i = 0;i < key.length; ) {
|
|
384
|
-
const cp = key.codePointAt(i);
|
|
385
|
-
const ok = i === 0 ? ts6.isIdentifierStart(cp, ts6.ScriptTarget.Latest) : ts6.isIdentifierPart(cp, ts6.ScriptTarget.Latest);
|
|
386
|
-
if (!ok)
|
|
387
|
-
return false;
|
|
388
|
-
i += cp > 65535 ? 2 : 1;
|
|
389
|
-
}
|
|
390
|
-
return true;
|
|
391
|
-
}
|
|
392
|
-
function propsDestructureBinding(p) {
|
|
393
|
-
const callerKey = p.sourceName ?? p.name;
|
|
394
|
-
const localName = p.name;
|
|
395
|
-
const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
|
|
396
|
-
return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
405
|
// ../jsx/src/instrumentation.ts
|
|
400
406
|
var _counters = freshCounters();
|
|
401
407
|
function freshCounters() {
|
|
@@ -409,20 +415,21 @@ function freshCounters() {
|
|
|
409
415
|
}
|
|
410
416
|
|
|
411
417
|
// ../jsx/src/analyzer-context.ts
|
|
412
|
-
import
|
|
418
|
+
import ts9 from "typescript";
|
|
413
419
|
|
|
414
420
|
// ../jsx/src/strip-types.ts
|
|
415
|
-
import
|
|
421
|
+
import ts8 from "typescript";
|
|
416
422
|
|
|
417
423
|
// ../jsx/src/analyzer-context.ts
|
|
418
|
-
var _typePrinter =
|
|
419
|
-
var _blankTypeSourceFile =
|
|
424
|
+
var _typePrinter = ts9.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
|
425
|
+
var _blankTypeSourceFile = ts9.createSourceFile("__bf_types__.ts", "", ts9.ScriptTarget.Latest);
|
|
420
426
|
|
|
421
427
|
// ../jsx/src/errors.ts
|
|
422
428
|
var ErrorCodes = {
|
|
423
429
|
MISSING_USE_CLIENT: "BF001",
|
|
424
430
|
CLIENT_IMPORTING_SERVER: "BF003",
|
|
425
431
|
SIGNAL_OUTSIDE_COMPONENT: "BF011",
|
|
432
|
+
PRIMITIVE_VIA_NAMESPACE_IMPORT: "BF013",
|
|
426
433
|
UNSUPPORTED_JSX_PATTERN: "BF021",
|
|
427
434
|
MISSING_KEY_IN_LIST: "BF023",
|
|
428
435
|
MISSING_KEY_IN_NESTED_LIST: "BF024",
|
|
@@ -455,6 +462,7 @@ var errorMessages = {
|
|
|
455
462
|
[ErrorCodes.MISSING_USE_CLIENT]: "'use client' directive required for components with createSignal or event handlers",
|
|
456
463
|
[ErrorCodes.CLIENT_IMPORTING_SERVER]: "Client component cannot import server component",
|
|
457
464
|
[ErrorCodes.SIGNAL_OUTSIDE_COMPONENT]: "Module-level reactive declaration (createSignal / createMemo) is not allowed. " + "The downstream codegen drops the declaration silently and every reference becomes a ReferenceError at SSR and at hydrate. " + "Move the declaration inside a component function so each mount gets its own state.",
|
|
465
|
+
[ErrorCodes.PRIMITIVE_VIA_NAMESPACE_IMPORT]: "Reactive primitive called through a namespace import of '@barefootjs/client' (import * as ns) is not recognized; " + "the declaration is dropped and its references throw ReferenceError at hydrate. Import the primitive by name instead.",
|
|
458
466
|
[ErrorCodes.UNSUPPORTED_JSX_PATTERN]: "Unsupported JSX pattern",
|
|
459
467
|
[ErrorCodes.MISSING_KEY_IN_LIST]: "Missing key attribute in list rendering. Add a key prop for efficient updates",
|
|
460
468
|
[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",
|
|
@@ -646,46 +654,46 @@ function extractFreeIdentifiersFromNode(node) {
|
|
|
646
654
|
const ids = new Set;
|
|
647
655
|
const boundNames = new Set;
|
|
648
656
|
function addBindingNames(name, out) {
|
|
649
|
-
if (
|
|
657
|
+
if (ts10.isIdentifier(name))
|
|
650
658
|
out.push(name.text);
|
|
651
|
-
else if (
|
|
659
|
+
else if (ts10.isObjectBindingPattern(name))
|
|
652
660
|
name.elements.forEach((e) => addBindingNames(e.name, out));
|
|
653
|
-
else if (
|
|
661
|
+
else if (ts10.isArrayBindingPattern(name))
|
|
654
662
|
name.elements.forEach((e) => {
|
|
655
|
-
if (!
|
|
663
|
+
if (!ts10.isOmittedExpression(e))
|
|
656
664
|
addBindingNames(e.name, out);
|
|
657
665
|
});
|
|
658
666
|
}
|
|
659
667
|
function visit(n) {
|
|
660
|
-
if (
|
|
668
|
+
if (ts10.isTypeNode(n))
|
|
661
669
|
return;
|
|
662
|
-
if (
|
|
670
|
+
if (ts10.isIdentifier(n)) {
|
|
663
671
|
const parent = n.parent;
|
|
664
|
-
if (parent &&
|
|
672
|
+
if (parent && ts10.isPropertyAccessExpression(parent) && parent.name === n)
|
|
665
673
|
return;
|
|
666
|
-
if (parent &&
|
|
674
|
+
if (parent && ts10.isPropertyAssignment(parent) && parent.name === n)
|
|
667
675
|
return;
|
|
668
|
-
if (parent &&
|
|
676
|
+
if (parent && ts10.isParameter(parent) && parent.name === n)
|
|
669
677
|
return;
|
|
670
|
-
if (parent &&
|
|
678
|
+
if (parent && ts10.isVariableDeclaration(parent) && parent.name === n)
|
|
671
679
|
return;
|
|
672
680
|
if (boundNames.has(n.text))
|
|
673
681
|
return;
|
|
674
682
|
ids.add(n.text);
|
|
675
683
|
return;
|
|
676
684
|
}
|
|
677
|
-
if (
|
|
685
|
+
if (ts10.isArrowFunction(n)) {
|
|
678
686
|
const params = [];
|
|
679
687
|
for (const p of n.parameters)
|
|
680
688
|
addBindingNames(p.name, params);
|
|
681
689
|
for (const name of params)
|
|
682
690
|
boundNames.add(name);
|
|
683
|
-
|
|
691
|
+
ts10.forEachChild(n, visit);
|
|
684
692
|
for (const name of params)
|
|
685
693
|
boundNames.delete(name);
|
|
686
694
|
return;
|
|
687
695
|
}
|
|
688
|
-
|
|
696
|
+
ts10.forEachChild(n, visit);
|
|
689
697
|
}
|
|
690
698
|
visit(node);
|
|
691
699
|
return ids;
|
|
@@ -708,7 +716,7 @@ var REACTIVE_PRIMITIVES = new Set([
|
|
|
708
716
|
]);
|
|
709
717
|
|
|
710
718
|
// ../jsx/src/jsx-to-ir.ts
|
|
711
|
-
import
|
|
719
|
+
import ts14 from "typescript";
|
|
712
720
|
|
|
713
721
|
// ../jsx/src/types.ts
|
|
714
722
|
var SCOPE_FORBIDDEN = {
|
|
@@ -744,7 +752,7 @@ var REACTIVE_BINDING_KINDS = new Set([
|
|
|
744
752
|
]);
|
|
745
753
|
|
|
746
754
|
// ../jsx/src/module-exports.ts
|
|
747
|
-
import
|
|
755
|
+
import ts11 from "typescript";
|
|
748
756
|
function formatParamWithType(p) {
|
|
749
757
|
const rest = p.isRest ? "..." : "";
|
|
750
758
|
const optional = p.optional ? "?" : "";
|
|
@@ -779,21 +787,21 @@ function findAssignedNames(bodyText, candidates) {
|
|
|
779
787
|
const assigned = new Set;
|
|
780
788
|
if (candidates.size === 0)
|
|
781
789
|
return assigned;
|
|
782
|
-
const sf =
|
|
790
|
+
const sf = ts11.createSourceFile("bf-assignment-scan.tsx", bodyText, ts11.ScriptTarget.Latest, false, ts11.ScriptKind.TSX);
|
|
783
791
|
const record = (target) => {
|
|
784
|
-
if (
|
|
792
|
+
if (ts11.isIdentifier(target) && candidates.has(target.text)) {
|
|
785
793
|
assigned.add(target.text);
|
|
786
794
|
}
|
|
787
795
|
};
|
|
788
796
|
const visit = (node) => {
|
|
789
|
-
if (
|
|
797
|
+
if (ts11.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
|
|
790
798
|
record(node.left);
|
|
791
|
-
} else if ((
|
|
799
|
+
} else if ((ts11.isPrefixUnaryExpression(node) || ts11.isPostfixUnaryExpression(node)) && (node.operator === ts11.SyntaxKind.PlusPlusToken || node.operator === ts11.SyntaxKind.MinusMinusToken)) {
|
|
792
800
|
record(node.operand);
|
|
793
801
|
}
|
|
794
|
-
|
|
802
|
+
ts11.forEachChild(node, visit);
|
|
795
803
|
};
|
|
796
|
-
|
|
804
|
+
ts11.forEachChild(sf, visit);
|
|
797
805
|
return assigned;
|
|
798
806
|
}
|
|
799
807
|
function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
|
|
@@ -816,14 +824,14 @@ function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNam
|
|
|
816
824
|
return reachable;
|
|
817
825
|
}
|
|
818
826
|
function isAssignmentOperator(kind) {
|
|
819
|
-
return kind >=
|
|
827
|
+
return kind >= ts11.SyntaxKind.FirstAssignment && kind <= ts11.SyntaxKind.LastAssignment;
|
|
820
828
|
}
|
|
821
829
|
|
|
822
830
|
// ../jsx/src/reactivity-checker.ts
|
|
823
|
-
import
|
|
831
|
+
import ts12 from "typescript";
|
|
824
832
|
|
|
825
833
|
// ../jsx/src/free-refs.ts
|
|
826
|
-
import
|
|
834
|
+
import ts13 from "typescript";
|
|
827
835
|
var _bindingMapCache = new WeakMap;
|
|
828
836
|
|
|
829
837
|
// ../jsx/src/to-locale-date-lowering.ts
|
|
@@ -1271,16 +1279,16 @@ var KEYWORDS_AND_GLOBALS = new Set([
|
|
|
1271
1279
|
]);
|
|
1272
1280
|
|
|
1273
1281
|
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
1274
|
-
import
|
|
1282
|
+
import ts15 from "typescript";
|
|
1275
1283
|
|
|
1276
1284
|
// ../jsx/src/ir-to-client-js/imports.ts
|
|
1277
|
-
import
|
|
1285
|
+
import ts17 from "typescript";
|
|
1278
1286
|
|
|
1279
1287
|
// ../jsx/src/value-references.ts
|
|
1280
|
-
import
|
|
1288
|
+
import ts16 from "typescript";
|
|
1281
1289
|
|
|
1282
1290
|
// ../jsx/src/relocate.ts
|
|
1283
|
-
import
|
|
1291
|
+
import ts18 from "typescript";
|
|
1284
1292
|
|
|
1285
1293
|
// ../jsx/src/lowering-registry.ts
|
|
1286
1294
|
var plugins = [];
|
|
@@ -1459,10 +1467,10 @@ function formatDateLocalNames(metadata) {
|
|
|
1459
1467
|
}
|
|
1460
1468
|
|
|
1461
1469
|
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
1462
|
-
import
|
|
1470
|
+
import ts19 from "typescript";
|
|
1463
1471
|
|
|
1464
1472
|
// ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
|
|
1465
|
-
import
|
|
1473
|
+
import ts20 from "typescript";
|
|
1466
1474
|
var NO_PREAMBLE = {
|
|
1467
1475
|
lazySafe: true,
|
|
1468
1476
|
facts: { declaredNames: new Set, freeNames: new Set }
|
|
@@ -1512,7 +1520,7 @@ var INERT_BINDING_GLOBALS = new Set([
|
|
|
1512
1520
|
]);
|
|
1513
1521
|
|
|
1514
1522
|
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
1515
|
-
import
|
|
1523
|
+
import ts21 from "typescript";
|
|
1516
1524
|
|
|
1517
1525
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/event-delegation.ts
|
|
1518
1526
|
var NON_BUBBLING_EVENTS = new Set([
|
|
@@ -1526,9 +1534,6 @@ var NON_BUBBLING_EVENTS = new Set([
|
|
|
1526
1534
|
"pointerleave"
|
|
1527
1535
|
]);
|
|
1528
1536
|
|
|
1529
|
-
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
1530
|
-
import ts21 from "typescript";
|
|
1531
|
-
|
|
1532
1537
|
// ../jsx/src/ir-to-client-js/source-map.ts
|
|
1533
1538
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1534
1539
|
function encodeVLQ(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/hono",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.6",
|
|
4
4
|
"description": "Hono integration for BarefootJS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
124
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
125
|
-
"@barefootjs/vite": "0.33.
|
|
125
|
+
"@barefootjs/vite": "0.33.6",
|
|
126
126
|
"@types/jsdom": "^27.0.0",
|
|
127
127
|
"hono": "^4.6.0",
|
|
128
128
|
"jsdom": "^27.3.0",
|
package/src/conformance-pins.ts
CHANGED
|
@@ -21,4 +21,11 @@ export const conformancePins: ConformancePins = {
|
|
|
21
21
|
// `rich-prop-client-read` above.
|
|
22
22
|
'jsx-element-prop-ternary': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
|
|
23
23
|
'jsx-element-prop-array': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
|
|
24
|
+
// #2771: a reactive primitive invoked through a namespace import
|
|
25
|
+
// (`import * as bf from '@barefootjs/client'`, `bf.createSignal(...)`)
|
|
26
|
+
// that the analyzer's checker-less fast path cannot recognize refuses
|
|
27
|
+
// loudly (BF013) instead of silently dropping the declaration — fired
|
|
28
|
+
// in the shared analyzer pass ahead of any adapter's `adapter.generate()`,
|
|
29
|
+
// so all nine adapters (including Hono) pin this identically.
|
|
30
|
+
'namespace-import-primitive': [{ code: 'BF013', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2771' }],
|
|
24
31
|
}
|
package/src/test-render.ts
CHANGED
|
@@ -70,6 +70,29 @@ function stripModuleExports(code: string): string {
|
|
|
70
70
|
.replace(/\bexport\s+(default\s+)?/g, '')
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* A single named-import line for a child that's being INLINED (its
|
|
75
|
+
* declarations are spliced in verbatim, see `stripModuleExports` above) —
|
|
76
|
+
* returns `const <local> = <declared>` for every aliased specifier
|
|
77
|
+
* (`{ Label as AliasedLabel }`), or `null` when every specifier is a bare,
|
|
78
|
+
* non-aliased name (nothing left to bind; dropping the whole line is
|
|
79
|
+
* correct). A default-import specifier (`import Label from …`) has no
|
|
80
|
+
* declared name to alias against and is left unhandled — dropped like
|
|
81
|
+
* before, matching what a bare inlined child needs.
|
|
82
|
+
*/
|
|
83
|
+
function aliasDeclarationsFor(importLine: string): string | null {
|
|
84
|
+
const namedMatch = importLine.match(/\{([^}]*)\}/)
|
|
85
|
+
if (!namedMatch) return null
|
|
86
|
+
const aliases = namedMatch[1]
|
|
87
|
+
.split(',')
|
|
88
|
+
.map(spec => spec.trim())
|
|
89
|
+
.filter(Boolean)
|
|
90
|
+
.map(spec => spec.match(/^(\w+)\s+as\s+(\w+)$/))
|
|
91
|
+
.filter((m): m is RegExpMatchArray => m !== null)
|
|
92
|
+
.map(([, declared, local]) => `const ${local} = ${declared};`)
|
|
93
|
+
return aliases.length > 0 ? aliases.join(' ') : null
|
|
94
|
+
}
|
|
95
|
+
|
|
73
96
|
export async function renderHonoComponent(options: RenderOptions): Promise<string> {
|
|
74
97
|
const { source, adapter, props, components, componentModules, componentName: requestedName } = options
|
|
75
98
|
|
|
@@ -171,7 +194,22 @@ export async function renderHonoComponent(options: RenderOptions): Promise<strin
|
|
|
171
194
|
const [, prefix, importPath, suffix] = importMatch
|
|
172
195
|
const moduleKey = matchKey(importPath, moduleTempPaths.keys())
|
|
173
196
|
if (moduleKey) return `${prefix}${moduleTempPaths.get(moduleKey)}${suffix}`
|
|
174
|
-
if (matchKey(importPath, componentKeys))
|
|
197
|
+
if (matchKey(importPath, componentKeys)) {
|
|
198
|
+
// The inlined child keeps its OWN declared name (`stripModuleExports`
|
|
199
|
+
// only removes `export `, it doesn't rename), but the parent's
|
|
200
|
+
// JSX still references whatever LOCAL name it imported the child
|
|
201
|
+
// under (#2777 — Hono correctly keeps the caller's local binding
|
|
202
|
+
// rather than the declared name). Dropping the import line
|
|
203
|
+
// unconditionally is only safe for a non-aliased specifier
|
|
204
|
+
// (`import { Label } from './label'`, where local === declared);
|
|
205
|
+
// an aliased one (`import { Label as AliasedLabel } from
|
|
206
|
+
// './label'`) needs a `const AliasedLabel = Label` left behind, or
|
|
207
|
+
// the parent's JSX throws `ReferenceError: AliasedLabel is not
|
|
208
|
+
// defined` — this harness inlines the child by literal source
|
|
209
|
+
// splice, not through a real module boundary, so there's no
|
|
210
|
+
// `import … as …` left to do the binding for us.
|
|
211
|
+
return aliasDeclarationsFor(line)
|
|
212
|
+
}
|
|
175
213
|
return line
|
|
176
214
|
})
|
|
177
215
|
.filter((line): line is string => line !== null)
|