@barefootjs/cli 0.24.1 → 0.25.0
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/index.js +198 -60
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5453,7 +5453,8 @@ var init_errors = __esm({
|
|
|
5453
5453
|
UNRECOGNIZED_REACTIVE_FACTORY: "BF110",
|
|
5454
5454
|
REACTIVE_FACTORY_RENAME_UNSUPPORTED: "BF111",
|
|
5455
5455
|
REACTIVE_FACTORY_MODULE_CAPTURE: "BF112",
|
|
5456
|
-
REACTIVE_FACTORY_IMPORT_COLLISION: "BF113"
|
|
5456
|
+
REACTIVE_FACTORY_IMPORT_COLLISION: "BF113",
|
|
5457
|
+
REACTIVE_FACTORY_PARAM_SHADOWED: "BF114"
|
|
5457
5458
|
};
|
|
5458
5459
|
errorMessages = {
|
|
5459
5460
|
[ErrorCodes.MISSING_USE_CLIENT]: "'use client' directive required for components with createSignal or event handlers",
|
|
@@ -5488,7 +5489,8 @@ var init_errors = __esm({
|
|
|
5488
5489
|
[ErrorCodes.UNRECOGNIZED_REACTIVE_FACTORY]: "Tuple destructuring of a non-reactive factory call. The compiler only recognizes createSignal / createMemo calls and same-file helpers that wrap them with a single `return [a, b]` exit.",
|
|
5489
5490
|
[ErrorCodes.REACTIVE_FACTORY_RENAME_UNSUPPORTED]: "Reactive factory object return/destructure must use shorthand properties only. Property renames (`{ lists: myLists }`), defaults, and rest elements are not supported \u2014 destructure with the factory's own property names.",
|
|
5490
5491
|
[ErrorCodes.REACTIVE_FACTORY_MODULE_CAPTURE]: "Imported reactive factory references bindings from its own module scope, so its body cannot be inlined into the component file. Move those helpers into the component file, pass them to the factory as parameters, or define the factory in the component file.",
|
|
5491
|
-
[ErrorCodes.REACTIVE_FACTORY_IMPORT_COLLISION]: "Inlining an imported reactive factory requires re-importing one of its helper imports into this file, but that name is already bound here to something else. Rename the conflicting binding in this file, or alias the import in the factory's own file."
|
|
5492
|
+
[ErrorCodes.REACTIVE_FACTORY_IMPORT_COLLISION]: "Inlining an imported reactive factory requires re-importing one of its helper imports into this file, but that name is already bound here to something else. Rename the conflicting binding in this file, or alias the import in the factory's own file.",
|
|
5493
|
+
[ErrorCodes.REACTIVE_FACTORY_PARAM_SHADOWED]: "Reactive factory parameter is shadowed by a nested declaration inside the factory body, so argument substitution at the inline site would be ambiguous. Rename the inner binding so it does not collide with the parameter."
|
|
5492
5494
|
};
|
|
5493
5495
|
InternalInvariantError = class extends Error {
|
|
5494
5496
|
constructor(message) {
|
|
@@ -7832,33 +7834,27 @@ function prescanImportedReactiveFactories(entrySourceFile, filePath, result2) {
|
|
|
7832
7834
|
const entryBindingNames = collectEntryBindingNames(entrySourceFile);
|
|
7833
7835
|
const entryImportIndex = buildEntryImportIndex(entrySourceFile, filePath);
|
|
7834
7836
|
const plannedInjections = /* @__PURE__ */ new Map();
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7837
|
+
const helperCache = /* @__PURE__ */ new Map();
|
|
7838
|
+
function loadHelperFile(abs) {
|
|
7839
|
+
const cached = helperCache.get(abs);
|
|
7840
|
+
if (cached !== void 0) return cached;
|
|
7838
7841
|
let content2;
|
|
7839
7842
|
try {
|
|
7840
|
-
content2 = fs.readFileSync(
|
|
7843
|
+
content2 = fs.readFileSync(abs, "utf8");
|
|
7841
7844
|
} catch {
|
|
7842
|
-
|
|
7845
|
+
helperCache.set(abs, null);
|
|
7846
|
+
return null;
|
|
7843
7847
|
}
|
|
7844
|
-
const alreadyKnown = (name2) => result2.factories.has(name2) || result2.declined.has(name2) || result2.reactiveShaped.has(name2);
|
|
7845
7848
|
const hasAnyPrimitiveText = [...REACTIVE_PRIMITIVES].some((p) => content2.includes(p));
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
continue;
|
|
7849
|
+
const hasReexportText = content2.includes("export") && content2.includes("from");
|
|
7850
|
+
if (!hasAnyPrimitiveText && !hasReexportText) {
|
|
7851
|
+
helperCache.set(abs, "clean");
|
|
7852
|
+
return "clean";
|
|
7851
7853
|
}
|
|
7852
|
-
const
|
|
7853
|
-
resolved + ".prescan",
|
|
7854
|
-
content2,
|
|
7855
|
-
ts8.ScriptTarget.Latest,
|
|
7856
|
-
true,
|
|
7857
|
-
ts8.ScriptKind.TSX
|
|
7858
|
-
);
|
|
7854
|
+
const sf = ts8.createSourceFile(abs + ".prescan", content2, ts8.ScriptTarget.Latest, true, ts8.ScriptKind.TSX);
|
|
7859
7855
|
const localFns = /* @__PURE__ */ new Map();
|
|
7860
7856
|
const exportedFns = /* @__PURE__ */ new Map();
|
|
7861
|
-
for (const stmt of
|
|
7857
|
+
for (const stmt of sf.statements) {
|
|
7862
7858
|
if (ts8.isFunctionDeclaration(stmt) && stmt.name && stmt.body) {
|
|
7863
7859
|
localFns.set(stmt.name.text, stmt);
|
|
7864
7860
|
const hasExportModifier = stmt.modifiers?.some((m) => m.kind === ts8.SyntaxKind.ExportKeyword) ?? false;
|
|
@@ -7868,24 +7864,73 @@ function prescanImportedReactiveFactories(entrySourceFile, filePath, result2) {
|
|
|
7868
7864
|
}
|
|
7869
7865
|
}
|
|
7870
7866
|
}
|
|
7871
|
-
|
|
7872
|
-
|
|
7867
|
+
const reexports = /* @__PURE__ */ new Map();
|
|
7868
|
+
let hasStarReexport = false;
|
|
7869
|
+
for (const stmt of sf.statements) {
|
|
7870
|
+
if (!ts8.isExportDeclaration(stmt) || stmt.isTypeOnly) continue;
|
|
7871
|
+
if (!stmt.moduleSpecifier) {
|
|
7872
|
+
if (stmt.exportClause && ts8.isNamedExports(stmt.exportClause)) {
|
|
7873
|
+
for (const el of stmt.exportClause.elements) {
|
|
7874
|
+
if (el.isTypeOnly) continue;
|
|
7875
|
+
const fn = localFns.get((el.propertyName ?? el.name).text);
|
|
7876
|
+
if (fn) exportedFns.set(el.name.text, fn);
|
|
7877
|
+
}
|
|
7878
|
+
}
|
|
7879
|
+
continue;
|
|
7880
|
+
}
|
|
7881
|
+
if (!ts8.isStringLiteral(stmt.moduleSpecifier)) continue;
|
|
7882
|
+
if (stmt.exportClause && ts8.isNamedExports(stmt.exportClause)) {
|
|
7873
7883
|
for (const el of stmt.exportClause.elements) {
|
|
7874
7884
|
if (el.isTypeOnly) continue;
|
|
7875
|
-
|
|
7876
|
-
|
|
7885
|
+
reexports.set(el.name.text, {
|
|
7886
|
+
source: stmt.moduleSpecifier.text,
|
|
7887
|
+
innerName: (el.propertyName ?? el.name).text
|
|
7888
|
+
});
|
|
7877
7889
|
}
|
|
7878
|
-
}
|
|
7879
|
-
|
|
7880
|
-
|
|
7890
|
+
} else if (!stmt.exportClause) {
|
|
7891
|
+
hasStarReexport = true;
|
|
7892
|
+
}
|
|
7893
|
+
}
|
|
7894
|
+
const moduleBindings = collectHelperModuleValueBindings(sf);
|
|
7895
|
+
const info = { sf, exportedFns, reexports, hasStarReexport, moduleBindings };
|
|
7896
|
+
helperCache.set(abs, info);
|
|
7897
|
+
return info;
|
|
7898
|
+
}
|
|
7899
|
+
function lookupExportedFactory(abs, exportedName, visited, hopsLeft) {
|
|
7900
|
+
if (visited.has(abs)) return { kind: "unknown" };
|
|
7901
|
+
visited.add(abs);
|
|
7902
|
+
const file = loadHelperFile(abs);
|
|
7903
|
+
if (file === null) return { kind: "unknown" };
|
|
7904
|
+
if (file === "clean") return { kind: "clean" };
|
|
7905
|
+
const fn = file.exportedFns.get(exportedName);
|
|
7906
|
+
if (fn) return { kind: "fn", fn, file, definingPath: abs };
|
|
7907
|
+
const re = file.reexports.get(exportedName);
|
|
7908
|
+
if (re) {
|
|
7909
|
+
if (hopsLeft <= 0) return { kind: "unknown" };
|
|
7910
|
+
if (!re.source.startsWith("./") && !re.source.startsWith("../")) return { kind: "unknown" };
|
|
7911
|
+
const target2 = resolveRelativeImportToFile(re.source, abs);
|
|
7912
|
+
if (!target2) return { kind: "unknown" };
|
|
7913
|
+
return lookupExportedFactory(target2, re.innerName, visited, hopsLeft - 1);
|
|
7914
|
+
}
|
|
7915
|
+
if (file.hasStarReexport) return { kind: "unknown" };
|
|
7916
|
+
return { kind: "clean" };
|
|
7917
|
+
}
|
|
7918
|
+
for (const { src, specs } of importsToCheck) {
|
|
7919
|
+
const resolved = resolveRelativeImportToFile(src, filePath);
|
|
7920
|
+
if (!resolved) continue;
|
|
7921
|
+
const alreadyKnown = (name2) => result2.factories.has(name2) || result2.declined.has(name2) || result2.reactiveShaped.has(name2);
|
|
7881
7922
|
for (const spec of specs) {
|
|
7882
7923
|
if (alreadyKnown(spec.local)) continue;
|
|
7883
|
-
const
|
|
7884
|
-
if (
|
|
7924
|
+
const found = lookupExportedFactory(resolved, spec.exported, /* @__PURE__ */ new Set(), MAX_REEXPORT_HOPS);
|
|
7925
|
+
if (found.kind === "clean") {
|
|
7885
7926
|
result2.cleanFactoryImports.add(spec.local);
|
|
7886
7927
|
continue;
|
|
7887
7928
|
}
|
|
7888
|
-
|
|
7929
|
+
if (found.kind === "unknown") continue;
|
|
7930
|
+
const { fn, file, definingPath } = found;
|
|
7931
|
+
const helperSf = file.sf;
|
|
7932
|
+
const moduleBindings = file.moduleBindings;
|
|
7933
|
+
const det = detectReactiveFactory(fn, helperSf, definingPath);
|
|
7889
7934
|
if (!det) {
|
|
7890
7935
|
result2.cleanFactoryImports.add(spec.local);
|
|
7891
7936
|
continue;
|
|
@@ -7914,7 +7959,7 @@ function prescanImportedReactiveFactories(entrySourceFile, filePath, result2) {
|
|
|
7914
7959
|
let specifier;
|
|
7915
7960
|
let targetKey;
|
|
7916
7961
|
if (ref.source.startsWith("./") || ref.source.startsWith("../")) {
|
|
7917
|
-
const abs = resolveRelativeImportToFile(ref.source,
|
|
7962
|
+
const abs = resolveRelativeImportToFile(ref.source, definingPath);
|
|
7918
7963
|
if (!abs) {
|
|
7919
7964
|
declinedEntry = {
|
|
7920
7965
|
code: "BF112",
|
|
@@ -7951,7 +7996,7 @@ function prescanImportedReactiveFactories(entrySourceFile, filePath, result2) {
|
|
|
7951
7996
|
break;
|
|
7952
7997
|
}
|
|
7953
7998
|
for (const [name2, id2] of pending) plannedInjections.set(name2, id2);
|
|
7954
|
-
det.info.sourceFilePath =
|
|
7999
|
+
det.info.sourceFilePath = definingPath;
|
|
7955
8000
|
if (required.length > 0) det.info.requiredImports = required;
|
|
7956
8001
|
result2.factories.set(spec.local, det.info);
|
|
7957
8002
|
break;
|
|
@@ -8033,6 +8078,16 @@ function detectReactiveFactory(node, sourceFile, filePath) {
|
|
|
8033
8078
|
checkForReactive(node.body);
|
|
8034
8079
|
if (!hasReactiveCall) return null;
|
|
8035
8080
|
const loc = getSourceLocation(node, sourceFile, filePath);
|
|
8081
|
+
let totalReturnCount = 0;
|
|
8082
|
+
function countReturns(n) {
|
|
8083
|
+
if (ts8.isFunctionLike(n)) return;
|
|
8084
|
+
if (ts8.isReturnStatement(n)) {
|
|
8085
|
+
totalReturnCount++;
|
|
8086
|
+
return;
|
|
8087
|
+
}
|
|
8088
|
+
ts8.forEachChild(n, countReturns);
|
|
8089
|
+
}
|
|
8090
|
+
ts8.forEachChild(node.body, countReturns);
|
|
8036
8091
|
let returnExpr = null;
|
|
8037
8092
|
let returnCount = 0;
|
|
8038
8093
|
for (const stmt of node.body.statements) {
|
|
@@ -8045,7 +8100,7 @@ function detectReactiveFactory(node, sourceFile, filePath) {
|
|
|
8045
8100
|
if (ts8.isTypeAssertionExpression(expr)) expr = expr.expression;
|
|
8046
8101
|
returnExpr = expr;
|
|
8047
8102
|
}
|
|
8048
|
-
if (returnCount !== 1 || !returnExpr) return { kind: "reactive-shaped" };
|
|
8103
|
+
if (totalReturnCount !== 1 || returnCount !== 1 || !returnExpr) return { kind: "reactive-shaped" };
|
|
8049
8104
|
const returnTupleIdentifiers = [];
|
|
8050
8105
|
let returnKind;
|
|
8051
8106
|
if (ts8.isArrayLiteralExpression(returnExpr)) {
|
|
@@ -8075,6 +8130,14 @@ function detectReactiveFactory(node, sourceFile, filePath) {
|
|
|
8075
8130
|
} else {
|
|
8076
8131
|
return { kind: "reactive-shaped" };
|
|
8077
8132
|
}
|
|
8133
|
+
const params = [];
|
|
8134
|
+
for (const p of node.parameters) {
|
|
8135
|
+
if (ts8.isIdentifier(p.name)) {
|
|
8136
|
+
params.push(p.name.text);
|
|
8137
|
+
continue;
|
|
8138
|
+
}
|
|
8139
|
+
return { kind: "reactive-shaped" };
|
|
8140
|
+
}
|
|
8078
8141
|
const localBindings = [];
|
|
8079
8142
|
for (const stmt of node.body.statements) {
|
|
8080
8143
|
if (ts8.isVariableStatement(stmt)) {
|
|
@@ -8085,14 +8148,83 @@ function detectReactiveFactory(node, sourceFile, filePath) {
|
|
|
8085
8148
|
localBindings.push(stmt.name.text);
|
|
8086
8149
|
}
|
|
8087
8150
|
}
|
|
8088
|
-
const
|
|
8089
|
-
const
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8151
|
+
const relevantNames = /* @__PURE__ */ new Set([...params, ...localBindings, ...returnTupleIdentifiers]);
|
|
8152
|
+
const renameSites = [];
|
|
8153
|
+
let shadowedParam = null;
|
|
8154
|
+
function collectRenameSites(root2, toBodyOffset) {
|
|
8155
|
+
function push(id2, form) {
|
|
8156
|
+
renameSites.push({
|
|
8157
|
+
name: id2.text,
|
|
8158
|
+
start: toBodyOffset(id2.getStart(sourceFile)),
|
|
8159
|
+
end: toBodyOffset(id2.getEnd()),
|
|
8160
|
+
form
|
|
8161
|
+
});
|
|
8162
|
+
}
|
|
8163
|
+
function classify3(id2) {
|
|
8164
|
+
if (!relevantNames.has(id2.text)) return;
|
|
8165
|
+
const p = id2.parent;
|
|
8166
|
+
if (ts8.isPropertyAccessExpression(p) && p.name === id2) return;
|
|
8167
|
+
if (ts8.isPropertyAssignment(p) && p.name === id2) return;
|
|
8168
|
+
if (ts8.isBindingElement(p) && p.propertyName === id2) return;
|
|
8169
|
+
if ((ts8.isMethodDeclaration(p) || ts8.isGetAccessorDeclaration(p) || ts8.isSetAccessorDeclaration(p) || ts8.isPropertyDeclaration(p) || ts8.isEnumMember(p)) && p.name === id2) return;
|
|
8170
|
+
if (ts8.isJsxAttribute(p) && p.name === id2) return;
|
|
8171
|
+
if (ts8.isLabeledStatement(p) && p.label === id2 || (ts8.isBreakStatement(p) || ts8.isContinueStatement(p)) && p.label === id2) return;
|
|
8172
|
+
if ((ts8.isJsxOpeningElement(p) || ts8.isJsxSelfClosingElement(p) || ts8.isJsxClosingElement(p)) && p.tagName === id2 && /^[a-z]/.test(id2.text)) return;
|
|
8173
|
+
if (ts8.isShorthandPropertyAssignment(p) && p.name === id2) {
|
|
8174
|
+
push(id2, "shorthand");
|
|
8175
|
+
return;
|
|
8176
|
+
}
|
|
8177
|
+
if (ts8.isBindingElement(p) && p.name === id2 && !p.propertyName && ts8.isObjectBindingPattern(p.parent)) {
|
|
8178
|
+
if (params.includes(id2.text)) shadowedParam = id2.text;
|
|
8179
|
+
push(id2, "shorthand");
|
|
8180
|
+
return;
|
|
8181
|
+
}
|
|
8182
|
+
const isDecl = (ts8.isVariableDeclaration(p) || ts8.isParameter(p) || ts8.isBindingElement(p) || ts8.isFunctionDeclaration(p) || ts8.isFunctionExpression(p) || ts8.isClassDeclaration(p) || ts8.isClassExpression(p)) && p.name === id2;
|
|
8183
|
+
if (isDecl && params.includes(id2.text)) shadowedParam = id2.text;
|
|
8184
|
+
push(id2, "plain");
|
|
8185
|
+
}
|
|
8186
|
+
function visit3(n) {
|
|
8187
|
+
if (ts8.isTypeNode(n) || ts8.isTypeParameterDeclaration(n) || ts8.isTypeAliasDeclaration(n) || ts8.isInterfaceDeclaration(n)) return;
|
|
8188
|
+
if (ts8.isIdentifier(n)) {
|
|
8189
|
+
classify3(n);
|
|
8190
|
+
return;
|
|
8191
|
+
}
|
|
8192
|
+
ts8.forEachChild(n, visit3);
|
|
8193
|
+
}
|
|
8194
|
+
visit3(root2);
|
|
8195
|
+
}
|
|
8196
|
+
const keptStatements = node.body.statements.filter((s) => !ts8.isReturnStatement(s));
|
|
8197
|
+
const pieces = [];
|
|
8198
|
+
let base = 0;
|
|
8199
|
+
for (const stmt of keptStatements) {
|
|
8200
|
+
const text = stmt.getText(sourceFile);
|
|
8201
|
+
const stmtStart = stmt.getStart(sourceFile);
|
|
8202
|
+
collectRenameSites(stmt, (pos) => pos - stmtStart + base);
|
|
8203
|
+
pieces.push(text);
|
|
8204
|
+
base += text.length + 1;
|
|
8205
|
+
}
|
|
8206
|
+
const bodyStatements = pieces.join("\n");
|
|
8207
|
+
if (shadowedParam !== null) {
|
|
8208
|
+
return {
|
|
8209
|
+
kind: "declined",
|
|
8210
|
+
declined: {
|
|
8211
|
+
code: "BF114",
|
|
8212
|
+
detail: `parameter '${shadowedParam}' of '${node.name.text}' is shadowed by a nested declaration inside the factory body`,
|
|
8213
|
+
loc
|
|
8214
|
+
}
|
|
8215
|
+
};
|
|
8216
|
+
}
|
|
8217
|
+
for (const site of renameSites) {
|
|
8218
|
+
if (bodyStatements.slice(site.start, site.end) !== site.name) {
|
|
8219
|
+
return {
|
|
8220
|
+
kind: "declined",
|
|
8221
|
+
declined: {
|
|
8222
|
+
code: "BF111",
|
|
8223
|
+
detail: `internal rename-site offset mismatch for '${site.name}' \u2014 this is a compiler bug, please report it`,
|
|
8224
|
+
loc
|
|
8225
|
+
}
|
|
8226
|
+
};
|
|
8094
8227
|
}
|
|
8095
|
-
return { kind: "reactive-shaped" };
|
|
8096
8228
|
}
|
|
8097
8229
|
return {
|
|
8098
8230
|
kind: "factory",
|
|
@@ -8102,7 +8234,8 @@ function detectReactiveFactory(node, sourceFile, filePath) {
|
|
|
8102
8234
|
returnTupleIdentifiers,
|
|
8103
8235
|
returnKind,
|
|
8104
8236
|
localBindings,
|
|
8105
|
-
loc
|
|
8237
|
+
loc,
|
|
8238
|
+
renameSites
|
|
8106
8239
|
}
|
|
8107
8240
|
};
|
|
8108
8241
|
}
|
|
@@ -8189,23 +8322,28 @@ function rewriteFactoryCallsInSource(source, prescan) {
|
|
|
8189
8322
|
const argTexts = args2.map((a) => a.getText(sourceFile));
|
|
8190
8323
|
const thisCallIndex = callSiteIndex++;
|
|
8191
8324
|
const suffix = `_bf${thisCallIndex}`;
|
|
8192
|
-
|
|
8193
|
-
const
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8325
|
+
const renames = /* @__PURE__ */ new Map();
|
|
8326
|
+
for (const name2 of factory.localBindings) {
|
|
8327
|
+
if (!excludeFromSuffixRename.has(name2)) renames.set(name2, name2 + suffix);
|
|
8328
|
+
}
|
|
8329
|
+
if (renameReturnToCallerNames) {
|
|
8330
|
+
for (const [n, caller] of renameReturnToCallerNames) {
|
|
8331
|
+
if (caller !== n) renames.set(n, caller);
|
|
8332
|
+
}
|
|
8197
8333
|
}
|
|
8198
8334
|
const atomicArg = /^(?:[\w$.]+|'[^'\\]*'|"[^"\\]*"|-?\d+(?:\.\d+)?)$/;
|
|
8199
8335
|
for (let i = 0; i < factory.params.length; i++) {
|
|
8200
8336
|
const p = factory.params[i];
|
|
8201
|
-
const a = argTexts[i] ?? "undefined";
|
|
8202
|
-
|
|
8203
|
-
body2 = body2.replace(new RegExp(`\\b${escapeRegex(p)}\\b`, "g"), wrapped);
|
|
8337
|
+
const a = (argTexts[i] ?? "undefined").trim();
|
|
8338
|
+
renames.set(p, atomicArg.test(a) ? a : `(${a})`);
|
|
8204
8339
|
}
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8340
|
+
let body2 = factory.bodySource;
|
|
8341
|
+
for (let i = factory.renameSites.length - 1; i >= 0; i--) {
|
|
8342
|
+
const site = factory.renameSites[i];
|
|
8343
|
+
const repl = renames.get(site.name);
|
|
8344
|
+
if (repl === void 0) continue;
|
|
8345
|
+
const text = site.form === "shorthand" ? `${site.name}: ${repl}` : repl;
|
|
8346
|
+
body2 = body2.slice(0, site.start) + text + body2.slice(site.end);
|
|
8209
8347
|
}
|
|
8210
8348
|
edits.push({
|
|
8211
8349
|
start: stmt.getStart(sourceFile),
|
|
@@ -8265,9 +8403,6 @@ function isPascalCaseComponentFn(node) {
|
|
|
8265
8403
|
}
|
|
8266
8404
|
return false;
|
|
8267
8405
|
}
|
|
8268
|
-
function escapeRegex(s) {
|
|
8269
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8270
|
-
}
|
|
8271
8406
|
function declinedFactoryMessage(callee, d) {
|
|
8272
8407
|
if (d.code === "BF112") {
|
|
8273
8408
|
return `Reactive factory '${callee}' references ${d.detail} from its own module scope and cannot be inlined. Move the referenced helper(s) into this file, pass them as factory arguments, or inline the factory here.`;
|
|
@@ -8283,6 +8418,8 @@ function declinedFactoryErrorCode(code) {
|
|
|
8283
8418
|
return ErrorCodes.REACTIVE_FACTORY_MODULE_CAPTURE;
|
|
8284
8419
|
case "BF113":
|
|
8285
8420
|
return ErrorCodes.REACTIVE_FACTORY_IMPORT_COLLISION;
|
|
8421
|
+
case "BF114":
|
|
8422
|
+
return ErrorCodes.REACTIVE_FACTORY_PARAM_SHADOWED;
|
|
8286
8423
|
default:
|
|
8287
8424
|
return ErrorCodes.REACTIVE_FACTORY_RENAME_UNSUPPORTED;
|
|
8288
8425
|
}
|
|
@@ -8403,7 +8540,7 @@ function validateObjectFactoryDestructure(ctx2, pattern, callee, loc) {
|
|
|
8403
8540
|
}));
|
|
8404
8541
|
}
|
|
8405
8542
|
}
|
|
8406
|
-
var REACTIVE_BRAND_PACKAGES, PRIMITIVE_CANONICAL_NAMES, ENV_SIGNAL_FACTORIES, CLIENT_EXPORTS, CLIENT_DIRECTIVE_INTERIOR_RE, BLOCK_COMMENT_RE, CLIENT_EXPORT_SIGNAL_RE, CLIENT_EXPORT_MEMO_RE, BROWSER_ONLY_CLIENT_APIS, REACTIVE_PRIMITIVES;
|
|
8543
|
+
var REACTIVE_BRAND_PACKAGES, PRIMITIVE_CANONICAL_NAMES, ENV_SIGNAL_FACTORIES, CLIENT_EXPORTS, CLIENT_DIRECTIVE_INTERIOR_RE, BLOCK_COMMENT_RE, CLIENT_EXPORT_SIGNAL_RE, CLIENT_EXPORT_MEMO_RE, BROWSER_ONLY_CLIENT_APIS, REACTIVE_PRIMITIVES, MAX_REEXPORT_HOPS;
|
|
8407
8544
|
var init_analyzer = __esm({
|
|
8408
8545
|
"../jsx/src/analyzer.ts"() {
|
|
8409
8546
|
"use strict";
|
|
@@ -8493,6 +8630,7 @@ var init_analyzer = __esm({
|
|
|
8493
8630
|
"onMount",
|
|
8494
8631
|
"onCleanup"
|
|
8495
8632
|
]);
|
|
8633
|
+
MAX_REEXPORT_HOPS = 1;
|
|
8496
8634
|
}
|
|
8497
8635
|
});
|
|
8498
8636
|
|
|
@@ -34818,7 +34956,7 @@ function patchBlock(css, openRe, overrides) {
|
|
|
34818
34956
|
let block = css.slice(blockStart, blockEnd);
|
|
34819
34957
|
const toAppend = [];
|
|
34820
34958
|
for (const [name2, value2] of Object.entries(overrides)) {
|
|
34821
|
-
const re = new RegExp(`(${
|
|
34959
|
+
const re = new RegExp(`(${escapeRegex(name2)}\\s*:\\s*)[^;]+(;)`);
|
|
34822
34960
|
if (re.test(block)) {
|
|
34823
34961
|
block = block.replace(re, `$1${value2}$2`);
|
|
34824
34962
|
} else {
|
|
@@ -34836,7 +34974,7 @@ ${lines}
|
|
|
34836
34974
|
}
|
|
34837
34975
|
return css.slice(0, blockStart) + block + css.slice(blockEnd);
|
|
34838
34976
|
}
|
|
34839
|
-
function
|
|
34977
|
+
function escapeRegex(s) {
|
|
34840
34978
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
34841
34979
|
}
|
|
34842
34980
|
function applyTokenOverrides(tokensJsonPath, config) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "CLI for agent-driven UI component discovery and scaffolding",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"esbuild": "^0.25.0",
|
|
31
31
|
"typescript": "^5.0.0",
|
|
32
|
-
"@barefootjs/client": "0.
|
|
33
|
-
"@barefootjs/shared": "0.
|
|
32
|
+
"@barefootjs/client": "0.25.0",
|
|
33
|
+
"@barefootjs/shared": "0.25.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@barefootjs/jsx": "0.
|
|
36
|
+
"@barefootjs/jsx": "0.25.0",
|
|
37
37
|
"@types/node": "^22.0.0",
|
|
38
38
|
"@happy-dom/global-registrator": "^20.0.11",
|
|
39
39
|
"happy-dom": "^20.0.11"
|