@bamboocss/dev 1.39.1 → 1.40.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.
@@ -7627,15 +7627,37 @@ function isLocError(error) {
7627
7627
  //#endregion
7628
7628
  //#region package.json
7629
7629
  var name = "@bamboocss/dev";
7630
- var version = "1.39.1";
7630
+ var version = "1.40.0";
7631
7631
  //#endregion
7632
7632
  //#region src/interactive.ts
7633
- const interactive = async () => {
7633
+ /**
7634
+ * Which integration this project wants, before anybody is asked.
7635
+ *
7636
+ * The question is not really a preference. `@bamboocss/vite` compiles every `css()` and `cva()`
7637
+ * call to a literal class string; `@bamboocss/postcss` emits the stylesheet and compiles
7638
+ * nothing, so those calls stay runtime calls and the style engine ships to the client. Which of
7639
+ * the two applies is decided by the bundler, and the answer is on disk: a Vite config means the
7640
+ * compiler is available.
7641
+ *
7642
+ * Asked cold, with `yes` preselected, this steered every Vite project onto the runtime path by
7643
+ * pressing Enter — and both setups render identically, so nothing afterwards reveals the
7644
+ * choice. That is the same defect the React Router guide had, reached by a different door.
7645
+ *
7646
+ * Svelte, Vue and Astro are the exception in the other direction: their components are
7647
+ * templates the compiler does not transform, so PostCSS is the integration they should be on
7648
+ * and the default stays `yes`.
7649
+ */
7650
+ const suggestPostcss = (cwd) => {
7651
+ if (!(0, _bamboocss_node.findViteConfig)(cwd)) return "yes";
7652
+ return (0, _bamboocss_node.hasUncompilableSources)({ cwd }) ? "yes" : "no";
7653
+ };
7654
+ const interactive = async (options = {}) => {
7655
+ const postcssDefault = suggestPostcss(options.cwd ?? process.cwd());
7634
7656
  _clack_prompts.intro(`bamboo v${version}`);
7635
7657
  const initFlags = await _clack_prompts.group({
7636
7658
  usePostcss: () => _clack_prompts.select({
7637
- message: "Would you like to use PostCSS ?",
7638
- initialValue: "yes",
7659
+ message: postcssDefault === "no" ? "Emit the stylesheet through PostCSS? This project has a Vite config, and `@bamboocss/vite` compiles your style calls away instead." : "Emit the stylesheet through PostCSS?",
7660
+ initialValue: postcssDefault,
7639
7661
  options: [{
7640
7662
  value: "yes",
7641
7663
  label: "Yes"
@@ -7656,15 +7678,22 @@ const interactive = async () => {
7656
7678
  }]
7657
7679
  }),
7658
7680
  withStrictTokens: () => _clack_prompts.select({
7659
- message: "Use strict tokens to enforce full type-safety?",
7681
+ message: "How strictly should typescript check style values?",
7660
7682
  initialValue: "no",
7661
- options: [{
7662
- value: "yes",
7663
- label: "Yes"
7664
- }, {
7665
- value: "no",
7666
- label: "No"
7667
- }]
7683
+ options: [
7684
+ {
7685
+ value: "no",
7686
+ label: "Not at all — any string is accepted"
7687
+ },
7688
+ {
7689
+ value: "unknown-tokens",
7690
+ label: "Reject a value that is neither a token nor a css keyword"
7691
+ },
7692
+ {
7693
+ value: "yes",
7694
+ label: "Only tokens — every raw value is written `[14px]`"
7695
+ }
7696
+ ]
7668
7697
  }),
7669
7698
  shouldUpdateGitignore: () => _clack_prompts.select({
7670
7699
  message: "Update gitignore?",
@@ -7685,23 +7714,60 @@ const interactive = async () => {
7685
7714
  return {
7686
7715
  postcss: initFlags.usePostcss === "yes",
7687
7716
  outExtension: initFlags.useMjsExtension === "yes" ? "mjs" : "js",
7688
- strictTokens: initFlags.withStrictTokens === "yes",
7717
+ strictTokens: strictTokensFrom(initFlags.withStrictTokens),
7689
7718
  gitignore: initFlags.shouldUpdateGitignore === "yes"
7690
7719
  };
7691
7720
  };
7721
+ /** `'yes'` is the historical spelling of `true`; the third mode names itself. */
7722
+ const strictTokensFrom = (answer) => {
7723
+ if (answer === "yes") return true;
7724
+ if (answer === "unknown-tokens") return "unknown-tokens";
7725
+ };
7692
7726
  //#endregion
7693
7727
  //#region src/cli-main.ts
7728
+ /**
7729
+ * `--strict-tokens` is three-valued, and cac hands back whatever followed it.
7730
+ *
7731
+ * Bare is `true`, which is what the flag has always meant, and a named mode is passed through
7732
+ * so the middle setting is reachable from the CLI at all — it would otherwise be a config-file
7733
+ * feature `bamboo init` could not produce.
7734
+ *
7735
+ * Anything else is refused rather than coerced. Mapping the unknown to `true` is the worst
7736
+ * available answer: `--strict-tokens=false` would turn it *on*, and a typo in the middle mode's
7737
+ * name would silently pick the strictest setting there is — every raw CSS value in the project
7738
+ * becoming a type error, with nothing naming the mistake. Refusing costs one message and is
7739
+ * always readable.
7740
+ *
7741
+ * The negative spellings are answered here rather than left to cac, which only recognises
7742
+ * `--no-strict-tokens`. A user writing `--strict-tokens=false` means the same thing.
7743
+ */
7744
+ const OFF = new Set([
7745
+ "false",
7746
+ "no",
7747
+ "off",
7748
+ "0",
7749
+ ""
7750
+ ]);
7751
+ const normalizeStrictTokens = (value) => {
7752
+ if (value === void 0 || value === false) return void 0;
7753
+ if (value === true) return true;
7754
+ const named = String(value);
7755
+ if (OFF.has(named)) return void 0;
7756
+ if (named === "unknown-tokens") return "unknown-tokens";
7757
+ if (named === "true" || named === "yes" || named === "on") return true;
7758
+ throw new _bamboocss_shared.BambooError("CONFIG_ERROR", `\`--strict-tokens ${named}\` is not a setting. Pass it bare for tokens only, or \`--strict-tokens unknown-tokens\` to reject a value that is neither a token nor a css keyword.`);
7759
+ };
7694
7760
  async function main() {
7695
7761
  const cli = (0, cac.cac)("bamboo");
7696
7762
  const cwd = process.cwd();
7697
- cli.command("init", "Initialize the bamboo config file").option("-i, --interactive", "Run in interactive mode", { default: false }).option("-f, --force", "Force overwrite existing config file").option("-p, --postcss", "Emit postcss config file").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--silent", "Suppress all messages except errors").option("--no-gitignore", "Don't update the .gitignore").option("--no-codegen", "Don't run the codegen logic").option("--out-extension <ext>", "The extension of the generated js files (default: 'mjs')").option("--outdir <dir>", "The output directory for the generated files").option("--strict-tokens", "Using strictTokens: true").option("--logfile <file>", "Outputs logs to a file").action(async (initFlags = {}) => {
7763
+ cli.command("init", "Initialize the bamboo config file").option("-i, --interactive", "Run in interactive mode", { default: false }).option("-f, --force", "Force overwrite existing config file").option("-p, --postcss", "Emit postcss config file").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--silent", "Suppress all messages except errors").option("--no-gitignore", "Don't update the .gitignore").option("--no-codegen", "Don't run the codegen logic").option("--out-extension <ext>", "The extension of the generated js files (default: 'mjs')").option("--outdir <dir>", "The output directory for the generated files").option("--strict-tokens [mode]", "Set strictTokens. Bare for `true`; `--strict-tokens unknown-tokens` for the middle mode").option("--logfile <file>", "Outputs logs to a file").action(async (initFlags = {}) => {
7698
7764
  let options = {};
7699
- if (initFlags.interactive) options = await interactive();
7765
+ if (initFlags.interactive) options = await interactive({ cwd: (0, path.resolve)(initFlags.cwd ?? "") });
7700
7766
  const flags = {
7701
7767
  ...initFlags,
7702
7768
  ...options
7703
7769
  };
7704
- const { force, postcss, silent, gitignore, outExtension, config: configPath } = flags;
7770
+ const { force, postcss, silent, gitignore, outExtension, strictTokens, config: configPath } = flags;
7705
7771
  const cwd = (0, path.resolve)(flags.cwd ?? "");
7706
7772
  if (silent) _bamboocss_logger.logger.level = "silent";
7707
7773
  const stream = (0, _bamboocss_node.setLogStream)({
@@ -7714,7 +7780,8 @@ async function main() {
7714
7780
  await (0, _bamboocss_node.setupConfig)(cwd, (0, _bamboocss_shared.compact)({
7715
7781
  force,
7716
7782
  outExtension,
7717
- outdir: flags.outdir
7783
+ outdir: flags.outdir,
7784
+ strictTokens: normalizeStrictTokens(strictTokens)
7718
7785
  }));
7719
7786
  const ctx = await (0, _bamboocss_node.loadConfigAndCreateContext)({
7720
7787
  cwd,
@@ -13,7 +13,7 @@ import tty from "node:tty";
13
13
  import { isMainThread, parentPort } from "worker_threads";
14
14
  import { BambooError, compact } from "@bamboocss/shared";
15
15
  import { logger } from "@bamboocss/logger";
16
- import { BambooContext, analyze, buildInfo, codegen, cssgen, debug, generate, generatePackageExports, loadConfigAndCreateContext, setLogStream, setupConfig, setupGitIgnore, setupPostcss, spec, startProfiling } from "@bamboocss/node";
16
+ import { BambooContext, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, loadConfigAndCreateContext, setLogStream, setupConfig, setupGitIgnore, setupPostcss, spec, startProfiling } from "@bamboocss/node";
17
17
  import { cac } from "cac";
18
18
  import * as p from "@clack/prompts";
19
19
  //#region \0rolldown/runtime.js
@@ -7630,15 +7630,37 @@ function isLocError(error) {
7630
7630
  //#endregion
7631
7631
  //#region package.json
7632
7632
  var name = "@bamboocss/dev";
7633
- var version = "1.39.1";
7633
+ var version = "1.40.0";
7634
7634
  //#endregion
7635
7635
  //#region src/interactive.ts
7636
- const interactive = async () => {
7636
+ /**
7637
+ * Which integration this project wants, before anybody is asked.
7638
+ *
7639
+ * The question is not really a preference. `@bamboocss/vite` compiles every `css()` and `cva()`
7640
+ * call to a literal class string; `@bamboocss/postcss` emits the stylesheet and compiles
7641
+ * nothing, so those calls stay runtime calls and the style engine ships to the client. Which of
7642
+ * the two applies is decided by the bundler, and the answer is on disk: a Vite config means the
7643
+ * compiler is available.
7644
+ *
7645
+ * Asked cold, with `yes` preselected, this steered every Vite project onto the runtime path by
7646
+ * pressing Enter — and both setups render identically, so nothing afterwards reveals the
7647
+ * choice. That is the same defect the React Router guide had, reached by a different door.
7648
+ *
7649
+ * Svelte, Vue and Astro are the exception in the other direction: their components are
7650
+ * templates the compiler does not transform, so PostCSS is the integration they should be on
7651
+ * and the default stays `yes`.
7652
+ */
7653
+ const suggestPostcss = (cwd) => {
7654
+ if (!findViteConfig(cwd)) return "yes";
7655
+ return hasUncompilableSources({ cwd }) ? "yes" : "no";
7656
+ };
7657
+ const interactive = async (options = {}) => {
7658
+ const postcssDefault = suggestPostcss(options.cwd ?? process.cwd());
7637
7659
  p.intro(`bamboo v${version}`);
7638
7660
  const initFlags = await p.group({
7639
7661
  usePostcss: () => p.select({
7640
- message: "Would you like to use PostCSS ?",
7641
- initialValue: "yes",
7662
+ message: postcssDefault === "no" ? "Emit the stylesheet through PostCSS? This project has a Vite config, and `@bamboocss/vite` compiles your style calls away instead." : "Emit the stylesheet through PostCSS?",
7663
+ initialValue: postcssDefault,
7642
7664
  options: [{
7643
7665
  value: "yes",
7644
7666
  label: "Yes"
@@ -7659,15 +7681,22 @@ const interactive = async () => {
7659
7681
  }]
7660
7682
  }),
7661
7683
  withStrictTokens: () => p.select({
7662
- message: "Use strict tokens to enforce full type-safety?",
7684
+ message: "How strictly should typescript check style values?",
7663
7685
  initialValue: "no",
7664
- options: [{
7665
- value: "yes",
7666
- label: "Yes"
7667
- }, {
7668
- value: "no",
7669
- label: "No"
7670
- }]
7686
+ options: [
7687
+ {
7688
+ value: "no",
7689
+ label: "Not at all — any string is accepted"
7690
+ },
7691
+ {
7692
+ value: "unknown-tokens",
7693
+ label: "Reject a value that is neither a token nor a css keyword"
7694
+ },
7695
+ {
7696
+ value: "yes",
7697
+ label: "Only tokens — every raw value is written `[14px]`"
7698
+ }
7699
+ ]
7671
7700
  }),
7672
7701
  shouldUpdateGitignore: () => p.select({
7673
7702
  message: "Update gitignore?",
@@ -7688,23 +7717,60 @@ const interactive = async () => {
7688
7717
  return {
7689
7718
  postcss: initFlags.usePostcss === "yes",
7690
7719
  outExtension: initFlags.useMjsExtension === "yes" ? "mjs" : "js",
7691
- strictTokens: initFlags.withStrictTokens === "yes",
7720
+ strictTokens: strictTokensFrom(initFlags.withStrictTokens),
7692
7721
  gitignore: initFlags.shouldUpdateGitignore === "yes"
7693
7722
  };
7694
7723
  };
7724
+ /** `'yes'` is the historical spelling of `true`; the third mode names itself. */
7725
+ const strictTokensFrom = (answer) => {
7726
+ if (answer === "yes") return true;
7727
+ if (answer === "unknown-tokens") return "unknown-tokens";
7728
+ };
7695
7729
  //#endregion
7696
7730
  //#region src/cli-main.ts
7731
+ /**
7732
+ * `--strict-tokens` is three-valued, and cac hands back whatever followed it.
7733
+ *
7734
+ * Bare is `true`, which is what the flag has always meant, and a named mode is passed through
7735
+ * so the middle setting is reachable from the CLI at all — it would otherwise be a config-file
7736
+ * feature `bamboo init` could not produce.
7737
+ *
7738
+ * Anything else is refused rather than coerced. Mapping the unknown to `true` is the worst
7739
+ * available answer: `--strict-tokens=false` would turn it *on*, and a typo in the middle mode's
7740
+ * name would silently pick the strictest setting there is — every raw CSS value in the project
7741
+ * becoming a type error, with nothing naming the mistake. Refusing costs one message and is
7742
+ * always readable.
7743
+ *
7744
+ * The negative spellings are answered here rather than left to cac, which only recognises
7745
+ * `--no-strict-tokens`. A user writing `--strict-tokens=false` means the same thing.
7746
+ */
7747
+ const OFF = new Set([
7748
+ "false",
7749
+ "no",
7750
+ "off",
7751
+ "0",
7752
+ ""
7753
+ ]);
7754
+ const normalizeStrictTokens = (value) => {
7755
+ if (value === void 0 || value === false) return void 0;
7756
+ if (value === true) return true;
7757
+ const named = String(value);
7758
+ if (OFF.has(named)) return void 0;
7759
+ if (named === "unknown-tokens") return "unknown-tokens";
7760
+ if (named === "true" || named === "yes" || named === "on") return true;
7761
+ throw new BambooError("CONFIG_ERROR", `\`--strict-tokens ${named}\` is not a setting. Pass it bare for tokens only, or \`--strict-tokens unknown-tokens\` to reject a value that is neither a token nor a css keyword.`);
7762
+ };
7697
7763
  async function main() {
7698
7764
  const cli = cac("bamboo");
7699
7765
  const cwd = process.cwd();
7700
- cli.command("init", "Initialize the bamboo config file").option("-i, --interactive", "Run in interactive mode", { default: false }).option("-f, --force", "Force overwrite existing config file").option("-p, --postcss", "Emit postcss config file").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--silent", "Suppress all messages except errors").option("--no-gitignore", "Don't update the .gitignore").option("--no-codegen", "Don't run the codegen logic").option("--out-extension <ext>", "The extension of the generated js files (default: 'mjs')").option("--outdir <dir>", "The output directory for the generated files").option("--strict-tokens", "Using strictTokens: true").option("--logfile <file>", "Outputs logs to a file").action(async (initFlags = {}) => {
7766
+ cli.command("init", "Initialize the bamboo config file").option("-i, --interactive", "Run in interactive mode", { default: false }).option("-f, --force", "Force overwrite existing config file").option("-p, --postcss", "Emit postcss config file").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--silent", "Suppress all messages except errors").option("--no-gitignore", "Don't update the .gitignore").option("--no-codegen", "Don't run the codegen logic").option("--out-extension <ext>", "The extension of the generated js files (default: 'mjs')").option("--outdir <dir>", "The output directory for the generated files").option("--strict-tokens [mode]", "Set strictTokens. Bare for `true`; `--strict-tokens unknown-tokens` for the middle mode").option("--logfile <file>", "Outputs logs to a file").action(async (initFlags = {}) => {
7701
7767
  let options = {};
7702
- if (initFlags.interactive) options = await interactive();
7768
+ if (initFlags.interactive) options = await interactive({ cwd: resolve(initFlags.cwd ?? "") });
7703
7769
  const flags = {
7704
7770
  ...initFlags,
7705
7771
  ...options
7706
7772
  };
7707
- const { force, postcss, silent, gitignore, outExtension, config: configPath } = flags;
7773
+ const { force, postcss, silent, gitignore, outExtension, strictTokens, config: configPath } = flags;
7708
7774
  const cwd = resolve(flags.cwd ?? "");
7709
7775
  if (silent) logger.level = "silent";
7710
7776
  const stream = setLogStream({
@@ -7717,7 +7783,8 @@ async function main() {
7717
7783
  await setupConfig(cwd, compact({
7718
7784
  force,
7719
7785
  outExtension,
7720
- outdir: flags.outdir
7786
+ outdir: flags.outdir,
7787
+ strictTokens: normalizeStrictTokens(strictTokens)
7721
7788
  }));
7722
7789
  const ctx = await loadConfigAndCreateContext({
7723
7790
  cwd,
package/dist/cli-main.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_package = require("./package-DM0LsZ_n.cjs");
2
+ const require_package = require("./package-C5AGgVpc.cjs");
3
3
  let _bamboocss_logger = require("@bamboocss/logger");
4
4
  let _bamboocss_node = require("@bamboocss/node");
5
5
  let _bamboocss_shared = require("@bamboocss/shared");
@@ -8,12 +8,34 @@ let path = require("path");
8
8
  let _clack_prompts = require("@clack/prompts");
9
9
  _clack_prompts = require_package.__toESM(_clack_prompts);
10
10
  //#region src/interactive.ts
11
- const interactive = async () => {
11
+ /**
12
+ * Which integration this project wants, before anybody is asked.
13
+ *
14
+ * The question is not really a preference. `@bamboocss/vite` compiles every `css()` and `cva()`
15
+ * call to a literal class string; `@bamboocss/postcss` emits the stylesheet and compiles
16
+ * nothing, so those calls stay runtime calls and the style engine ships to the client. Which of
17
+ * the two applies is decided by the bundler, and the answer is on disk: a Vite config means the
18
+ * compiler is available.
19
+ *
20
+ * Asked cold, with `yes` preselected, this steered every Vite project onto the runtime path by
21
+ * pressing Enter — and both setups render identically, so nothing afterwards reveals the
22
+ * choice. That is the same defect the React Router guide had, reached by a different door.
23
+ *
24
+ * Svelte, Vue and Astro are the exception in the other direction: their components are
25
+ * templates the compiler does not transform, so PostCSS is the integration they should be on
26
+ * and the default stays `yes`.
27
+ */
28
+ const suggestPostcss = (cwd) => {
29
+ if (!(0, _bamboocss_node.findViteConfig)(cwd)) return "yes";
30
+ return (0, _bamboocss_node.hasUncompilableSources)({ cwd }) ? "yes" : "no";
31
+ };
32
+ const interactive = async (options = {}) => {
33
+ const postcssDefault = suggestPostcss(options.cwd ?? process.cwd());
12
34
  _clack_prompts.intro(`bamboo v${require_package.version}`);
13
35
  const initFlags = await _clack_prompts.group({
14
36
  usePostcss: () => _clack_prompts.select({
15
- message: "Would you like to use PostCSS ?",
16
- initialValue: "yes",
37
+ message: postcssDefault === "no" ? "Emit the stylesheet through PostCSS? This project has a Vite config, and `@bamboocss/vite` compiles your style calls away instead." : "Emit the stylesheet through PostCSS?",
38
+ initialValue: postcssDefault,
17
39
  options: [{
18
40
  value: "yes",
19
41
  label: "Yes"
@@ -34,15 +56,22 @@ const interactive = async () => {
34
56
  }]
35
57
  }),
36
58
  withStrictTokens: () => _clack_prompts.select({
37
- message: "Use strict tokens to enforce full type-safety?",
59
+ message: "How strictly should typescript check style values?",
38
60
  initialValue: "no",
39
- options: [{
40
- value: "yes",
41
- label: "Yes"
42
- }, {
43
- value: "no",
44
- label: "No"
45
- }]
61
+ options: [
62
+ {
63
+ value: "no",
64
+ label: "Not at all — any string is accepted"
65
+ },
66
+ {
67
+ value: "unknown-tokens",
68
+ label: "Reject a value that is neither a token nor a css keyword"
69
+ },
70
+ {
71
+ value: "yes",
72
+ label: "Only tokens — every raw value is written `[14px]`"
73
+ }
74
+ ]
46
75
  }),
47
76
  shouldUpdateGitignore: () => _clack_prompts.select({
48
77
  message: "Update gitignore?",
@@ -63,23 +92,60 @@ const interactive = async () => {
63
92
  return {
64
93
  postcss: initFlags.usePostcss === "yes",
65
94
  outExtension: initFlags.useMjsExtension === "yes" ? "mjs" : "js",
66
- strictTokens: initFlags.withStrictTokens === "yes",
95
+ strictTokens: strictTokensFrom(initFlags.withStrictTokens),
67
96
  gitignore: initFlags.shouldUpdateGitignore === "yes"
68
97
  };
69
98
  };
99
+ /** `'yes'` is the historical spelling of `true`; the third mode names itself. */
100
+ const strictTokensFrom = (answer) => {
101
+ if (answer === "yes") return true;
102
+ if (answer === "unknown-tokens") return "unknown-tokens";
103
+ };
70
104
  //#endregion
71
105
  //#region src/cli-main.ts
106
+ /**
107
+ * `--strict-tokens` is three-valued, and cac hands back whatever followed it.
108
+ *
109
+ * Bare is `true`, which is what the flag has always meant, and a named mode is passed through
110
+ * so the middle setting is reachable from the CLI at all — it would otherwise be a config-file
111
+ * feature `bamboo init` could not produce.
112
+ *
113
+ * Anything else is refused rather than coerced. Mapping the unknown to `true` is the worst
114
+ * available answer: `--strict-tokens=false` would turn it *on*, and a typo in the middle mode's
115
+ * name would silently pick the strictest setting there is — every raw CSS value in the project
116
+ * becoming a type error, with nothing naming the mistake. Refusing costs one message and is
117
+ * always readable.
118
+ *
119
+ * The negative spellings are answered here rather than left to cac, which only recognises
120
+ * `--no-strict-tokens`. A user writing `--strict-tokens=false` means the same thing.
121
+ */
122
+ const OFF = new Set([
123
+ "false",
124
+ "no",
125
+ "off",
126
+ "0",
127
+ ""
128
+ ]);
129
+ const normalizeStrictTokens = (value) => {
130
+ if (value === void 0 || value === false) return void 0;
131
+ if (value === true) return true;
132
+ const named = String(value);
133
+ if (OFF.has(named)) return void 0;
134
+ if (named === "unknown-tokens") return "unknown-tokens";
135
+ if (named === "true" || named === "yes" || named === "on") return true;
136
+ throw new _bamboocss_shared.BambooError("CONFIG_ERROR", `\`--strict-tokens ${named}\` is not a setting. Pass it bare for tokens only, or \`--strict-tokens unknown-tokens\` to reject a value that is neither a token nor a css keyword.`);
137
+ };
72
138
  async function main() {
73
139
  const cli = (0, cac.cac)("bamboo");
74
140
  const cwd = process.cwd();
75
- cli.command("init", "Initialize the bamboo config file").option("-i, --interactive", "Run in interactive mode", { default: false }).option("-f, --force", "Force overwrite existing config file").option("-p, --postcss", "Emit postcss config file").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--silent", "Suppress all messages except errors").option("--no-gitignore", "Don't update the .gitignore").option("--no-codegen", "Don't run the codegen logic").option("--out-extension <ext>", "The extension of the generated js files (default: 'mjs')").option("--outdir <dir>", "The output directory for the generated files").option("--strict-tokens", "Using strictTokens: true").option("--logfile <file>", "Outputs logs to a file").action(async (initFlags = {}) => {
141
+ cli.command("init", "Initialize the bamboo config file").option("-i, --interactive", "Run in interactive mode", { default: false }).option("-f, --force", "Force overwrite existing config file").option("-p, --postcss", "Emit postcss config file").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--silent", "Suppress all messages except errors").option("--no-gitignore", "Don't update the .gitignore").option("--no-codegen", "Don't run the codegen logic").option("--out-extension <ext>", "The extension of the generated js files (default: 'mjs')").option("--outdir <dir>", "The output directory for the generated files").option("--strict-tokens [mode]", "Set strictTokens. Bare for `true`; `--strict-tokens unknown-tokens` for the middle mode").option("--logfile <file>", "Outputs logs to a file").action(async (initFlags = {}) => {
76
142
  let options = {};
77
- if (initFlags.interactive) options = await interactive();
143
+ if (initFlags.interactive) options = await interactive({ cwd: (0, path.resolve)(initFlags.cwd ?? "") });
78
144
  const flags = {
79
145
  ...initFlags,
80
146
  ...options
81
147
  };
82
- const { force, postcss, silent, gitignore, outExtension, config: configPath } = flags;
148
+ const { force, postcss, silent, gitignore, outExtension, strictTokens, config: configPath } = flags;
83
149
  const cwd = (0, path.resolve)(flags.cwd ?? "");
84
150
  if (silent) _bamboocss_logger.logger.level = "silent";
85
151
  const stream = (0, _bamboocss_node.setLogStream)({
@@ -92,7 +158,8 @@ async function main() {
92
158
  await (0, _bamboocss_node.setupConfig)(cwd, (0, _bamboocss_shared.compact)({
93
159
  force,
94
160
  outExtension,
95
- outdir: flags.outdir
161
+ outdir: flags.outdir,
162
+ strictTokens: normalizeStrictTokens(strictTokens)
96
163
  }));
97
164
  const ctx = await (0, _bamboocss_node.loadConfigAndCreateContext)({
98
165
  cwd,
@@ -400,7 +467,7 @@ async function main() {
400
467
  process.exitCode = 1;
401
468
  });
402
469
  cli.command("init-mcp", "Initialize MCP configuration for AI clients").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--client <clients>", "AI clients to configure (claude, cursor, vscode, windsurf, codex)").action(async (mcpInitFlags) => {
403
- const { initMcpConfig } = await Promise.resolve().then(() => require("./mcp-init-BFgJJlHc.cjs"));
470
+ const { initMcpConfig } = await Promise.resolve().then(() => require("./mcp-init-DE2MAuvO.cjs"));
404
471
  const resolvedCwd = (0, path.resolve)(mcpInitFlags.cwd ?? cwd);
405
472
  let clients;
406
473
  if (mcpInitFlags.client) clients = (Array.isArray(mcpInitFlags.client) ? mcpInitFlags.client : [mcpInitFlags.client]).flatMap((c) => c.split(",")).map((c) => c.trim());
package/dist/cli-main.mjs CHANGED
@@ -1,17 +1,39 @@
1
- import { t as version } from "./package-DlXyEbxc.mjs";
1
+ import { t as version } from "./package-C-ms8o9u.mjs";
2
2
  import { logger } from "@bamboocss/logger";
3
- import { BambooContext, analyze, buildInfo, codegen, cssgen, debug, generate, generatePackageExports, loadConfigAndCreateContext, setLogStream, setupConfig, setupGitIgnore, setupPostcss, spec, startProfiling } from "@bamboocss/node";
4
- import { compact } from "@bamboocss/shared";
3
+ import { BambooContext, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, loadConfigAndCreateContext, setLogStream, setupConfig, setupGitIgnore, setupPostcss, spec, startProfiling } from "@bamboocss/node";
4
+ import { BambooError, compact } from "@bamboocss/shared";
5
5
  import { cac } from "cac";
6
6
  import { join, resolve } from "path";
7
7
  import * as p from "@clack/prompts";
8
8
  //#region src/interactive.ts
9
- const interactive = async () => {
9
+ /**
10
+ * Which integration this project wants, before anybody is asked.
11
+ *
12
+ * The question is not really a preference. `@bamboocss/vite` compiles every `css()` and `cva()`
13
+ * call to a literal class string; `@bamboocss/postcss` emits the stylesheet and compiles
14
+ * nothing, so those calls stay runtime calls and the style engine ships to the client. Which of
15
+ * the two applies is decided by the bundler, and the answer is on disk: a Vite config means the
16
+ * compiler is available.
17
+ *
18
+ * Asked cold, with `yes` preselected, this steered every Vite project onto the runtime path by
19
+ * pressing Enter — and both setups render identically, so nothing afterwards reveals the
20
+ * choice. That is the same defect the React Router guide had, reached by a different door.
21
+ *
22
+ * Svelte, Vue and Astro are the exception in the other direction: their components are
23
+ * templates the compiler does not transform, so PostCSS is the integration they should be on
24
+ * and the default stays `yes`.
25
+ */
26
+ const suggestPostcss = (cwd) => {
27
+ if (!findViteConfig(cwd)) return "yes";
28
+ return hasUncompilableSources({ cwd }) ? "yes" : "no";
29
+ };
30
+ const interactive = async (options = {}) => {
31
+ const postcssDefault = suggestPostcss(options.cwd ?? process.cwd());
10
32
  p.intro(`bamboo v${version}`);
11
33
  const initFlags = await p.group({
12
34
  usePostcss: () => p.select({
13
- message: "Would you like to use PostCSS ?",
14
- initialValue: "yes",
35
+ message: postcssDefault === "no" ? "Emit the stylesheet through PostCSS? This project has a Vite config, and `@bamboocss/vite` compiles your style calls away instead." : "Emit the stylesheet through PostCSS?",
36
+ initialValue: postcssDefault,
15
37
  options: [{
16
38
  value: "yes",
17
39
  label: "Yes"
@@ -32,15 +54,22 @@ const interactive = async () => {
32
54
  }]
33
55
  }),
34
56
  withStrictTokens: () => p.select({
35
- message: "Use strict tokens to enforce full type-safety?",
57
+ message: "How strictly should typescript check style values?",
36
58
  initialValue: "no",
37
- options: [{
38
- value: "yes",
39
- label: "Yes"
40
- }, {
41
- value: "no",
42
- label: "No"
43
- }]
59
+ options: [
60
+ {
61
+ value: "no",
62
+ label: "Not at all — any string is accepted"
63
+ },
64
+ {
65
+ value: "unknown-tokens",
66
+ label: "Reject a value that is neither a token nor a css keyword"
67
+ },
68
+ {
69
+ value: "yes",
70
+ label: "Only tokens — every raw value is written `[14px]`"
71
+ }
72
+ ]
44
73
  }),
45
74
  shouldUpdateGitignore: () => p.select({
46
75
  message: "Update gitignore?",
@@ -61,23 +90,60 @@ const interactive = async () => {
61
90
  return {
62
91
  postcss: initFlags.usePostcss === "yes",
63
92
  outExtension: initFlags.useMjsExtension === "yes" ? "mjs" : "js",
64
- strictTokens: initFlags.withStrictTokens === "yes",
93
+ strictTokens: strictTokensFrom(initFlags.withStrictTokens),
65
94
  gitignore: initFlags.shouldUpdateGitignore === "yes"
66
95
  };
67
96
  };
97
+ /** `'yes'` is the historical spelling of `true`; the third mode names itself. */
98
+ const strictTokensFrom = (answer) => {
99
+ if (answer === "yes") return true;
100
+ if (answer === "unknown-tokens") return "unknown-tokens";
101
+ };
68
102
  //#endregion
69
103
  //#region src/cli-main.ts
104
+ /**
105
+ * `--strict-tokens` is three-valued, and cac hands back whatever followed it.
106
+ *
107
+ * Bare is `true`, which is what the flag has always meant, and a named mode is passed through
108
+ * so the middle setting is reachable from the CLI at all — it would otherwise be a config-file
109
+ * feature `bamboo init` could not produce.
110
+ *
111
+ * Anything else is refused rather than coerced. Mapping the unknown to `true` is the worst
112
+ * available answer: `--strict-tokens=false` would turn it *on*, and a typo in the middle mode's
113
+ * name would silently pick the strictest setting there is — every raw CSS value in the project
114
+ * becoming a type error, with nothing naming the mistake. Refusing costs one message and is
115
+ * always readable.
116
+ *
117
+ * The negative spellings are answered here rather than left to cac, which only recognises
118
+ * `--no-strict-tokens`. A user writing `--strict-tokens=false` means the same thing.
119
+ */
120
+ const OFF = new Set([
121
+ "false",
122
+ "no",
123
+ "off",
124
+ "0",
125
+ ""
126
+ ]);
127
+ const normalizeStrictTokens = (value) => {
128
+ if (value === void 0 || value === false) return void 0;
129
+ if (value === true) return true;
130
+ const named = String(value);
131
+ if (OFF.has(named)) return void 0;
132
+ if (named === "unknown-tokens") return "unknown-tokens";
133
+ if (named === "true" || named === "yes" || named === "on") return true;
134
+ throw new BambooError("CONFIG_ERROR", `\`--strict-tokens ${named}\` is not a setting. Pass it bare for tokens only, or \`--strict-tokens unknown-tokens\` to reject a value that is neither a token nor a css keyword.`);
135
+ };
70
136
  async function main() {
71
137
  const cli = cac("bamboo");
72
138
  const cwd = process.cwd();
73
- cli.command("init", "Initialize the bamboo config file").option("-i, --interactive", "Run in interactive mode", { default: false }).option("-f, --force", "Force overwrite existing config file").option("-p, --postcss", "Emit postcss config file").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--silent", "Suppress all messages except errors").option("--no-gitignore", "Don't update the .gitignore").option("--no-codegen", "Don't run the codegen logic").option("--out-extension <ext>", "The extension of the generated js files (default: 'mjs')").option("--outdir <dir>", "The output directory for the generated files").option("--strict-tokens", "Using strictTokens: true").option("--logfile <file>", "Outputs logs to a file").action(async (initFlags = {}) => {
139
+ cli.command("init", "Initialize the bamboo config file").option("-i, --interactive", "Run in interactive mode", { default: false }).option("-f, --force", "Force overwrite existing config file").option("-p, --postcss", "Emit postcss config file").option("-c, --config <path>", "Path to bamboo config file").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--silent", "Suppress all messages except errors").option("--no-gitignore", "Don't update the .gitignore").option("--no-codegen", "Don't run the codegen logic").option("--out-extension <ext>", "The extension of the generated js files (default: 'mjs')").option("--outdir <dir>", "The output directory for the generated files").option("--strict-tokens [mode]", "Set strictTokens. Bare for `true`; `--strict-tokens unknown-tokens` for the middle mode").option("--logfile <file>", "Outputs logs to a file").action(async (initFlags = {}) => {
74
140
  let options = {};
75
- if (initFlags.interactive) options = await interactive();
141
+ if (initFlags.interactive) options = await interactive({ cwd: resolve(initFlags.cwd ?? "") });
76
142
  const flags = {
77
143
  ...initFlags,
78
144
  ...options
79
145
  };
80
- const { force, postcss, silent, gitignore, outExtension, config: configPath } = flags;
146
+ const { force, postcss, silent, gitignore, outExtension, strictTokens, config: configPath } = flags;
81
147
  const cwd = resolve(flags.cwd ?? "");
82
148
  if (silent) logger.level = "silent";
83
149
  const stream = setLogStream({
@@ -90,7 +156,8 @@ async function main() {
90
156
  await setupConfig(cwd, compact({
91
157
  force,
92
158
  outExtension,
93
- outdir: flags.outdir
159
+ outdir: flags.outdir,
160
+ strictTokens: normalizeStrictTokens(strictTokens)
94
161
  }));
95
162
  const ctx = await loadConfigAndCreateContext({
96
163
  cwd,
@@ -398,7 +465,7 @@ async function main() {
398
465
  process.exitCode = 1;
399
466
  });
400
467
  cli.command("init-mcp", "Initialize MCP configuration for AI clients").option("--cwd <cwd>", "Current working directory", { default: cwd }).option("--client <clients>", "AI clients to configure (claude, cursor, vscode, windsurf, codex)").action(async (mcpInitFlags) => {
401
- const { initMcpConfig } = await import("./mcp-init-WsO3rA9r.mjs");
468
+ const { initMcpConfig } = await import("./mcp-init-DX5at31x.mjs");
402
469
  const resolvedCwd = resolve(mcpInitFlags.cwd ?? cwd);
403
470
  let clients;
404
471
  if (mcpInitFlags.client) clients = (Array.isArray(mcpInitFlags.client) ? mcpInitFlags.client : [mcpInitFlags.client]).flatMap((c) => c.split(",")).map((c) => c.trim());
@@ -21,18 +21,41 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
+ let _bamboocss_node = require("@bamboocss/node");
24
25
  let _clack_prompts = require("@clack/prompts");
25
26
  _clack_prompts = __toESM(_clack_prompts);
26
27
  //#region package.json
27
- var version = "1.39.1";
28
+ var version = "1.40.0";
28
29
  //#endregion
29
30
  //#region src/interactive.ts
30
- const interactive = async () => {
31
+ /**
32
+ * Which integration this project wants, before anybody is asked.
33
+ *
34
+ * The question is not really a preference. `@bamboocss/vite` compiles every `css()` and `cva()`
35
+ * call to a literal class string; `@bamboocss/postcss` emits the stylesheet and compiles
36
+ * nothing, so those calls stay runtime calls and the style engine ships to the client. Which of
37
+ * the two applies is decided by the bundler, and the answer is on disk: a Vite config means the
38
+ * compiler is available.
39
+ *
40
+ * Asked cold, with `yes` preselected, this steered every Vite project onto the runtime path by
41
+ * pressing Enter — and both setups render identically, so nothing afterwards reveals the
42
+ * choice. That is the same defect the React Router guide had, reached by a different door.
43
+ *
44
+ * Svelte, Vue and Astro are the exception in the other direction: their components are
45
+ * templates the compiler does not transform, so PostCSS is the integration they should be on
46
+ * and the default stays `yes`.
47
+ */
48
+ const suggestPostcss = (cwd) => {
49
+ if (!(0, _bamboocss_node.findViteConfig)(cwd)) return "yes";
50
+ return (0, _bamboocss_node.hasUncompilableSources)({ cwd }) ? "yes" : "no";
51
+ };
52
+ const interactive = async (options = {}) => {
53
+ const postcssDefault = suggestPostcss(options.cwd ?? process.cwd());
31
54
  _clack_prompts.intro(`bamboo v${version}`);
32
55
  const initFlags = await _clack_prompts.group({
33
56
  usePostcss: () => _clack_prompts.select({
34
- message: "Would you like to use PostCSS ?",
35
- initialValue: "yes",
57
+ message: postcssDefault === "no" ? "Emit the stylesheet through PostCSS? This project has a Vite config, and `@bamboocss/vite` compiles your style calls away instead." : "Emit the stylesheet through PostCSS?",
58
+ initialValue: postcssDefault,
36
59
  options: [{
37
60
  value: "yes",
38
61
  label: "Yes"
@@ -53,15 +76,22 @@ const interactive = async () => {
53
76
  }]
54
77
  }),
55
78
  withStrictTokens: () => _clack_prompts.select({
56
- message: "Use strict tokens to enforce full type-safety?",
79
+ message: "How strictly should typescript check style values?",
57
80
  initialValue: "no",
58
- options: [{
59
- value: "yes",
60
- label: "Yes"
61
- }, {
62
- value: "no",
63
- label: "No"
64
- }]
81
+ options: [
82
+ {
83
+ value: "no",
84
+ label: "Not at all — any string is accepted"
85
+ },
86
+ {
87
+ value: "unknown-tokens",
88
+ label: "Reject a value that is neither a token nor a css keyword"
89
+ },
90
+ {
91
+ value: "yes",
92
+ label: "Only tokens — every raw value is written `[14px]`"
93
+ }
94
+ ]
65
95
  }),
66
96
  shouldUpdateGitignore: () => _clack_prompts.select({
67
97
  message: "Update gitignore?",
@@ -82,9 +112,15 @@ const interactive = async () => {
82
112
  return {
83
113
  postcss: initFlags.usePostcss === "yes",
84
114
  outExtension: initFlags.useMjsExtension === "yes" ? "mjs" : "js",
85
- strictTokens: initFlags.withStrictTokens === "yes",
115
+ strictTokens: strictTokensFrom(initFlags.withStrictTokens),
86
116
  gitignore: initFlags.shouldUpdateGitignore === "yes"
87
117
  };
88
118
  };
119
+ /** `'yes'` is the historical spelling of `true`; the third mode names itself. */
120
+ const strictTokensFrom = (answer) => {
121
+ if (answer === "yes") return true;
122
+ if (answer === "unknown-tokens") return "unknown-tokens";
123
+ };
89
124
  //#endregion
90
125
  exports.interactive = interactive;
126
+ exports.suggestPostcss = suggestPostcss;
@@ -1,9 +1,29 @@
1
1
  //#region src/interactive.d.ts
2
- declare const interactive: () => Promise<InitFlags>;
3
- interface InitFlags {
2
+ /**
3
+ * Which integration this project wants, before anybody is asked.
4
+ *
5
+ * The question is not really a preference. `@bamboocss/vite` compiles every `css()` and `cva()`
6
+ * call to a literal class string; `@bamboocss/postcss` emits the stylesheet and compiles
7
+ * nothing, so those calls stay runtime calls and the style engine ships to the client. Which of
8
+ * the two applies is decided by the bundler, and the answer is on disk: a Vite config means the
9
+ * compiler is available.
10
+ *
11
+ * Asked cold, with `yes` preselected, this steered every Vite project onto the runtime path by
12
+ * pressing Enter — and both setups render identically, so nothing afterwards reveals the
13
+ * choice. That is the same defect the React Router guide had, reached by a different door.
14
+ *
15
+ * Svelte, Vue and Astro are the exception in the other direction: their components are
16
+ * templates the compiler does not transform, so PostCSS is the integration they should be on
17
+ * and the default stays `yes`.
18
+ */
19
+ declare const suggestPostcss: (cwd: string) => "yes" | "no";
20
+ declare const interactive: (options?: {
21
+ cwd?: string;
22
+ }) => Promise<{
4
23
  postcss: boolean;
5
- outExtension: string;
24
+ outExtension: "mjs" | "js";
25
+ strictTokens: boolean | "unknown-tokens" | undefined;
6
26
  gitignore: boolean;
7
- }
27
+ }>;
8
28
  //#endregion
9
- export { interactive };
29
+ export { interactive, suggestPostcss };
@@ -1,9 +1,29 @@
1
1
  //#region src/interactive.d.ts
2
- declare const interactive: () => Promise<InitFlags>;
3
- interface InitFlags {
2
+ /**
3
+ * Which integration this project wants, before anybody is asked.
4
+ *
5
+ * The question is not really a preference. `@bamboocss/vite` compiles every `css()` and `cva()`
6
+ * call to a literal class string; `@bamboocss/postcss` emits the stylesheet and compiles
7
+ * nothing, so those calls stay runtime calls and the style engine ships to the client. Which of
8
+ * the two applies is decided by the bundler, and the answer is on disk: a Vite config means the
9
+ * compiler is available.
10
+ *
11
+ * Asked cold, with `yes` preselected, this steered every Vite project onto the runtime path by
12
+ * pressing Enter — and both setups render identically, so nothing afterwards reveals the
13
+ * choice. That is the same defect the React Router guide had, reached by a different door.
14
+ *
15
+ * Svelte, Vue and Astro are the exception in the other direction: their components are
16
+ * templates the compiler does not transform, so PostCSS is the integration they should be on
17
+ * and the default stays `yes`.
18
+ */
19
+ declare const suggestPostcss: (cwd: string) => "yes" | "no";
20
+ declare const interactive: (options?: {
21
+ cwd?: string;
22
+ }) => Promise<{
4
23
  postcss: boolean;
5
- outExtension: string;
24
+ outExtension: "mjs" | "js";
25
+ strictTokens: boolean | "unknown-tokens" | undefined;
6
26
  gitignore: boolean;
7
- }
27
+ }>;
8
28
  //#endregion
9
- export { interactive };
29
+ export { interactive, suggestPostcss };
@@ -1,14 +1,37 @@
1
+ import { findViteConfig, hasUncompilableSources } from "@bamboocss/node";
1
2
  import * as p from "@clack/prompts";
2
3
  //#region package.json
3
- var version = "1.39.1";
4
+ var version = "1.40.0";
4
5
  //#endregion
5
6
  //#region src/interactive.ts
6
- const interactive = async () => {
7
+ /**
8
+ * Which integration this project wants, before anybody is asked.
9
+ *
10
+ * The question is not really a preference. `@bamboocss/vite` compiles every `css()` and `cva()`
11
+ * call to a literal class string; `@bamboocss/postcss` emits the stylesheet and compiles
12
+ * nothing, so those calls stay runtime calls and the style engine ships to the client. Which of
13
+ * the two applies is decided by the bundler, and the answer is on disk: a Vite config means the
14
+ * compiler is available.
15
+ *
16
+ * Asked cold, with `yes` preselected, this steered every Vite project onto the runtime path by
17
+ * pressing Enter — and both setups render identically, so nothing afterwards reveals the
18
+ * choice. That is the same defect the React Router guide had, reached by a different door.
19
+ *
20
+ * Svelte, Vue and Astro are the exception in the other direction: their components are
21
+ * templates the compiler does not transform, so PostCSS is the integration they should be on
22
+ * and the default stays `yes`.
23
+ */
24
+ const suggestPostcss = (cwd) => {
25
+ if (!findViteConfig(cwd)) return "yes";
26
+ return hasUncompilableSources({ cwd }) ? "yes" : "no";
27
+ };
28
+ const interactive = async (options = {}) => {
29
+ const postcssDefault = suggestPostcss(options.cwd ?? process.cwd());
7
30
  p.intro(`bamboo v${version}`);
8
31
  const initFlags = await p.group({
9
32
  usePostcss: () => p.select({
10
- message: "Would you like to use PostCSS ?",
11
- initialValue: "yes",
33
+ message: postcssDefault === "no" ? "Emit the stylesheet through PostCSS? This project has a Vite config, and `@bamboocss/vite` compiles your style calls away instead." : "Emit the stylesheet through PostCSS?",
34
+ initialValue: postcssDefault,
12
35
  options: [{
13
36
  value: "yes",
14
37
  label: "Yes"
@@ -29,15 +52,22 @@ const interactive = async () => {
29
52
  }]
30
53
  }),
31
54
  withStrictTokens: () => p.select({
32
- message: "Use strict tokens to enforce full type-safety?",
55
+ message: "How strictly should typescript check style values?",
33
56
  initialValue: "no",
34
- options: [{
35
- value: "yes",
36
- label: "Yes"
37
- }, {
38
- value: "no",
39
- label: "No"
40
- }]
57
+ options: [
58
+ {
59
+ value: "no",
60
+ label: "Not at all — any string is accepted"
61
+ },
62
+ {
63
+ value: "unknown-tokens",
64
+ label: "Reject a value that is neither a token nor a css keyword"
65
+ },
66
+ {
67
+ value: "yes",
68
+ label: "Only tokens — every raw value is written `[14px]`"
69
+ }
70
+ ]
41
71
  }),
42
72
  shouldUpdateGitignore: () => p.select({
43
73
  message: "Update gitignore?",
@@ -58,9 +88,14 @@ const interactive = async () => {
58
88
  return {
59
89
  postcss: initFlags.usePostcss === "yes",
60
90
  outExtension: initFlags.useMjsExtension === "yes" ? "mjs" : "js",
61
- strictTokens: initFlags.withStrictTokens === "yes",
91
+ strictTokens: strictTokensFrom(initFlags.withStrictTokens),
62
92
  gitignore: initFlags.shouldUpdateGitignore === "yes"
63
93
  };
64
94
  };
95
+ /** `'yes'` is the historical spelling of `true`; the third mode names itself. */
96
+ const strictTokensFrom = (answer) => {
97
+ if (answer === "yes") return true;
98
+ if (answer === "unknown-tokens") return "unknown-tokens";
99
+ };
65
100
  //#endregion
66
- export { interactive };
101
+ export { interactive, suggestPostcss };
@@ -1,4 +1,4 @@
1
- const require_package = require("./package-DM0LsZ_n.cjs");
1
+ const require_package = require("./package-C5AGgVpc.cjs");
2
2
  let _bamboocss_logger = require("@bamboocss/logger");
3
3
  let path = require("path");
4
4
  let _clack_prompts = require("@clack/prompts");
@@ -1,4 +1,4 @@
1
- import { t as version } from "./package-DlXyEbxc.mjs";
1
+ import { t as version } from "./package-C-ms8o9u.mjs";
2
2
  import { logger } from "@bamboocss/logger";
3
3
  import { dirname, resolve } from "path";
4
4
  import * as p from "@clack/prompts";
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "1.39.1";
2
+ var version = "1.40.0";
3
3
  //#endregion
4
4
  export { version as t };
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  }) : target, mod));
22
22
  //#endregion
23
23
  //#region package.json
24
- var version = "1.39.1";
24
+ var version = "1.40.0";
25
25
  //#endregion
26
26
  Object.defineProperty(exports, "__toESM", {
27
27
  enumerable: true,
package/dist/types.d.cts CHANGED
@@ -2,6 +2,12 @@ import { Config } from "@bamboocss/types";
2
2
 
3
3
  //#region src/types.d.ts
4
4
  interface InitCommandFlags extends Pick<Config, 'cwd' | 'poll' | 'watch' | 'gitignore' | 'outExtension' | 'outdir'> {
5
+ /**
6
+ * `--strict-tokens`, which cac gives as `true` when bare and otherwise as whatever followed
7
+ * it — a string, or a number where that looked numeric. `normalizeStrictTokens` is what turns
8
+ * any of those into a setting, or refuses.
9
+ */
10
+ strictTokens?: boolean | string | number;
5
11
  force?: boolean;
6
12
  postcss?: boolean;
7
13
  silent?: boolean;
package/dist/types.d.mts CHANGED
@@ -2,6 +2,12 @@ import { Config } from "@bamboocss/types";
2
2
 
3
3
  //#region src/types.d.ts
4
4
  interface InitCommandFlags extends Pick<Config, 'cwd' | 'poll' | 'watch' | 'gitignore' | 'outExtension' | 'outdir'> {
5
+ /**
6
+ * `--strict-tokens`, which cac gives as `true` when bare and otherwise as whatever followed
7
+ * it — a string, or a number where that looked numeric. `normalizeStrictTokens` is what turns
8
+ * any of those into a setting, or refuses.
9
+ */
10
+ strictTokens?: boolean | string | number;
5
11
  force?: boolean;
6
12
  postcss?: boolean;
7
13
  silent?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/dev",
3
- "version": "1.39.1",
3
+ "version": "1.40.0",
4
4
  "description": "Build-time, type-safe, zero-runtime CSS-in-JS",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -54,14 +54,14 @@
54
54
  "dependencies": {
55
55
  "@clack/prompts": "0.11.0",
56
56
  "cac": "6.7.14",
57
- "@bamboocss/logger": "1.39.1",
58
- "@bamboocss/node": "1.39.1",
59
- "@bamboocss/postcss": "1.39.1",
60
- "@bamboocss/preset-bamboo": "1.39.1",
61
- "@bamboocss/preset-base": "1.39.1",
62
- "@bamboocss/shared": "1.39.1",
63
- "@bamboocss/token-dictionary": "1.39.1",
64
- "@bamboocss/types": "1.39.1"
57
+ "@bamboocss/logger": "1.40.0",
58
+ "@bamboocss/node": "1.40.0",
59
+ "@bamboocss/postcss": "1.40.0",
60
+ "@bamboocss/preset-bamboo": "1.40.0",
61
+ "@bamboocss/preset-base": "1.40.0",
62
+ "@bamboocss/shared": "1.40.0",
63
+ "@bamboocss/token-dictionary": "1.40.0",
64
+ "@bamboocss/types": "1.40.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/update-notifier": "6.0.8",