@barefootjs/cli 0.18.2 → 0.18.4

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.
Files changed (2) hide show
  1. package/dist/index.js +105 -8
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -2481,6 +2481,8 @@ var init_markers = __esm({
2481
2481
  function toHTMLAttrName(key) {
2482
2482
  if (key === "className") return "class";
2483
2483
  if (key === "htmlFor") return "for";
2484
+ const htmlAlias = HTML_CAMEL_ALIASES[key];
2485
+ if (htmlAlias !== void 0) return htmlAlias;
2484
2486
  const svgKebab = SVG_CAMEL_TO_KEBAB[key];
2485
2487
  if (svgKebab !== void 0) return svgKebab;
2486
2488
  return key;
@@ -2488,7 +2490,7 @@ function toHTMLAttrName(key) {
2488
2490
  function isBooleanAttr(name2) {
2489
2491
  return BOOLEAN_ATTRS.has(name2.toLowerCase());
2490
2492
  }
2491
- var BOOLEAN_ATTRS, SVG_CAMEL_TO_KEBAB;
2493
+ var BOOLEAN_ATTRS, SVG_CAMEL_TO_KEBAB, HTML_CAMEL_ALIASES;
2492
2494
  var init_dom_prop = __esm({
2493
2495
  "../shared/src/dom-prop.ts"() {
2494
2496
  "use strict";
@@ -2545,6 +2547,63 @@ var init_dom_prop = __esm({
2545
2547
  markerMid: "marker-mid",
2546
2548
  markerEnd: "marker-end"
2547
2549
  };
2550
+ HTML_CAMEL_ALIASES = {
2551
+ acceptCharset: "accept-charset",
2552
+ accessKey: "accesskey",
2553
+ allowFullScreen: "allowfullscreen",
2554
+ autoCapitalize: "autocapitalize",
2555
+ autoComplete: "autocomplete",
2556
+ autoCorrect: "autocorrect",
2557
+ autoFocus: "autofocus",
2558
+ autoPlay: "autoplay",
2559
+ cellPadding: "cellpadding",
2560
+ cellSpacing: "cellspacing",
2561
+ charSet: "charset",
2562
+ colSpan: "colspan",
2563
+ contentEditable: "contenteditable",
2564
+ controlsList: "controlslist",
2565
+ crossOrigin: "crossorigin",
2566
+ dateTime: "datetime",
2567
+ dirName: "dirname",
2568
+ encType: "enctype",
2569
+ enterKeyHint: "enterkeyhint",
2570
+ fetchPriority: "fetchpriority",
2571
+ formAction: "formaction",
2572
+ formEncType: "formenctype",
2573
+ formMethod: "formmethod",
2574
+ formNoValidate: "formnovalidate",
2575
+ formTarget: "formtarget",
2576
+ frameBorder: "frameborder",
2577
+ hrefLang: "hreflang",
2578
+ httpEquiv: "http-equiv",
2579
+ imageSizes: "imagesizes",
2580
+ imageSrcSet: "imagesrcset",
2581
+ inputMode: "inputmode",
2582
+ itemID: "itemid",
2583
+ itemProp: "itemprop",
2584
+ itemRef: "itemref",
2585
+ itemScope: "itemscope",
2586
+ itemType: "itemtype",
2587
+ marginHeight: "marginheight",
2588
+ marginWidth: "marginwidth",
2589
+ maxLength: "maxlength",
2590
+ minLength: "minlength",
2591
+ noModule: "nomodule",
2592
+ noValidate: "novalidate",
2593
+ playsInline: "playsinline",
2594
+ popoverTarget: "popovertarget",
2595
+ popoverTargetAction: "popovertargetaction",
2596
+ radioGroup: "radiogroup",
2597
+ readOnly: "readonly",
2598
+ referrerPolicy: "referrerpolicy",
2599
+ rowSpan: "rowspan",
2600
+ spellCheck: "spellcheck",
2601
+ srcDoc: "srcdoc",
2602
+ srcLang: "srclang",
2603
+ srcSet: "srcset",
2604
+ tabIndex: "tabindex",
2605
+ useMap: "usemap"
2606
+ };
2548
2607
  }
2549
2608
  });
2550
2609
 
@@ -7929,6 +7988,9 @@ function resolveFreeRefsInternal(node, env, visited) {
7929
7988
  }
7930
7989
  return out;
7931
7990
  }
7991
+ function isNameBound(name2, env) {
7992
+ return buildBindingMap(env).has(name2);
7993
+ }
7932
7994
  function resolveFreeRefs(node, env) {
7933
7995
  return resolveFreeRefsInternal(node, env, /* @__PURE__ */ new Set());
7934
7996
  }
@@ -8338,7 +8400,7 @@ function clientBuiltinTags(ctx2) {
8338
8400
  ctx2._clientBuiltinTags = map;
8339
8401
  return map;
8340
8402
  }
8341
- function isNameBound(ctx2, name2) {
8403
+ function isNameBound2(ctx2, name2) {
8342
8404
  const a = ctx2.analyzer;
8343
8405
  if (a.ambientGlobals.has(name2)) return true;
8344
8406
  if (a.localFunctions.some((f) => f.name === name2)) return true;
@@ -8371,7 +8433,7 @@ function dispatchClientBuiltin(tagName2, ctx2, diagNode, transformAsync, transfo
8371
8433
  const builtin = clientBuiltinTags(ctx2).get(tagName2);
8372
8434
  if (builtin === "Async") return transformAsync();
8373
8435
  if (builtin === "Region") return transformRegion();
8374
- if (isClientBuiltinName(tagName2) && !isNameBound(ctx2, tagName2)) {
8436
+ if (isClientBuiltinName(tagName2) && !isNameBound2(ctx2, tagName2)) {
8375
8437
  reportBuiltinNotImported(ctx2, diagNode, tagName2);
8376
8438
  }
8377
8439
  return null;
@@ -8700,6 +8762,13 @@ function transformChildren(children2, ctx2) {
8700
8762
  }
8701
8763
  return result2;
8702
8764
  }
8765
+ function isRenderNothingLiteral(expr, ctx2) {
8766
+ let e = expr;
8767
+ while (ts11.isParenthesizedExpression(e) || ts11.isAsExpression(e) || ts11.isSatisfiesExpression(e) || ts11.isNonNullExpression(e)) {
8768
+ e = e.expression;
8769
+ }
8770
+ return e.kind === ts11.SyntaxKind.NullKeyword || e.kind === ts11.SyntaxKind.TrueKeyword || e.kind === ts11.SyntaxKind.FalseKeyword || ts11.isIdentifier(e) && e.text === "undefined" && !isNameBound("undefined", makeBindingEnv(ctx2));
8771
+ }
8703
8772
  function transformText(node, ctx2) {
8704
8773
  const text = node.text.replace(/\s+/g, " ");
8705
8774
  if (text.trim() === "") {
@@ -8719,6 +8788,9 @@ function transformExpression(node, ctx2) {
8719
8788
  }
8720
8789
  function transformExpressionInner(expr, ctx2, node, isClientOnly) {
8721
8790
  expr = tryDesugarInterleaveTaggedTemplate(expr, ctx2);
8791
+ if (isRenderNothingLiteral(expr, ctx2)) {
8792
+ return null;
8793
+ }
8722
8794
  checkBareSignalOrMemoIdentifier(expr, ctx2);
8723
8795
  if (ts11.isIdentifier(expr)) {
8724
8796
  const jsxNode = ctx2.analyzer.jsxConstants.get(expr.text);
@@ -10202,27 +10274,28 @@ function processAttributes(attributes2, ctx2) {
10202
10274
  continue;
10203
10275
  }
10204
10276
  if (!ts11.isJsxAttribute(attr)) continue;
10205
- const name2 = attr.name.getText(ctx2.sourceFile);
10206
- if (name2 === "ref") {
10277
+ const rawName = attr.name.getText(ctx2.sourceFile);
10278
+ if (rawName === "ref") {
10207
10279
  if (attr.initializer && ts11.isJsxExpression(attr.initializer) && attr.initializer.expression) {
10208
10280
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx2);
10209
10281
  ref = ctx2.getJS(attr.initializer.expression);
10210
10282
  }
10211
10283
  continue;
10212
10284
  }
10213
- if (/^on[A-Z]/.test(name2)) {
10285
+ if (/^on[A-Z]/.test(rawName)) {
10214
10286
  if (attr.initializer && ts11.isJsxExpression(attr.initializer) && attr.initializer.expression) {
10215
- const eventName = name2.slice(2).toLowerCase();
10287
+ const eventName = rawName.slice(2).toLowerCase();
10216
10288
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx2);
10217
10289
  events.push({
10218
10290
  name: eventName,
10219
- originalAttr: name2,
10291
+ originalAttr: rawName,
10220
10292
  handler: ctx2.getJS(attr.initializer.expression),
10221
10293
  loc: getSourceLocation(attr, ctx2.sourceFile, ctx2.filePath)
10222
10294
  });
10223
10295
  }
10224
10296
  continue;
10225
10297
  }
10298
+ const name2 = toHTMLAttrName(rawName);
10226
10299
  let value2 = getAttributeValue(attr, ctx2);
10227
10300
  let clientOnly;
10228
10301
  if (attr.initializer && ts11.isJsxExpression(attr.initializer) && attr.initializer.expression) {
@@ -11037,6 +11110,7 @@ var init_jsx_to_ir = __esm({
11037
11110
  init_component_scope();
11038
11111
  init_analyzer();
11039
11112
  init_js_scanner();
11113
+ init_src();
11040
11114
  CLIENT_DIRECTIVE_INTERIOR_RE2 = /^\s*@client\s*$/;
11041
11115
  BLOCK_COMMENT_RE2 = /\/\*([\s\S]*?)\*\//g;
11042
11116
  constInitializerCache = /* @__PURE__ */ new WeakMap();
@@ -20206,6 +20280,26 @@ export default ${this.componentName}` : "";
20206
20280
  });
20207
20281
 
20208
20282
  // ../jsx/src/adapters/parsed-expr-emitter.ts
20283
+ function isStringTypedOperand(expr, isStringName) {
20284
+ if (expr.kind === "literal" && expr.literalType === "string") return true;
20285
+ if (expr.kind === "template-literal") return true;
20286
+ if (expr.kind === "call" && expr.callee.kind === "identifier" && expr.args.length === 0) {
20287
+ return isStringName(expr.callee.name);
20288
+ }
20289
+ if (expr.kind === "member" && expr.object.kind === "identifier" && expr.object.name === "props") {
20290
+ return isStringName(expr.property);
20291
+ }
20292
+ if (expr.kind === "binary" && expr.op === "+") {
20293
+ return isStringTypedOperand(expr.left, isStringName) || isStringTypedOperand(expr.right, isStringName);
20294
+ }
20295
+ return false;
20296
+ }
20297
+ function isStringConcatBinary(op, left, right, isStringName) {
20298
+ return op === "+" && (isStringTypedOperand(left, isStringName) || isStringTypedOperand(right, isStringName));
20299
+ }
20300
+ function groupBinaryOperand(operand, emitted) {
20301
+ return operand.kind === "binary" || operand.kind === "logical" || operand.kind === "conditional" ? `(${emitted})` : emitted;
20302
+ }
20209
20303
  function emitParsedExpr(expr, emitter) {
20210
20304
  const emit = (child) => emitParsedExpr(child, emitter);
20211
20305
  switch (expr.kind) {
@@ -23300,11 +23394,14 @@ __export(src_exports, {
23300
23394
  getCompilerCounters: () => getCompilerCounters,
23301
23395
  getLoweringPlugins: () => getLoweringPlugins,
23302
23396
  graphToJSON: () => graphToJSON,
23397
+ groupBinaryOperand: () => groupBinaryOperand,
23303
23398
  identifierPath: () => identifierPath,
23304
23399
  importsSearchParams: () => importsSearchParams,
23305
23400
  isBooleanAttr: () => isBooleanAttr,
23306
23401
  isLowerableLoopDestructure: () => isLowerableLoopDestructure,
23307
23402
  isLowerableObjectRestDestructure: () => isLowerableObjectRestDestructure,
23403
+ isStringConcatBinary: () => isStringConcatBinary,
23404
+ isStringTypedOperand: () => isStringTypedOperand,
23308
23405
  isSupported: () => isSupported,
23309
23406
  isValidHelperId: () => isValidHelperId,
23310
23407
  joinProfilerEvents: () => joinProfilerEvents,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/cli",
3
- "version": "0.18.2",
3
+ "version": "0.18.4",
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.18.2",
33
- "@barefootjs/shared": "0.18.2"
32
+ "@barefootjs/client": "0.18.4",
33
+ "@barefootjs/shared": "0.18.4"
34
34
  },
35
35
  "devDependencies": {
36
- "@barefootjs/jsx": "0.18.2",
36
+ "@barefootjs/jsx": "0.18.4",
37
37
  "@types/node": "^22.0.0",
38
38
  "@happy-dom/global-registrator": "^20.0.11",
39
39
  "happy-dom": "^20.0.11"