@barefootjs/cli 0.31.7 → 0.31.8

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 +9 -2
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -17135,6 +17135,13 @@ function csrInlinableConstantsFromCtx(ctx2) {
17135
17135
  }
17136
17136
  return out;
17137
17137
  }
17138
+ function buildTemplateDefPart(ctx2, templateHtml) {
17139
+ const envDecls = ctx2.signals.filter((s) => Boolean(s.envReader) && Boolean(s.envFactory)).map((s) => `const [${s.getter}] = ${s.envFactory}()`);
17140
+ if (envDecls.length === 0) {
17141
+ return `template: (${PROPS_PARAM}) => \`${templateHtml}\``;
17142
+ }
17143
+ return `template: (${PROPS_PARAM}) => { ${envDecls.join("; ")}; return \`${templateHtml}\` }`;
17144
+ }
17138
17145
  function emitRegistrationAndHydration(lines, ctx2, _ir, graph, inlinability) {
17139
17146
  const name2 = ctx2.componentName;
17140
17147
  lines.push(`}`);
@@ -17149,7 +17156,7 @@ function emitRegistrationAndHydration(lines, ctx2, _ir, graph, inlinability) {
17149
17156
  if (canGenerateStaticTemplate(_ir.root, propNamesForStaticCheck, inlinableConstants, unsafeLocalNames)) {
17150
17157
  const templateHtml = irToComponentTemplate(_ir.root, inlinableConstants, restSpreadNames, ctx2.propsObjectName);
17151
17158
  if (templateHtml) {
17152
- defParts.push(`template: (${PROPS_PARAM}) => \`${templateHtml}\``);
17159
+ defParts.push(buildTemplateDefPart(ctx2, templateHtml));
17153
17160
  }
17154
17161
  } else {
17155
17162
  const csrInlinableConstants = csrInlinableConstantsFromCtx(ctx2);
@@ -17163,7 +17170,7 @@ function emitRegistrationAndHydration(lines, ctx2, _ir, graph, inlinability) {
17163
17170
  ctx2.deferredChildSlots
17164
17171
  );
17165
17172
  if (templateHtml) {
17166
- defParts.push(`template: (${PROPS_PARAM}) => \`${templateHtml}\``);
17173
+ defParts.push(buildTemplateDefPart(ctx2, templateHtml));
17167
17174
  }
17168
17175
  }
17169
17176
  if (isCommentScope) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/cli",
3
- "version": "0.31.7",
3
+ "version": "0.31.8",
4
4
  "description": "CLI for agent-driven UI component discovery and scaffolding",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,12 +30,12 @@
30
30
  "esbuild": "^0.25.0",
31
31
  "typescript": "^5.0.0",
32
32
  "vite": "^6.0.0",
33
- "@barefootjs/client": "0.31.7",
34
- "@barefootjs/shared": "0.31.7"
33
+ "@barefootjs/client": "0.31.8",
34
+ "@barefootjs/shared": "0.31.8"
35
35
  },
36
36
  "devDependencies": {
37
- "@barefootjs/jsx": "0.31.7",
38
- "@barefootjs/vite": "0.31.7",
37
+ "@barefootjs/jsx": "0.31.8",
38
+ "@barefootjs/vite": "0.31.8",
39
39
  "@happy-dom/global-registrator": "^20.0.11",
40
40
  "@types/node": "^22.0.0",
41
41
  "happy-dom": "^20.0.11"