@barefootjs/mojolicious 0.33.3 → 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/adapter/index.js +6 -2
- package/dist/adapter/mojo-adapter.d.ts +11 -0
- package/dist/adapter/mojo-adapter.d.ts.map +1 -1
- package/dist/conformance-pins.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/render-divergences.d.ts.map +1 -1
- package/dist/vite.js +88 -65
- 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/mojo-adapter.ts +19 -1
- package/src/conformance-pins.ts +7 -0
- package/src/render-divergences.ts +2 -0
package/dist/adapter/index.js
CHANGED
|
@@ -27,7 +27,8 @@ import {
|
|
|
27
27
|
dangerousInnerHtmlDiagnostic,
|
|
28
28
|
resolveStaticLoopSource,
|
|
29
29
|
derivesScopeFromSlot,
|
|
30
|
-
BindingScope
|
|
30
|
+
BindingScope,
|
|
31
|
+
buildImportAliasMap
|
|
31
32
|
} from "@barefootjs/jsx";
|
|
32
33
|
|
|
33
34
|
// src/adapter/boolean-result.ts
|
|
@@ -1031,6 +1032,7 @@ class MojoAdapter extends BaseAdapter {
|
|
|
1031
1032
|
localConstants = [];
|
|
1032
1033
|
scope = BindingScope.EMPTY;
|
|
1033
1034
|
nullableOptionalProps = new Set;
|
|
1035
|
+
importAliases = new Map;
|
|
1034
1036
|
constructor(options = {}) {
|
|
1035
1037
|
super();
|
|
1036
1038
|
this.options = {
|
|
@@ -1051,6 +1053,7 @@ class MojoAdapter extends BaseAdapter {
|
|
|
1051
1053
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
1052
1054
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
1053
1055
|
this.localConstants = ir.metadata.localConstants ?? [];
|
|
1056
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
1054
1057
|
this.scope = BindingScope.EMPTY;
|
|
1055
1058
|
this.errors = [];
|
|
1056
1059
|
this.childrenCaptureCounter = 0;
|
|
@@ -1557,7 +1560,8 @@ ${renderedChildren}` : renderedChildren;
|
|
|
1557
1560
|
childrenCaptureCounter = 0;
|
|
1558
1561
|
presenceVarCounter = 0;
|
|
1559
1562
|
toTemplateName(componentName) {
|
|
1560
|
-
|
|
1563
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
1564
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
1561
1565
|
}
|
|
1562
1566
|
renderIfStatement(ifStmt) {
|
|
1563
1567
|
const condition = this.convertExpressionToPerl(ifStmt.condition);
|
|
@@ -122,6 +122,17 @@ export declare class MojoAdapter extends BaseAdapter implements IRNodeEmitter<Mo
|
|
|
122
122
|
* excluded and always emit unconditionally.
|
|
123
123
|
*/
|
|
124
124
|
private nullableOptionalProps;
|
|
125
|
+
/**
|
|
126
|
+
* Local alias -> declared/exported name for imported components (#2822,
|
|
127
|
+
* the SSR-side counterpart of #2777's client-JS registry-key fix). A
|
|
128
|
+
* child referenced under an import alias (`import { Foo as Bar }`,
|
|
129
|
+
* `<Bar/>`) must build its cross-template call against the child's own
|
|
130
|
+
* declared name (`Foo`, what `foo.tsx` registers its Mojo partial as) —
|
|
131
|
+
* never the caller-local binding. Built once per compile from
|
|
132
|
+
* `ir.metadata.imports` via the shared `buildImportAliasMap`
|
|
133
|
+
* (`@barefootjs/jsx`) and read by `toTemplateName`.
|
|
134
|
+
*/
|
|
135
|
+
private importAliases;
|
|
125
136
|
constructor(options?: MojoAdapterOptions);
|
|
126
137
|
generate(ir: ComponentIR, options?: AdapterGenerateOptions): AdapterOutput;
|
|
127
138
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mojo-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/mojo-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,WAAW,EAEX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAMP,yBAAyB,EAE1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"mojo-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/mojo-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,WAAW,EAEX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,aAAa,EACb,UAAU,EACV,OAAO,EAMP,yBAAyB,EAE1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,aAAa,EAClB,KAAK,UAAU,EAkChB,MAAM,iBAAiB,CAAA;AAKxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AA0BnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAuCxD,qBAAa,WAAY,SAAQ,WAAY,YAAW,aAAa,CAAC,aAAa,CAAC;IAClF,IAAI,SAAgB;IACpB,SAAS,SAAa;IACtB,qBAAqB,UAAO;IAE5B;;;;;;;;;;;OAWG;IACH,kBAAkB,EAAE,yBAAyB,CAA0B;IAEvE,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,MAAM,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GAUlB;IAED;;;;;OAKG;IACH,OAAO,KAAK,SAAS,GAQpB;IAED,sEAAsE;IACtE,OAAO,KAAK,OAAO,GAElB;IAED,OAAO,CAAC,uBAAuB;IAoF/B;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAI9B;;;;OAIG;IACH;4EACwE;IACxE,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,gBAAgB;IAcxB,iFAAiF;IACjF,OAAO,CAAC,2BAA2B;CAGpC;AAED,eAAO,MAAM,WAAW,aAAoB,CAAA"}
|
|
@@ -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,eAsD7B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,8 @@ import {
|
|
|
27
27
|
dangerousInnerHtmlDiagnostic,
|
|
28
28
|
resolveStaticLoopSource,
|
|
29
29
|
derivesScopeFromSlot,
|
|
30
|
-
BindingScope
|
|
30
|
+
BindingScope,
|
|
31
|
+
buildImportAliasMap
|
|
31
32
|
} from "@barefootjs/jsx";
|
|
32
33
|
|
|
33
34
|
// src/adapter/boolean-result.ts
|
|
@@ -1031,6 +1032,7 @@ class MojoAdapter extends BaseAdapter {
|
|
|
1031
1032
|
localConstants = [];
|
|
1032
1033
|
scope = BindingScope.EMPTY;
|
|
1033
1034
|
nullableOptionalProps = new Set;
|
|
1035
|
+
importAliases = new Map;
|
|
1034
1036
|
constructor(options = {}) {
|
|
1035
1037
|
super();
|
|
1036
1038
|
this.options = {
|
|
@@ -1051,6 +1053,7 @@ class MojoAdapter extends BaseAdapter {
|
|
|
1051
1053
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
1052
1054
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
1053
1055
|
this.localConstants = ir.metadata.localConstants ?? [];
|
|
1056
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
1054
1057
|
this.scope = BindingScope.EMPTY;
|
|
1055
1058
|
this.errors = [];
|
|
1056
1059
|
this.childrenCaptureCounter = 0;
|
|
@@ -1557,7 +1560,8 @@ ${renderedChildren}` : renderedChildren;
|
|
|
1557
1560
|
childrenCaptureCounter = 0;
|
|
1558
1561
|
presenceVarCounter = 0;
|
|
1559
1562
|
toTemplateName(componentName) {
|
|
1560
|
-
|
|
1563
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
1564
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
1561
1565
|
}
|
|
1562
1566
|
renderIfStatement(ifStmt) {
|
|
1563
1567
|
const condition = this.convertExpressionToPerl(ifStmt.condition);
|
|
@@ -1900,11 +1904,13 @@ var conformancePins = {
|
|
|
1900
1904
|
"date-method-uncatalogued": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2356" }],
|
|
1901
1905
|
"rich-prop-client-read": [{ code: "BF049", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2648" }],
|
|
1902
1906
|
"jsx-element-prop-ternary": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
1903
|
-
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }]
|
|
1907
|
+
"jsx-element-prop-array": [{ code: "BF021", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2667" }],
|
|
1908
|
+
"namespace-import-primitive": [{ code: "BF013", severity: "error", issue: "https://github.com/piconic-ai/barefootjs/issues/2771" }]
|
|
1904
1909
|
};
|
|
1905
1910
|
// src/render-divergences.ts
|
|
1906
1911
|
var renderDivergences = {
|
|
1907
|
-
"children-passthrough-renamed": "A renamed `children` destructure emits the local alias as a template variable; the stash defines only `children`, so the Perl render dies (#2788)."
|
|
1912
|
+
"children-passthrough-renamed": "A renamed `children` destructure emits the local alias as a template variable; the stash defines only `children`, so the Perl render dies (#2788).",
|
|
1913
|
+
"aliased-loop-source": "A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) dies inside `Mojo::Template::process` on real Mojolicious — the seeded loop data is keyed by the signal's real name (`items`), and the alias hop is never resolved when deciding what to seed under `items__alias`. This is the SSR-side twin of #2778 (fixed for the CSR client-JS template in the same PR that added this fixture) — that fix only touches client-JS emission, not SSR data-seeding. Tracked at https://github.com/piconic-ai/barefootjs/issues/2813; graduate by resolving the alias hop at SSR-seeding time using the same `resolveAliasOrigin`/`resolveGetterAliases` mechanism #2778 introduced, rather than a third alias-hop walker."
|
|
1908
1914
|
};
|
|
1909
1915
|
export {
|
|
1910
1916
|
renderDivergences,
|
|
@@ -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;AAkBxD,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;AAkBxD,eAAO,MAAM,iBAAiB,EAAE,iBAK/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 ts10 from "typescript";
|
|
12
12
|
|
|
13
13
|
// ../jsx/src/expression-parser.ts
|
|
14
14
|
import ts from "typescript";
|
|
@@ -1941,7 +1941,7 @@ function identifierPath(callee) {
|
|
|
1941
1941
|
}
|
|
1942
1942
|
|
|
1943
1943
|
// ../jsx/src/prop-rewrite.ts
|
|
1944
|
-
import
|
|
1944
|
+
import ts7 from "typescript";
|
|
1945
1945
|
|
|
1946
1946
|
// ../jsx/src/ir-to-client-js/utils.ts
|
|
1947
1947
|
import ts3 from "typescript";
|
|
@@ -2091,19 +2091,61 @@ function resolveJsxChildrenProp(props) {
|
|
|
2091
2091
|
return [];
|
|
2092
2092
|
return prop.value.children ?? [];
|
|
2093
2093
|
}
|
|
2094
|
+
// ../jsx/src/ir-to-client-js/component-scope.ts
|
|
2095
|
+
function buildImportAliasMap(imports) {
|
|
2096
|
+
const aliases = new Map;
|
|
2097
|
+
for (const imp of imports) {
|
|
2098
|
+
if (imp.isTypeOnly)
|
|
2099
|
+
continue;
|
|
2100
|
+
for (const spec of imp.specifiers) {
|
|
2101
|
+
if (spec.isTypeOnly || spec.isDefault || spec.isNamespace || spec.alias === null)
|
|
2102
|
+
continue;
|
|
2103
|
+
aliases.set(spec.alias, spec.name);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
return aliases;
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2094
2109
|
// ../jsx/src/ir-to-client-js/csr-substitute.ts
|
|
2110
|
+
import ts5 from "typescript";
|
|
2111
|
+
|
|
2112
|
+
// ../jsx/src/props-binding.ts
|
|
2095
2113
|
import ts4 from "typescript";
|
|
2114
|
+
function isIdentifierName(key) {
|
|
2115
|
+
if (key.length === 0)
|
|
2116
|
+
return false;
|
|
2117
|
+
for (let i = 0;i < key.length; ) {
|
|
2118
|
+
const cp = key.codePointAt(i);
|
|
2119
|
+
const ok = i === 0 ? ts4.isIdentifierStart(cp, ts4.ScriptTarget.Latest) : ts4.isIdentifierPart(cp, ts4.ScriptTarget.Latest);
|
|
2120
|
+
if (!ok)
|
|
2121
|
+
return false;
|
|
2122
|
+
i += cp > 65535 ? 2 : 1;
|
|
2123
|
+
}
|
|
2124
|
+
return true;
|
|
2125
|
+
}
|
|
2126
|
+
function propsDestructureBinding(p) {
|
|
2127
|
+
const callerKey = p.sourceName ?? p.name;
|
|
2128
|
+
const localName = p.name;
|
|
2129
|
+
const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
|
|
2130
|
+
return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
|
|
2131
|
+
}
|
|
2132
|
+
var EMPTY_SET = new Set;
|
|
2133
|
+
|
|
2134
|
+
// ../jsx/src/ir-to-client-js/csr-substitute.ts
|
|
2096
2135
|
function extractFreeIdentifiersFromText(text) {
|
|
2097
2136
|
if (!text || text.trim().length === 0)
|
|
2098
2137
|
return new Set;
|
|
2099
|
-
const sf =
|
|
2138
|
+
const sf = ts5.createSourceFile("__free_ids__.ts", `(${text});`, ts5.ScriptTarget.Latest, true, ts5.ScriptKind.TS);
|
|
2100
2139
|
const stmt = sf.statements[0];
|
|
2101
|
-
if (!stmt || !
|
|
2140
|
+
if (!stmt || !ts5.isExpressionStatement(stmt))
|
|
2102
2141
|
return new Set;
|
|
2103
|
-
const expr =
|
|
2142
|
+
const expr = ts5.isParenthesizedExpression(stmt.expression) ? stmt.expression.expression : stmt.expression;
|
|
2104
2143
|
return extractFreeIdentifiersFromNode(expr);
|
|
2105
2144
|
}
|
|
2106
2145
|
|
|
2146
|
+
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
2147
|
+
import ts6 from "typescript";
|
|
2148
|
+
|
|
2107
2149
|
// ../jsx/src/adapters/child-scope.ts
|
|
2108
2150
|
function derivesScopeFromSlot(comp) {
|
|
2109
2151
|
return comp.slotId != null && comp.loopItemRoot !== true;
|
|
@@ -2230,27 +2272,6 @@ var SKELETON_PATH_FORCE_CLOSE_GROUPS = [
|
|
|
2230
2272
|
new Set(["li"])
|
|
2231
2273
|
];
|
|
2232
2274
|
|
|
2233
|
-
// ../jsx/src/props-binding.ts
|
|
2234
|
-
import ts6 from "typescript";
|
|
2235
|
-
function isIdentifierName(key) {
|
|
2236
|
-
if (key.length === 0)
|
|
2237
|
-
return false;
|
|
2238
|
-
for (let i = 0;i < key.length; ) {
|
|
2239
|
-
const cp = key.codePointAt(i);
|
|
2240
|
-
const ok = i === 0 ? ts6.isIdentifierStart(cp, ts6.ScriptTarget.Latest) : ts6.isIdentifierPart(cp, ts6.ScriptTarget.Latest);
|
|
2241
|
-
if (!ok)
|
|
2242
|
-
return false;
|
|
2243
|
-
i += cp > 65535 ? 2 : 1;
|
|
2244
|
-
}
|
|
2245
|
-
return true;
|
|
2246
|
-
}
|
|
2247
|
-
function propsDestructureBinding(p) {
|
|
2248
|
-
const callerKey = p.sourceName ?? p.name;
|
|
2249
|
-
const localName = p.name;
|
|
2250
|
-
const binding = callerKey === localName ? localName : `${isIdentifierName(callerKey) ? callerKey : JSON.stringify(callerKey)}: ${localName}`;
|
|
2251
|
-
return p.defaultValue ? `${binding} = ${p.defaultValue}` : binding;
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
2275
|
// ../jsx/src/instrumentation.ts
|
|
2255
2276
|
var _counters = freshCounters();
|
|
2256
2277
|
function freshCounters() {
|
|
@@ -2264,20 +2285,21 @@ function freshCounters() {
|
|
|
2264
2285
|
}
|
|
2265
2286
|
|
|
2266
2287
|
// ../jsx/src/analyzer-context.ts
|
|
2267
|
-
import
|
|
2288
|
+
import ts9 from "typescript";
|
|
2268
2289
|
|
|
2269
2290
|
// ../jsx/src/strip-types.ts
|
|
2270
|
-
import
|
|
2291
|
+
import ts8 from "typescript";
|
|
2271
2292
|
|
|
2272
2293
|
// ../jsx/src/analyzer-context.ts
|
|
2273
|
-
var _typePrinter =
|
|
2274
|
-
var _blankTypeSourceFile =
|
|
2294
|
+
var _typePrinter = ts9.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
|
|
2295
|
+
var _blankTypeSourceFile = ts9.createSourceFile("__bf_types__.ts", "", ts9.ScriptTarget.Latest);
|
|
2275
2296
|
|
|
2276
2297
|
// ../jsx/src/errors.ts
|
|
2277
2298
|
var ErrorCodes = {
|
|
2278
2299
|
MISSING_USE_CLIENT: "BF001",
|
|
2279
2300
|
CLIENT_IMPORTING_SERVER: "BF003",
|
|
2280
2301
|
SIGNAL_OUTSIDE_COMPONENT: "BF011",
|
|
2302
|
+
PRIMITIVE_VIA_NAMESPACE_IMPORT: "BF013",
|
|
2281
2303
|
UNSUPPORTED_JSX_PATTERN: "BF021",
|
|
2282
2304
|
MISSING_KEY_IN_LIST: "BF023",
|
|
2283
2305
|
MISSING_KEY_IN_NESTED_LIST: "BF024",
|
|
@@ -2310,6 +2332,7 @@ var errorMessages = {
|
|
|
2310
2332
|
[ErrorCodes.MISSING_USE_CLIENT]: "'use client' directive required for components with createSignal or event handlers",
|
|
2311
2333
|
[ErrorCodes.CLIENT_IMPORTING_SERVER]: "Client component cannot import server component",
|
|
2312
2334
|
[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.",
|
|
2335
|
+
[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.",
|
|
2313
2336
|
[ErrorCodes.UNSUPPORTED_JSX_PATTERN]: "Unsupported JSX pattern",
|
|
2314
2337
|
[ErrorCodes.MISSING_KEY_IN_LIST]: "Missing key attribute in list rendering. Add a key prop for efficient updates",
|
|
2315
2338
|
[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",
|
|
@@ -2501,46 +2524,46 @@ function extractFreeIdentifiersFromNode(node) {
|
|
|
2501
2524
|
const ids = new Set;
|
|
2502
2525
|
const boundNames = new Set;
|
|
2503
2526
|
function addBindingNames(name, out) {
|
|
2504
|
-
if (
|
|
2527
|
+
if (ts10.isIdentifier(name))
|
|
2505
2528
|
out.push(name.text);
|
|
2506
|
-
else if (
|
|
2529
|
+
else if (ts10.isObjectBindingPattern(name))
|
|
2507
2530
|
name.elements.forEach((e) => addBindingNames(e.name, out));
|
|
2508
|
-
else if (
|
|
2531
|
+
else if (ts10.isArrayBindingPattern(name))
|
|
2509
2532
|
name.elements.forEach((e) => {
|
|
2510
|
-
if (!
|
|
2533
|
+
if (!ts10.isOmittedExpression(e))
|
|
2511
2534
|
addBindingNames(e.name, out);
|
|
2512
2535
|
});
|
|
2513
2536
|
}
|
|
2514
2537
|
function visit(n) {
|
|
2515
|
-
if (
|
|
2538
|
+
if (ts10.isTypeNode(n))
|
|
2516
2539
|
return;
|
|
2517
|
-
if (
|
|
2540
|
+
if (ts10.isIdentifier(n)) {
|
|
2518
2541
|
const parent = n.parent;
|
|
2519
|
-
if (parent &&
|
|
2542
|
+
if (parent && ts10.isPropertyAccessExpression(parent) && parent.name === n)
|
|
2520
2543
|
return;
|
|
2521
|
-
if (parent &&
|
|
2544
|
+
if (parent && ts10.isPropertyAssignment(parent) && parent.name === n)
|
|
2522
2545
|
return;
|
|
2523
|
-
if (parent &&
|
|
2546
|
+
if (parent && ts10.isParameter(parent) && parent.name === n)
|
|
2524
2547
|
return;
|
|
2525
|
-
if (parent &&
|
|
2548
|
+
if (parent && ts10.isVariableDeclaration(parent) && parent.name === n)
|
|
2526
2549
|
return;
|
|
2527
2550
|
if (boundNames.has(n.text))
|
|
2528
2551
|
return;
|
|
2529
2552
|
ids.add(n.text);
|
|
2530
2553
|
return;
|
|
2531
2554
|
}
|
|
2532
|
-
if (
|
|
2555
|
+
if (ts10.isArrowFunction(n)) {
|
|
2533
2556
|
const params = [];
|
|
2534
2557
|
for (const p of n.parameters)
|
|
2535
2558
|
addBindingNames(p.name, params);
|
|
2536
2559
|
for (const name of params)
|
|
2537
2560
|
boundNames.add(name);
|
|
2538
|
-
|
|
2561
|
+
ts10.forEachChild(n, visit);
|
|
2539
2562
|
for (const name of params)
|
|
2540
2563
|
boundNames.delete(name);
|
|
2541
2564
|
return;
|
|
2542
2565
|
}
|
|
2543
|
-
|
|
2566
|
+
ts10.forEachChild(n, visit);
|
|
2544
2567
|
}
|
|
2545
2568
|
visit(node);
|
|
2546
2569
|
return ids;
|
|
@@ -2563,7 +2586,7 @@ var REACTIVE_PRIMITIVES = new Set([
|
|
|
2563
2586
|
]);
|
|
2564
2587
|
|
|
2565
2588
|
// ../jsx/src/jsx-to-ir.ts
|
|
2566
|
-
import
|
|
2589
|
+
import ts14 from "typescript";
|
|
2567
2590
|
|
|
2568
2591
|
// ../jsx/src/types.ts
|
|
2569
2592
|
var SCOPE_FORBIDDEN = {
|
|
@@ -2613,7 +2636,7 @@ function preambleAnalysisTemplateText(p) {
|
|
|
2613
2636
|
}
|
|
2614
2637
|
|
|
2615
2638
|
// ../jsx/src/module-exports.ts
|
|
2616
|
-
import
|
|
2639
|
+
import ts11 from "typescript";
|
|
2617
2640
|
function formatParamWithType(p) {
|
|
2618
2641
|
const rest = p.isRest ? "..." : "";
|
|
2619
2642
|
const optional = p.optional ? "?" : "";
|
|
@@ -2648,21 +2671,21 @@ function findAssignedNames(bodyText, candidates) {
|
|
|
2648
2671
|
const assigned = new Set;
|
|
2649
2672
|
if (candidates.size === 0)
|
|
2650
2673
|
return assigned;
|
|
2651
|
-
const sf =
|
|
2674
|
+
const sf = ts11.createSourceFile("bf-assignment-scan.tsx", bodyText, ts11.ScriptTarget.Latest, false, ts11.ScriptKind.TSX);
|
|
2652
2675
|
const record = (target) => {
|
|
2653
|
-
if (
|
|
2676
|
+
if (ts11.isIdentifier(target) && candidates.has(target.text)) {
|
|
2654
2677
|
assigned.add(target.text);
|
|
2655
2678
|
}
|
|
2656
2679
|
};
|
|
2657
2680
|
const visit = (node) => {
|
|
2658
|
-
if (
|
|
2681
|
+
if (ts11.isBinaryExpression(node) && isAssignmentOperator(node.operatorToken.kind)) {
|
|
2659
2682
|
record(node.left);
|
|
2660
|
-
} else if ((
|
|
2683
|
+
} else if ((ts11.isPrefixUnaryExpression(node) || ts11.isPostfixUnaryExpression(node)) && (node.operator === ts11.SyntaxKind.PlusPlusToken || node.operator === ts11.SyntaxKind.MinusMinusToken)) {
|
|
2661
2684
|
record(node.operand);
|
|
2662
2685
|
}
|
|
2663
|
-
|
|
2686
|
+
ts11.forEachChild(node, visit);
|
|
2664
2687
|
};
|
|
2665
|
-
|
|
2688
|
+
ts11.forEachChild(sf, visit);
|
|
2666
2689
|
return assigned;
|
|
2667
2690
|
}
|
|
2668
2691
|
function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNames) {
|
|
@@ -2685,14 +2708,14 @@ function closeOverWritersOfMutableBindings(primaryRefs, declarations, mutableNam
|
|
|
2685
2708
|
return reachable;
|
|
2686
2709
|
}
|
|
2687
2710
|
function isAssignmentOperator(kind) {
|
|
2688
|
-
return kind >=
|
|
2711
|
+
return kind >= ts11.SyntaxKind.FirstAssignment && kind <= ts11.SyntaxKind.LastAssignment;
|
|
2689
2712
|
}
|
|
2690
2713
|
|
|
2691
2714
|
// ../jsx/src/reactivity-checker.ts
|
|
2692
|
-
import
|
|
2715
|
+
import ts12 from "typescript";
|
|
2693
2716
|
|
|
2694
2717
|
// ../jsx/src/free-refs.ts
|
|
2695
|
-
import
|
|
2718
|
+
import ts13 from "typescript";
|
|
2696
2719
|
var _bindingMapCache = new WeakMap;
|
|
2697
2720
|
|
|
2698
2721
|
// ../jsx/src/to-locale-date-lowering.ts
|
|
@@ -3140,16 +3163,16 @@ var KEYWORDS_AND_GLOBALS = new Set([
|
|
|
3140
3163
|
]);
|
|
3141
3164
|
|
|
3142
3165
|
// ../jsx/src/ir-to-client-js/walk-prop-accesses.ts
|
|
3143
|
-
import
|
|
3166
|
+
import ts15 from "typescript";
|
|
3144
3167
|
|
|
3145
3168
|
// ../jsx/src/ir-to-client-js/imports.ts
|
|
3146
|
-
import
|
|
3169
|
+
import ts17 from "typescript";
|
|
3147
3170
|
|
|
3148
3171
|
// ../jsx/src/value-references.ts
|
|
3149
|
-
import
|
|
3172
|
+
import ts16 from "typescript";
|
|
3150
3173
|
|
|
3151
3174
|
// ../jsx/src/relocate.ts
|
|
3152
|
-
import
|
|
3175
|
+
import ts18 from "typescript";
|
|
3153
3176
|
|
|
3154
3177
|
// ../jsx/src/lowering-registry.ts
|
|
3155
3178
|
var plugins = [];
|
|
@@ -3366,10 +3389,10 @@ function matchSearchParamsMethodCall(callee, args, localNames) {
|
|
|
3366
3389
|
}
|
|
3367
3390
|
|
|
3368
3391
|
// ../jsx/src/ir-to-client-js/prune-unused-prop-extractions.ts
|
|
3369
|
-
import
|
|
3392
|
+
import ts19 from "typescript";
|
|
3370
3393
|
|
|
3371
3394
|
// ../jsx/src/ir-to-client-js/control-flow/plan/lazy-preamble.ts
|
|
3372
|
-
import
|
|
3395
|
+
import ts20 from "typescript";
|
|
3373
3396
|
var NO_PREAMBLE = {
|
|
3374
3397
|
lazySafe: true,
|
|
3375
3398
|
facts: { declaredNames: new Set, freeNames: new Set }
|
|
@@ -3419,7 +3442,7 @@ var INERT_BINDING_GLOBALS = new Set([
|
|
|
3419
3442
|
]);
|
|
3420
3443
|
|
|
3421
3444
|
// ../jsx/src/ir-to-client-js/emit-reactive.ts
|
|
3422
|
-
import
|
|
3445
|
+
import ts21 from "typescript";
|
|
3423
3446
|
|
|
3424
3447
|
// ../jsx/src/ir-to-client-js/control-flow/stringify/event-delegation.ts
|
|
3425
3448
|
var NON_BUBBLING_EVENTS = new Set([
|
|
@@ -3433,9 +3456,6 @@ var NON_BUBBLING_EVENTS = new Set([
|
|
|
3433
3456
|
"pointerleave"
|
|
3434
3457
|
]);
|
|
3435
3458
|
|
|
3436
|
-
// ../jsx/src/ir-to-client-js/rewrite-props-object.ts
|
|
3437
|
-
import ts21 from "typescript";
|
|
3438
|
-
|
|
3439
3459
|
// ../jsx/src/ir-to-client-js/source-map.ts
|
|
3440
3460
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3441
3461
|
function encodeVLQ(value) {
|
|
@@ -6206,6 +6226,7 @@ class MojoAdapter extends BaseAdapter {
|
|
|
6206
6226
|
localConstants = [];
|
|
6207
6227
|
scope = BindingScope.EMPTY;
|
|
6208
6228
|
nullableOptionalProps = new Set;
|
|
6229
|
+
importAliases = new Map;
|
|
6209
6230
|
constructor(options = {}) {
|
|
6210
6231
|
super();
|
|
6211
6232
|
this.options = {
|
|
@@ -6226,6 +6247,7 @@ class MojoAdapter extends BaseAdapter {
|
|
|
6226
6247
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata);
|
|
6227
6248
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata);
|
|
6228
6249
|
this.localConstants = ir.metadata.localConstants ?? [];
|
|
6250
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? []);
|
|
6229
6251
|
this.scope = BindingScope.EMPTY;
|
|
6230
6252
|
this.errors = [];
|
|
6231
6253
|
this.childrenCaptureCounter = 0;
|
|
@@ -6732,7 +6754,8 @@ ${renderedChildren}` : renderedChildren;
|
|
|
6732
6754
|
childrenCaptureCounter = 0;
|
|
6733
6755
|
presenceVarCounter = 0;
|
|
6734
6756
|
toTemplateName(componentName) {
|
|
6735
|
-
|
|
6757
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName;
|
|
6758
|
+
return declaredName.replace(/([A-Z])/g, "_$1").toLowerCase().replace(/^_/, "");
|
|
6736
6759
|
}
|
|
6737
6760
|
renderIfStatement(ifStmt) {
|
|
6738
6761
|
const condition = this.convertExpressionToPerl(ifStmt.condition);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/mojolicious",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.6",
|
|
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.33.
|
|
55
|
+
"@barefootjs/shared": "0.33.6"
|
|
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.33.
|
|
74
|
-
"@barefootjs/vite": "0.33.
|
|
75
|
-
"@barefootjs/client": "0.33.
|
|
73
|
+
"@barefootjs/jsx": "0.33.6",
|
|
74
|
+
"@barefootjs/vite": "0.33.6",
|
|
75
|
+
"@barefootjs/client": "0.33.6",
|
|
76
76
|
"vite": "^6.0.0"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -67,6 +67,7 @@ import {
|
|
|
67
67
|
resolveStaticLoopSource,
|
|
68
68
|
derivesScopeFromSlot,
|
|
69
69
|
BindingScope,
|
|
70
|
+
buildImportAliasMap,
|
|
70
71
|
} from '@barefootjs/jsx'
|
|
71
72
|
import { isAriaBooleanAttr, isBooleanResultExpr } from './boolean-result.ts'
|
|
72
73
|
import type { ParsedExpr, LoweringMatcher } from '@barefootjs/jsx'
|
|
@@ -256,6 +257,18 @@ export class MojoAdapter extends BaseAdapter implements IRNodeEmitter<MojoRender
|
|
|
256
257
|
*/
|
|
257
258
|
private nullableOptionalProps: Set<string> = new Set()
|
|
258
259
|
|
|
260
|
+
/**
|
|
261
|
+
* Local alias -> declared/exported name for imported components (#2822,
|
|
262
|
+
* the SSR-side counterpart of #2777's client-JS registry-key fix). A
|
|
263
|
+
* child referenced under an import alias (`import { Foo as Bar }`,
|
|
264
|
+
* `<Bar/>`) must build its cross-template call against the child's own
|
|
265
|
+
* declared name (`Foo`, what `foo.tsx` registers its Mojo partial as) —
|
|
266
|
+
* never the caller-local binding. Built once per compile from
|
|
267
|
+
* `ir.metadata.imports` via the shared `buildImportAliasMap`
|
|
268
|
+
* (`@barefootjs/jsx`) and read by `toTemplateName`.
|
|
269
|
+
*/
|
|
270
|
+
private importAliases: Map<string, string> = new Map()
|
|
271
|
+
|
|
259
272
|
constructor(options: MojoAdapterOptions = {}) {
|
|
260
273
|
super()
|
|
261
274
|
this.options = {
|
|
@@ -285,6 +298,7 @@ export class MojoAdapter extends BaseAdapter implements IRNodeEmitter<MojoRender
|
|
|
285
298
|
this._searchParamsLocals = searchParamsLocalNames(ir.metadata)
|
|
286
299
|
this._loweringMatchers = prepareLoweringMatchers(ir.metadata)
|
|
287
300
|
this.localConstants = ir.metadata.localConstants ?? []
|
|
301
|
+
this.importAliases = buildImportAliasMap(ir.metadata.imports ?? [])
|
|
288
302
|
this.scope = BindingScope.EMPTY
|
|
289
303
|
this.errors = []
|
|
290
304
|
this.childrenCaptureCounter = 0
|
|
@@ -1257,8 +1271,12 @@ export class MojoAdapter extends BaseAdapter implements IRNodeEmitter<MojoRender
|
|
|
1257
1271
|
private presenceVarCounter = 0
|
|
1258
1272
|
|
|
1259
1273
|
private toTemplateName(componentName: string): string {
|
|
1274
|
+
// Resolve an import alias (`import { Foo as Bar }`, `<Bar/>`) back to
|
|
1275
|
+
// the child's own declared name BEFORE snake-casing (#2822) — `Bar`
|
|
1276
|
+
// has no `foo.tsx`-registered partial; only `Foo` does.
|
|
1277
|
+
const declaredName = this.importAliases.get(componentName) ?? componentName
|
|
1260
1278
|
// Convert PascalCase to snake_case for Mojo template naming
|
|
1261
|
-
return
|
|
1279
|
+
return declaredName
|
|
1262
1280
|
.replace(/([A-Z])/g, '_$1')
|
|
1263
1281
|
.toLowerCase()
|
|
1264
1282
|
.replace(/^_/, '')
|
package/src/conformance-pins.ts
CHANGED
|
@@ -56,4 +56,11 @@ export const conformancePins: ConformancePins = {
|
|
|
56
56
|
// `rich-prop-client-read` above.
|
|
57
57
|
'jsx-element-prop-ternary': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
|
|
58
58
|
'jsx-element-prop-array': [{ code: 'BF021', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2667' }],
|
|
59
|
+
// #2771: a reactive primitive invoked through a namespace import
|
|
60
|
+
// (`import * as bf from '@barefootjs/client'`, `bf.createSignal(...)`)
|
|
61
|
+
// that the analyzer's checker-less fast path cannot recognize refuses
|
|
62
|
+
// loudly (BF013) instead of silently dropping the declaration — fired
|
|
63
|
+
// in the shared analyzer pass ahead of any adapter's `adapter.generate()`,
|
|
64
|
+
// so all nine adapters (including Hono) pin this identically.
|
|
65
|
+
'namespace-import-primitive': [{ code: 'BF013', severity: 'error', issue: 'https://github.com/piconic-ai/barefootjs/issues/2771' }],
|
|
59
66
|
}
|
|
@@ -28,4 +28,6 @@ import type { RenderDivergences } from '@barefootjs/jsx'
|
|
|
28
28
|
export const renderDivergences: RenderDivergences = {
|
|
29
29
|
'children-passthrough-renamed':
|
|
30
30
|
'A renamed `children` destructure emits the local alias as a template variable; the stash defines only `children`, so the Perl render dies (#2788).',
|
|
31
|
+
'aliased-loop-source':
|
|
32
|
+
'A `.map()` loop whose source is a local const alias of a signal getter (`const items__alias = items`) dies inside `Mojo::Template::process` on real Mojolicious — the seeded loop data is keyed by the signal\'s real name (`items`), and the alias hop is never resolved when deciding what to seed under `items__alias`. This is the SSR-side twin of #2778 (fixed for the CSR client-JS template in the same PR that added this fixture) — that fix only touches client-JS emission, not SSR data-seeding. Tracked at https://github.com/piconic-ai/barefootjs/issues/2813; graduate by resolving the alias hop at SSR-seeding time using the same `resolveAliasOrigin`/`resolveGetterAliases` mechanism #2778 introduced, rather than a third alias-hop walker.',
|
|
31
33
|
}
|