@barefootjs/hono 0.31.4 → 0.31.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hono-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/hono-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,MAAM,EAIX,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAElB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,UAAU,EAQX,MAAM,iBAAiB,CAAA;AAExB;;;;;GAKG;AACH,KAAK,aAAa,GAAG;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAGD,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAuBD,qBAAa,WAAY,SAAQ,UAAW,YAAW,aAAa,CAAC,aAAa,CAAC;IACjF,IAAI,SAAS;IACb,SAAS,SAAS;IAClB,gBAAgB,SAAiC;IAmBjD,mBAAmB,QAAO,OAAO,CAAQ;IAEzC,SAAS,CAAC,SAAS,EAAE,gBAAgB,CAA0B;IAE/D,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,iB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;;;;;;;;;OAWG;IACH,OAAO,CAAC,0BAA0B;CAInC;AAGD,eAAO,MAAM,WAAW,aAAoB,CAAA"}
|
package/dist/adapter/index.js
CHANGED
|
@@ -233,7 +233,8 @@ export default ${this.componentName}` : "";
|
|
|
233
233
|
const noArgDefault = wantsNoArgDefault ? ` = {} as ${propsTypeExpr}` : "";
|
|
234
234
|
const lines = [];
|
|
235
235
|
const exportPrefix = ir.metadata.isExported === false ? "" : "export ";
|
|
236
|
-
|
|
236
|
+
const typeParameters = ir.metadata.typeParameters ?? "";
|
|
237
|
+
lines.push(`${exportPrefix}function ${name}${typeParameters}(${fullPropsDestructure}${typeAnnotation}${noArgDefault}) {`);
|
|
237
238
|
if (this.hasPreloadAssets()) {
|
|
238
239
|
lines.push(` const __bfInlinePreloads = registerComponentPreloads(${JSON.stringify(this.preloadAssets)})`);
|
|
239
240
|
}
|
package/dist/index.js
CHANGED
|
@@ -233,7 +233,8 @@ export default ${this.componentName}` : "";
|
|
|
233
233
|
const noArgDefault = wantsNoArgDefault ? ` = {} as ${propsTypeExpr}` : "";
|
|
234
234
|
const lines = [];
|
|
235
235
|
const exportPrefix = ir.metadata.isExported === false ? "" : "export ";
|
|
236
|
-
|
|
236
|
+
const typeParameters = ir.metadata.typeParameters ?? "";
|
|
237
|
+
lines.push(`${exportPrefix}function ${name}${typeParameters}(${fullPropsDestructure}${typeAnnotation}${noArgDefault}) {`);
|
|
237
238
|
if (this.hasPreloadAssets()) {
|
|
238
239
|
lines.push(` const __bfInlinePreloads = registerComponentPreloads(${JSON.stringify(this.preloadAssets)})`);
|
|
239
240
|
}
|
package/dist/vite.js
CHANGED
|
@@ -5,7 +5,7 @@ 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 ts24 from "typescript";
|
|
9
9
|
|
|
10
10
|
// ../jsx/src/analyzer.ts
|
|
11
11
|
import ts9 from "typescript";
|
|
@@ -702,7 +702,7 @@ var REACTIVE_PRIMITIVES = new Set([
|
|
|
702
702
|
]);
|
|
703
703
|
|
|
704
704
|
// ../jsx/src/jsx-to-ir.ts
|
|
705
|
-
import
|
|
705
|
+
import ts13 from "typescript";
|
|
706
706
|
|
|
707
707
|
// ../jsx/src/types.ts
|
|
708
708
|
var SCOPE_FORBIDDEN = {
|
|
@@ -738,6 +738,7 @@ var REACTIVE_BINDING_KINDS = new Set([
|
|
|
738
738
|
]);
|
|
739
739
|
|
|
740
740
|
// ../jsx/src/module-exports.ts
|
|
741
|
+
import ts10 from "typescript";
|
|
741
742
|
function formatParamWithType(p) {
|
|
742
743
|
const rest = p.isRest ? "..." : "";
|
|
743
744
|
const optional = p.optional ? "?" : "";
|
|
@@ -768,12 +769,55 @@ function findReachableNames(primaryRefs, declarations) {
|
|
|
768
769
|
}
|
|
769
770
|
return reachable;
|
|
770
771
|
}
|
|
772
|
+
function findAssignedNames(bodyText, candidates) {
|
|
773
|
+
const assigned = new Set;
|
|
774
|
+
if (candidates.size === 0)
|
|
775
|
+
return assigned;
|
|
776
|
+
const sf = ts10.createSourceFile("bf-assignment-scan.tsx", bodyText, ts10.ScriptTarget.Latest, false, ts10.ScriptKind.TSX);
|
|
777
|
+
const record = (target) => {
|
|
778
|
+
if (ts10.isIdentifier(target) && candidates.has(target.text)) {
|
|
779
|
+
assigned.add(target.text);
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
const visit = (node) => {
|
|
783
|
+
if (ts10.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
|
|
784
|
+
record(node.left);
|
|
785
|
+
} else if ((ts10.isPrefixUnaryExpression(node) || ts10.isPostfixUnaryExpression(node)) && (node.operator === ts10.SyntaxKind.PlusPlusToken || node.operator === ts10.SyntaxKind.MinusMinusToken)) {
|
|
786
|
+
record(node.operand);
|
|
787
|
+
}
|
|
788
|
+
ts10.forEachChild(node, visit);
|
|
789
|
+
};
|
|
790
|
+
ts10.forEachChild(sf, visit);
|
|
791
|
+
return assigned;
|
|
792
|
+
}
|
|
793
|
+
function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
|
|
794
|
+
let reachable = findReachableNames(primaryRefs, declarations);
|
|
795
|
+
if (mutableNames.size === 0)
|
|
796
|
+
return reachable;
|
|
797
|
+
let seedText = primaryRefs;
|
|
798
|
+
for (let round = 0;round <= declarations.length; round++) {
|
|
799
|
+
const survivingMutables = new Set([...reachable].filter((name) => mutableNames.has(name)));
|
|
800
|
+
if (survivingMutables.size === 0)
|
|
801
|
+
return reachable;
|
|
802
|
+
const added = declarations.filter((d) => !reachable.has(d.name)).filter((d) => findAssignedNames(d.body, survivingMutables).size > 0).map((d) => d.name);
|
|
803
|
+
if (added.length === 0)
|
|
804
|
+
return reachable;
|
|
805
|
+
seedText += `
|
|
806
|
+
` + added.join(`
|
|
807
|
+
`);
|
|
808
|
+
reachable = findReachableNames(seedText, declarations);
|
|
809
|
+
}
|
|
810
|
+
return reachable;
|
|
811
|
+
}
|
|
812
|
+
function isAssignmentOperator(kind) {
|
|
813
|
+
return kind >= ts10.SyntaxKind.FirstAssignment && kind <= ts10.SyntaxKind.LastAssignment;
|
|
814
|
+
}
|
|
771
815
|
|
|
772
816
|
// ../jsx/src/reactivity-checker.ts
|
|
773
|
-
import
|
|
817
|
+
import ts11 from "typescript";
|
|
774
818
|
|
|
775
819
|
// ../jsx/src/free-refs.ts
|
|
776
|
-
import
|
|
820
|
+
import ts12 from "typescript";
|
|
777
821
|
var _bindingMapCache = new WeakMap;
|
|
778
822
|
|
|
779
823
|
// ../jsx/src/to-locale-date-lowering.ts
|
|
@@ -1187,13 +1231,13 @@ var KEYWORDS_AND_GLOBALS = new Set([
|
|
|
1187
1231
|
]);
|
|
1188
1232
|
|
|
1189
1233
|
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
1190
|
-
import
|
|
1234
|
+
import ts14 from "typescript";
|
|
1191
1235
|
|
|
1192
1236
|
// ../jsx/src/value-references.ts
|
|
1193
|
-
import
|
|
1237
|
+
import ts15 from "typescript";
|
|
1194
1238
|
|
|
1195
1239
|
// ../jsx/src/relocate.ts
|
|
1196
|
-
import
|
|
1240
|
+
import ts16 from "typescript";
|
|
1197
1241
|
|
|
1198
1242
|
// ../jsx/src/lowering-registry.ts
|
|
1199
1243
|
var plugins = [];
|
|
@@ -1372,10 +1416,10 @@ function formatDateLocalNames(metadata) {
|
|
|
1372
1416
|
}
|
|
1373
1417
|
|
|
1374
1418
|
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
1375
|
-
import
|
|
1419
|
+
import ts17 from "typescript";
|
|
1376
1420
|
|
|
1377
1421
|
// ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
|
|
1378
|
-
import
|
|
1422
|
+
import ts18 from "typescript";
|
|
1379
1423
|
var NO_PREAMBLE = {
|
|
1380
1424
|
lazySafe: true,
|
|
1381
1425
|
facts: { declaredNames: new Set, freeNames: new Set }
|
|
@@ -1425,7 +1469,7 @@ var INERT_BINDING_GLOBALS = new Set([
|
|
|
1425
1469
|
]);
|
|
1426
1470
|
|
|
1427
1471
|
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
1428
|
-
import
|
|
1472
|
+
import ts19 from "typescript";
|
|
1429
1473
|
|
|
1430
1474
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/event-delegation.ts
|
|
1431
1475
|
var NON_BUBBLING_EVENTS = new Set([
|
|
@@ -1440,7 +1484,7 @@ var NON_BUBBLING_EVENTS = new Set([
|
|
|
1440
1484
|
]);
|
|
1441
1485
|
|
|
1442
1486
|
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
1443
|
-
import
|
|
1487
|
+
import ts20 from "typescript";
|
|
1444
1488
|
|
|
1445
1489
|
// ../jsx/src/ir-to-client-js/source-map.ts
|
|
1446
1490
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -1531,20 +1575,20 @@ class SourceMapGenerator {
|
|
|
1531
1575
|
}
|
|
1532
1576
|
|
|
1533
1577
|
// ../jsx/src/preprocess-inline-jsx-callbacks.ts
|
|
1534
|
-
import
|
|
1578
|
+
import ts21 from "typescript";
|
|
1535
1579
|
|
|
1536
1580
|
// ../jsx/src/ssr-defaults.ts
|
|
1537
|
-
import
|
|
1581
|
+
import ts22 from "typescript";
|
|
1538
1582
|
var UNRESOLVED = Symbol("unresolved");
|
|
1539
1583
|
var NO_RETURN = Symbol("no-return");
|
|
1540
1584
|
|
|
1541
1585
|
// ../jsx/src/augment-inherited-props.ts
|
|
1542
|
-
import
|
|
1586
|
+
import ts23 from "typescript";
|
|
1543
1587
|
|
|
1544
1588
|
// ../jsx/src/rich-type-refusal.ts
|
|
1545
1589
|
var EMPTY_BINDINGS2 = new Map;
|
|
1546
1590
|
// ../jsx/src/shared-program.ts
|
|
1547
|
-
import
|
|
1591
|
+
import ts25 from "typescript";
|
|
1548
1592
|
// ../jsx/src/adapters/interface.ts
|
|
1549
1593
|
class BaseAdapter {
|
|
1550
1594
|
renderChildren(children) {
|
|
@@ -1597,7 +1641,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
1597
1641
|
...localFunctions.map((f) => ({ name: f.name, body: f.body })),
|
|
1598
1642
|
...localConstants.map((c) => ({ name: c.name, body: c.value }))
|
|
1599
1643
|
];
|
|
1600
|
-
const reachable =
|
|
1644
|
+
const reachable = closeOverWritersOfMutableBindings(primaryRefText, declarations, new Set(ir.metadata.localConstants.filter((c) => (c.declarationKind ?? "const") !== "const").map((c) => c.name)));
|
|
1601
1645
|
const reachableBodies = [...reachable].map((name) => {
|
|
1602
1646
|
const func = localFunctions.find((f) => f.name === name);
|
|
1603
1647
|
if (func)
|
|
@@ -1629,7 +1673,8 @@ class JsxAdapter extends BaseAdapter {
|
|
|
1629
1673
|
if (signal.setter) {
|
|
1630
1674
|
const setterUsed = identifierPattern(signal.setter).test(setterRefText);
|
|
1631
1675
|
if (setterUsed) {
|
|
1632
|
-
|
|
1676
|
+
const setterType = preserveTypes && signal.type.kind !== "unknown" ? `(valueOrFn: ${signal.type.raw} | ((prev: ${signal.type.raw}) => ${signal.type.raw})) => void` : null;
|
|
1677
|
+
lines.push(setterType ? ` const ${signal.setter}: ${setterType} = () => {}` : ` const ${signal.setter} = (..._args: any[]) => {}`);
|
|
1633
1678
|
}
|
|
1634
1679
|
}
|
|
1635
1680
|
}
|
|
@@ -1825,7 +1870,7 @@ class JsxAdapter extends BaseAdapter {
|
|
|
1825
1870
|
}
|
|
1826
1871
|
|
|
1827
1872
|
// ../jsx/src/adapters/template-imports.ts
|
|
1828
|
-
import
|
|
1873
|
+
import ts26 from "typescript";
|
|
1829
1874
|
var CLIENT_PACKAGE_SOURCES = new Set([
|
|
1830
1875
|
"@barefootjs/client",
|
|
1831
1876
|
"@barefootjs/client/runtime"
|
|
@@ -1875,18 +1920,18 @@ function specKey(s) {
|
|
|
1875
1920
|
function rewriteDynamicImportsInSource(sourceText, rewriteRelative) {
|
|
1876
1921
|
if (!sourceText.includes("import"))
|
|
1877
1922
|
return sourceText;
|
|
1878
|
-
const sf =
|
|
1923
|
+
const sf = ts26.createSourceFile("bf-template-fragment.tsx", sourceText, ts26.ScriptTarget.Latest, false, ts26.ScriptKind.TSX);
|
|
1879
1924
|
const edits = [];
|
|
1880
1925
|
const visit = (node) => {
|
|
1881
|
-
if (
|
|
1926
|
+
if (ts26.isCallExpression(node) && node.expression.kind === ts26.SyntaxKind.ImportKeyword && node.arguments.length > 0 && ts26.isStringLiteralLike(node.arguments[0])) {
|
|
1882
1927
|
collect(node.arguments[0]);
|
|
1883
1928
|
}
|
|
1884
|
-
if (
|
|
1929
|
+
if (ts26.isImportTypeNode(node) && ts26.isLiteralTypeNode(node.argument)) {
|
|
1885
1930
|
const literal = node.argument.literal;
|
|
1886
|
-
if (
|
|
1931
|
+
if (ts26.isStringLiteralLike(literal))
|
|
1887
1932
|
collect(literal);
|
|
1888
1933
|
}
|
|
1889
|
-
|
|
1934
|
+
ts26.forEachChild(node, visit);
|
|
1890
1935
|
};
|
|
1891
1936
|
const collect = (literal) => {
|
|
1892
1937
|
const specifier = literal.text;
|
|
@@ -1901,7 +1946,7 @@ function rewriteDynamicImportsInSource(sourceText, rewriteRelative) {
|
|
|
1901
1946
|
text: `'${next}'`
|
|
1902
1947
|
});
|
|
1903
1948
|
};
|
|
1904
|
-
|
|
1949
|
+
ts26.forEachChild(sf, visit);
|
|
1905
1950
|
if (edits.length === 0)
|
|
1906
1951
|
return sourceText;
|
|
1907
1952
|
let out = sourceText;
|
|
@@ -2002,7 +2047,8 @@ export default ${this.componentName}` : "";
|
|
|
2002
2047
|
const noArgDefault = hasRequiredProps ? "" : ` = {} as ${propsTypeExpr}`;
|
|
2003
2048
|
const lines = [];
|
|
2004
2049
|
const exportPrefix = ir.metadata.isExported === false ? "" : "export ";
|
|
2005
|
-
|
|
2050
|
+
const typeParameters = ir.metadata.typeParameters ?? "";
|
|
2051
|
+
lines.push(`${exportPrefix}function ${name}${typeParameters}(${fullPropsDestructure}${typeAnnotation}${noArgDefault}) {`);
|
|
2006
2052
|
if (hasClientInteractivity) {
|
|
2007
2053
|
lines.push(` const __scopeId = (/_s\\d/.test(__bfScope || '') ? __bfScope : null) || __instanceId || \`${name}_\${Math.random().toString(36).slice(2, 8)}\``);
|
|
2008
2054
|
} else {
|
|
@@ -2308,11 +2354,11 @@ function emitAttrValue(value, emitter, name) {
|
|
|
2308
2354
|
}
|
|
2309
2355
|
}
|
|
2310
2356
|
// ../jsx/src/combine-client-js.ts
|
|
2311
|
-
import ts26 from "typescript";
|
|
2312
|
-
// ../jsx/src/debug.ts
|
|
2313
2357
|
import ts27 from "typescript";
|
|
2314
|
-
// ../jsx/src/
|
|
2358
|
+
// ../jsx/src/debug.ts
|
|
2315
2359
|
import ts28 from "typescript";
|
|
2360
|
+
// ../jsx/src/profiler.ts
|
|
2361
|
+
import ts29 from "typescript";
|
|
2316
2362
|
|
|
2317
2363
|
// ../jsx/src/index.ts
|
|
2318
2364
|
registerBuiltinLoweringPlugins();
|
|
@@ -2541,7 +2587,8 @@ export default ${this.componentName}` : "";
|
|
|
2541
2587
|
const noArgDefault = wantsNoArgDefault ? ` = {} as ${propsTypeExpr}` : "";
|
|
2542
2588
|
const lines = [];
|
|
2543
2589
|
const exportPrefix = ir.metadata.isExported === false ? "" : "export ";
|
|
2544
|
-
|
|
2590
|
+
const typeParameters = ir.metadata.typeParameters ?? "";
|
|
2591
|
+
lines.push(`${exportPrefix}function ${name}${typeParameters}(${fullPropsDestructure}${typeAnnotation}${noArgDefault}) {`);
|
|
2545
2592
|
if (this.hasPreloadAssets()) {
|
|
2546
2593
|
lines.push(` const __bfInlinePreloads = registerComponentPreloads(${JSON.stringify(this.preloadAssets)})`);
|
|
2547
2594
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/hono",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.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.31.
|
|
125
|
+
"@barefootjs/vite": "0.31.6",
|
|
126
126
|
"@types/jsdom": "^27.0.0",
|
|
127
127
|
"hono": "^4.6.0",
|
|
128
128
|
"jsdom": "^27.3.0",
|
|
@@ -556,7 +556,12 @@ export class HonoAdapter extends JsxAdapter implements IRNodeEmitter<HonoRenderC
|
|
|
556
556
|
// Module-export keyword belongs to the adapter: it knows the target language
|
|
557
557
|
// and whether the source declared the component as exported.
|
|
558
558
|
const exportPrefix = ir.metadata.isExported === false ? '' : 'export '
|
|
559
|
-
|
|
559
|
+
// A generic component's props type (and often its body) keeps
|
|
560
|
+
// referencing the source's type parameter names verbatim — the
|
|
561
|
+
// function's own declaration must carry them too, or those references
|
|
562
|
+
// are unresolved names in the emitted `.tsx` (TS2304, xyflow's `Flow`).
|
|
563
|
+
const typeParameters = ir.metadata.typeParameters ?? ''
|
|
564
|
+
lines.push(`${exportPrefix}function ${name}${typeParameters}(${fullPropsDestructure}${typeAnnotation}${noArgDefault}) {`)
|
|
560
565
|
|
|
561
566
|
// Vite-pipeline script registration (see `scriptAssets`'s field
|
|
562
567
|
// docstring): register this call's resolved URLs against the request
|