@barefootjs/cli 0.18.3 → 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 +90 -6
  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
 
@@ -10215,27 +10274,28 @@ function processAttributes(attributes2, ctx2) {
10215
10274
  continue;
10216
10275
  }
10217
10276
  if (!ts11.isJsxAttribute(attr)) continue;
10218
- const name2 = attr.name.getText(ctx2.sourceFile);
10219
- if (name2 === "ref") {
10277
+ const rawName = attr.name.getText(ctx2.sourceFile);
10278
+ if (rawName === "ref") {
10220
10279
  if (attr.initializer && ts11.isJsxExpression(attr.initializer) && attr.initializer.expression) {
10221
10280
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx2);
10222
10281
  ref = ctx2.getJS(attr.initializer.expression);
10223
10282
  }
10224
10283
  continue;
10225
10284
  }
10226
- if (/^on[A-Z]/.test(name2)) {
10285
+ if (/^on[A-Z]/.test(rawName)) {
10227
10286
  if (attr.initializer && ts11.isJsxExpression(attr.initializer) && attr.initializer.expression) {
10228
- const eventName = name2.slice(2).toLowerCase();
10287
+ const eventName = rawName.slice(2).toLowerCase();
10229
10288
  reportJsxBranchLocalInCallback(attr.initializer.expression, ctx2);
10230
10289
  events.push({
10231
10290
  name: eventName,
10232
- originalAttr: name2,
10291
+ originalAttr: rawName,
10233
10292
  handler: ctx2.getJS(attr.initializer.expression),
10234
10293
  loc: getSourceLocation(attr, ctx2.sourceFile, ctx2.filePath)
10235
10294
  });
10236
10295
  }
10237
10296
  continue;
10238
10297
  }
10298
+ const name2 = toHTMLAttrName(rawName);
10239
10299
  let value2 = getAttributeValue(attr, ctx2);
10240
10300
  let clientOnly;
10241
10301
  if (attr.initializer && ts11.isJsxExpression(attr.initializer) && attr.initializer.expression) {
@@ -11050,6 +11110,7 @@ var init_jsx_to_ir = __esm({
11050
11110
  init_component_scope();
11051
11111
  init_analyzer();
11052
11112
  init_js_scanner();
11113
+ init_src();
11053
11114
  CLIENT_DIRECTIVE_INTERIOR_RE2 = /^\s*@client\s*$/;
11054
11115
  BLOCK_COMMENT_RE2 = /\/\*([\s\S]*?)\*\//g;
11055
11116
  constInitializerCache = /* @__PURE__ */ new WeakMap();
@@ -20219,6 +20280,26 @@ export default ${this.componentName}` : "";
20219
20280
  });
20220
20281
 
20221
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
+ }
20222
20303
  function emitParsedExpr(expr, emitter) {
20223
20304
  const emit = (child) => emitParsedExpr(child, emitter);
20224
20305
  switch (expr.kind) {
@@ -23313,11 +23394,14 @@ __export(src_exports, {
23313
23394
  getCompilerCounters: () => getCompilerCounters,
23314
23395
  getLoweringPlugins: () => getLoweringPlugins,
23315
23396
  graphToJSON: () => graphToJSON,
23397
+ groupBinaryOperand: () => groupBinaryOperand,
23316
23398
  identifierPath: () => identifierPath,
23317
23399
  importsSearchParams: () => importsSearchParams,
23318
23400
  isBooleanAttr: () => isBooleanAttr,
23319
23401
  isLowerableLoopDestructure: () => isLowerableLoopDestructure,
23320
23402
  isLowerableObjectRestDestructure: () => isLowerableObjectRestDestructure,
23403
+ isStringConcatBinary: () => isStringConcatBinary,
23404
+ isStringTypedOperand: () => isStringTypedOperand,
23321
23405
  isSupported: () => isSupported,
23322
23406
  isValidHelperId: () => isValidHelperId,
23323
23407
  joinProfilerEvents: () => joinProfilerEvents,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/cli",
3
- "version": "0.18.3",
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.3",
33
- "@barefootjs/shared": "0.18.3"
32
+ "@barefootjs/client": "0.18.4",
33
+ "@barefootjs/shared": "0.18.4"
34
34
  },
35
35
  "devDependencies": {
36
- "@barefootjs/jsx": "0.18.3",
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"