@bamboocss/node 1.39.1 → 1.40.1

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.cjs CHANGED
@@ -3000,8 +3000,29 @@ var Builder = class {
3000
3000
  ctx.project.reloadSourceFiles();
3001
3001
  }
3002
3002
  };
3003
+ /**
3004
+ * Write the generated `styled-system`, so an integration can be a project's only codegen.
3005
+ *
3006
+ * The first call writes everything. That looks like the redundant half — a project that ran
3007
+ * `bamboo codegen` already has the files — but it is the only call that ever mattered, and it
3008
+ * used to do nothing: the guard below read `hasEmitted` before it was ever set, so the first
3009
+ * call fell straight through to setting the flag and the artifacts were written only after a
3010
+ * *subsequent* config change. A clone with no `styled-system/` on disk therefore got none from
3011
+ * `vite dev` or `vite build` either, which is what the callers exist to guarantee — the dev
3012
+ * server answered with an error overlay, and the build failed to resolve `styled-system/css`
3013
+ * from the first module that imports it. Every project has had to run the CLI first and pass
3014
+ * for a build step, which on one react-router app is 585 ms of a 2,242 ms build, ~97% of it
3015
+ * spent loading modules to do 21 ms of work.
3016
+ *
3017
+ * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
3018
+ * only the artifacts a config change affected, and a rebuild that changed no config writes
3019
+ * nothing at all.
3020
+ */
3003
3021
  async emit() {
3004
- if (this.hasEmitted && this.affecteds?.hasConfigChanged) {
3022
+ if (!this.hasEmitted) {
3023
+ _bamboocss_logger.logger.debug("builder", "Emit artifacts");
3024
+ await codegen(this.getContextOrThrow());
3025
+ } else if (this.affecteds?.hasConfigChanged) {
3005
3026
  _bamboocss_logger.logger.debug("builder", "Emit artifacts after config change");
3006
3027
  await codegen(this.getContextOrThrow(), Array.from(this.affecteds.artifacts));
3007
3028
  }
@@ -3495,7 +3516,7 @@ const hasUncompilableSources = (options) => {
3495
3516
  //#endregion
3496
3517
  //#region src/setup-config.ts
3497
3518
  async function setupConfig(cwd, opts = {}) {
3498
- const { force, outExtension, outdir = "styled-system" } = opts;
3519
+ const { force, outExtension, outdir = "styled-system", strictTokens } = opts;
3499
3520
  let configFile;
3500
3521
  try {
3501
3522
  configFile = (0, _bamboocss_config.findConfig)({ cwd });
@@ -3518,6 +3539,10 @@ export default defineConfig({
3518
3539
  ${outExtension ? `\n // The extension for the emitted JavaScript files\noutExtension: '${outExtension}',` : ""}
3519
3540
  // Where to look for your css declarations
3520
3541
  include: ["./src/**/*.{js,jsx,ts,tsx}", "./pages/**/*.{js,jsx,ts,tsx}"],
3542
+ ${strictTokens ? `
3543
+ // How much of a style value typescript checks. \`'unknown-tokens'\` rejects a value
3544
+ // that is neither a token nor a keyword the property enumerates, while leaving raw
3545
+ // css values alone; \`true\` allows only tokens.\nstrictTokens: ${JSON.stringify(strictTokens)},\n` : ""}
3521
3546
 
3522
3547
  // Files to exclude
3523
3548
  exclude: [],
package/dist/index.d.cts CHANGED
@@ -229,6 +229,24 @@ declare class Builder {
229
229
  configPath?: string;
230
230
  cwd?: string;
231
231
  }) => Promise<BambooContext | undefined>;
232
+ /**
233
+ * Write the generated `styled-system`, so an integration can be a project's only codegen.
234
+ *
235
+ * The first call writes everything. That looks like the redundant half — a project that ran
236
+ * `bamboo codegen` already has the files — but it is the only call that ever mattered, and it
237
+ * used to do nothing: the guard below read `hasEmitted` before it was ever set, so the first
238
+ * call fell straight through to setting the flag and the artifacts were written only after a
239
+ * *subsequent* config change. A clone with no `styled-system/` on disk therefore got none from
240
+ * `vite dev` or `vite build` either, which is what the callers exist to guarantee — the dev
241
+ * server answered with an error overlay, and the build failed to resolve `styled-system/css`
242
+ * from the first module that imports it. Every project has had to run the CLI first and pass
243
+ * for a build step, which on one react-router app is 585 ms of a 2,242 ms build, ~97% of it
244
+ * spent loading modules to do 21 ms of work.
245
+ *
246
+ * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
247
+ * only the artifacts a config change affected, and a rebuild that changed no config writes
248
+ * nothing at all.
249
+ */
232
250
  emit(): Promise<void>;
233
251
  setupContext: (options: SetupContextOptions) => Promise<BambooContext>;
234
252
  getContextOrThrow: () => BambooContext;
package/dist/index.d.mts CHANGED
@@ -229,6 +229,24 @@ declare class Builder {
229
229
  configPath?: string;
230
230
  cwd?: string;
231
231
  }) => Promise<BambooContext | undefined>;
232
+ /**
233
+ * Write the generated `styled-system`, so an integration can be a project's only codegen.
234
+ *
235
+ * The first call writes everything. That looks like the redundant half — a project that ran
236
+ * `bamboo codegen` already has the files — but it is the only call that ever mattered, and it
237
+ * used to do nothing: the guard below read `hasEmitted` before it was ever set, so the first
238
+ * call fell straight through to setting the flag and the artifacts were written only after a
239
+ * *subsequent* config change. A clone with no `styled-system/` on disk therefore got none from
240
+ * `vite dev` or `vite build` either, which is what the callers exist to guarantee — the dev
241
+ * server answered with an error overlay, and the build failed to resolve `styled-system/css`
242
+ * from the first module that imports it. Every project has had to run the CLI first and pass
243
+ * for a build step, which on one react-router app is 585 ms of a 2,242 ms build, ~97% of it
244
+ * spent loading modules to do 21 ms of work.
245
+ *
246
+ * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
247
+ * only the artifacts a config change affected, and a rebuild that changed no config writes
248
+ * nothing at all.
249
+ */
232
250
  emit(): Promise<void>;
233
251
  setupContext: (options: SetupContextOptions) => Promise<BambooContext>;
234
252
  getContextOrThrow: () => BambooContext;
package/dist/index.mjs CHANGED
@@ -2986,8 +2986,29 @@ var Builder = class {
2986
2986
  ctx.project.reloadSourceFiles();
2987
2987
  }
2988
2988
  };
2989
+ /**
2990
+ * Write the generated `styled-system`, so an integration can be a project's only codegen.
2991
+ *
2992
+ * The first call writes everything. That looks like the redundant half — a project that ran
2993
+ * `bamboo codegen` already has the files — but it is the only call that ever mattered, and it
2994
+ * used to do nothing: the guard below read `hasEmitted` before it was ever set, so the first
2995
+ * call fell straight through to setting the flag and the artifacts were written only after a
2996
+ * *subsequent* config change. A clone with no `styled-system/` on disk therefore got none from
2997
+ * `vite dev` or `vite build` either, which is what the callers exist to guarantee — the dev
2998
+ * server answered with an error overlay, and the build failed to resolve `styled-system/css`
2999
+ * from the first module that imports it. Every project has had to run the CLI first and pass
3000
+ * for a build step, which on one react-router app is 585 ms of a 2,242 ms build, ~97% of it
3001
+ * spent loading modules to do 21 ms of work.
3002
+ *
3003
+ * Later calls stay narrow, which is what the guard was reaching for. A watch rebuild re-emits
3004
+ * only the artifacts a config change affected, and a rebuild that changed no config writes
3005
+ * nothing at all.
3006
+ */
2989
3007
  async emit() {
2990
- if (this.hasEmitted && this.affecteds?.hasConfigChanged) {
3008
+ if (!this.hasEmitted) {
3009
+ logger.debug("builder", "Emit artifacts");
3010
+ await codegen(this.getContextOrThrow());
3011
+ } else if (this.affecteds?.hasConfigChanged) {
2991
3012
  logger.debug("builder", "Emit artifacts after config change");
2992
3013
  await codegen(this.getContextOrThrow(), Array.from(this.affecteds.artifacts));
2993
3014
  }
@@ -3481,7 +3502,7 @@ const hasUncompilableSources = (options) => {
3481
3502
  //#endregion
3482
3503
  //#region src/setup-config.ts
3483
3504
  async function setupConfig(cwd, opts = {}) {
3484
- const { force, outExtension, outdir = "styled-system" } = opts;
3505
+ const { force, outExtension, outdir = "styled-system", strictTokens } = opts;
3485
3506
  let configFile;
3486
3507
  try {
3487
3508
  configFile = findConfig({ cwd });
@@ -3504,6 +3525,10 @@ export default defineConfig({
3504
3525
  ${outExtension ? `\n // The extension for the emitted JavaScript files\noutExtension: '${outExtension}',` : ""}
3505
3526
  // Where to look for your css declarations
3506
3527
  include: ["./src/**/*.{js,jsx,ts,tsx}", "./pages/**/*.{js,jsx,ts,tsx}"],
3528
+ ${strictTokens ? `
3529
+ // How much of a style value typescript checks. \`'unknown-tokens'\` rejects a value
3530
+ // that is neither a token nor a keyword the property enumerates, while leaving raw
3531
+ // css values alone; \`true\` allows only tokens.\nstrictTokens: ${JSON.stringify(strictTokens)},\n` : ""}
3507
3532
 
3508
3533
  // Files to exclude
3509
3534
  exclude: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.39.1",
3
+ "version": "1.40.1",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -52,17 +52,17 @@
52
52
  "postcss": "8.5.26",
53
53
  "ts-morph": "28.0.0",
54
54
  "ts-pattern": "5.9.0",
55
- "@bamboocss/config": "1.39.1",
56
- "@bamboocss/core": "1.39.1",
57
- "@bamboocss/generator": "1.39.1",
58
- "@bamboocss/logger": "1.39.1",
59
- "@bamboocss/parser": "1.39.1",
60
- "@bamboocss/plugin-svelte": "1.39.1",
61
- "@bamboocss/plugin-vue": "1.39.1",
62
- "@bamboocss/reporter": "1.39.1",
63
- "@bamboocss/shared": "1.39.1",
64
- "@bamboocss/token-dictionary": "1.39.1",
65
- "@bamboocss/types": "1.39.1"
55
+ "@bamboocss/config": "1.40.1",
56
+ "@bamboocss/parser": "1.40.1",
57
+ "@bamboocss/generator": "1.40.1",
58
+ "@bamboocss/logger": "1.40.1",
59
+ "@bamboocss/plugin-svelte": "1.40.1",
60
+ "@bamboocss/plugin-vue": "1.40.1",
61
+ "@bamboocss/reporter": "1.40.1",
62
+ "@bamboocss/shared": "1.40.1",
63
+ "@bamboocss/token-dictionary": "1.40.1",
64
+ "@bamboocss/core": "1.40.1",
65
+ "@bamboocss/types": "1.40.1"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/fs-extra": "11.0.4",