@bamboocss/vite 1.30.1 → 1.31.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.
package/dist/index.cjs CHANGED
@@ -1271,7 +1271,7 @@ const UNFOLDABLE_TYPES = new Set(["cva", "sva"]);
1271
1271
  *
1272
1272
  * `overlapping` is handled by the enclosing fold, and `not-imported` is somebody else's
1273
1273
  * function of the same name — neither leaves a call of ours. `not-foldable` is a `cva`/`sva`
1274
- * definition, which keeps the recipe runtime rather than the css engine; see `strict`.
1274
+ * definition, which keeps the recipe runtime rather than the css engine; see `failOnUnfolded`.
1275
1275
  */
1276
1276
  const SURVIVES_TO_RUNTIME = new Set([
1277
1277
  "dynamic",
@@ -1333,7 +1333,7 @@ const isValueReference = (identifier) => {
1333
1333
  *
1334
1334
  * `cva` and `sva` are there for the reason `SURVIVES_TO_RUNTIME` omits `not-foldable`: a
1335
1335
  * recipe *definition* cannot fold to a class string and never could, and what it keeps is the
1336
- * recipe runtime rather than the css engine — which `strict` accepts. Their unfoldable
1336
+ * recipe runtime rather than the css engine — which `failOnUnfolded` accepts. Their unfoldable
1337
1337
  * invocations are reported separately, as `recipe-call`.
1338
1338
  */
1339
1339
  const PERMITTED_BINDINGS = new Set([
@@ -1356,10 +1356,11 @@ const TRAILING_INDEX = /\/index$/;
1356
1356
  /**
1357
1357
  * An argument that cannot run anything when it is evaluated.
1358
1358
  *
1359
- * `token(path, fallback)` evaluates both arguments before the call, so a fold that drops
1360
- * the fallback also drops whatever evaluating it would have done. `token('x', compute())`
1361
- * is pathological, but the fold's contract is behaviour preservation and a literal is the
1362
- * cheap way to prove it: no call, no property read, no getter.
1359
+ * `token()` takes one argument, but javascript evaluates every argument a call site passes
1360
+ * before the call — so a fold that drops an extra one also drops whatever evaluating it would
1361
+ * have done. `token('x', compute())` is pathological and no longer type-checks, and the fold's
1362
+ * contract is behaviour preservation regardless: a literal is the cheap way to prove it, since
1363
+ * it means no call, no property read, no getter.
1363
1364
  */
1364
1365
  const isInertArgument = (node) => ts_morph.Node.isStringLiteral(node) || ts_morph.Node.isNumericLiteral(node) || ts_morph.Node.isNoSubstitutionTemplateLiteral(node) || node.getKind() === ts_morph.SyntaxKind.TrueKeyword || node.getKind() === ts_morph.SyntaxKind.FalseKeyword || node.getKind() === ts_morph.SyntaxKind.NullKeyword || ts_morph.Node.isIdentifier(node) && node.getText() === "undefined";
1365
1366
  /**
@@ -2268,7 +2269,7 @@ const foldSource = (options) => {
2268
2269
  * Deliberately not driven by `parserResult`: that is the recogniser, and the point here is
2269
2270
  * to catch what it did not see. A namespace import called as `s.cva(...)`, a default
2270
2271
  * import, a specifier that resolved to nothing — each leaves a live reference and no ledger
2271
- * entry at all, which is how `strict` came to pass a build that still shipped the engine.
2272
+ * entry at all, which is how `failOnUnfolded` came to pass a build that still shipped the engine.
2272
2273
  *
2273
2274
  * The helpers the fold itself writes are excluded: `cx`, `cvaPick`, `splitProps` and the
2274
2275
  * leaf helper live in `cx` and pull no engine, so a reference to one is the fold working
@@ -2430,7 +2431,7 @@ const formatSkipped = (id, skipped) => {
2430
2431
  * with no matching rule.
2431
2432
  */
2432
2433
  const bamboocss = (options = {}) => {
2433
- const { transform = true, partial, configPath, cwd, reportSkipped = false, reportSummary = true, strict = false } = options;
2434
+ const { transform = true, partial, configPath, cwd, reportSkipped = false, reportSummary = true, failOnUnfolded = false } = options;
2434
2435
  /** Totals across the build, for the summary. */
2435
2436
  const totals = {
2436
2437
  folded: 0,
@@ -2438,7 +2439,7 @@ const bamboocss = (options = {}) => {
2438
2439
  filesWithFolds: 0,
2439
2440
  skipped: /* @__PURE__ */ new Map()
2440
2441
  };
2441
- /** Under `strict`, every call that would still reach the runtime. */
2442
+ /** Under `failOnUnfolded`, every call that would still reach the runtime. */
2442
2443
  const survivors = [];
2443
2444
  /**
2444
2445
  * Recipe configs read out of modules other than the one being transformed.
@@ -2520,7 +2521,7 @@ const bamboocss = (options = {}) => {
2520
2521
  try {
2521
2522
  const sourceFile = ctx.project.addSourceFile(filePath, code);
2522
2523
  const parserResult = ctx.project.parseSourceFile(filePath);
2523
- if (!parserResult || parserResult.isEmpty() && !strict) return null;
2524
+ if (!parserResult || parserResult.isEmpty() && !failOnUnfolded) return null;
2524
2525
  result = foldSource({
2525
2526
  ctx,
2526
2527
  code,
@@ -2530,7 +2531,7 @@ const bamboocss = (options = {}) => {
2530
2531
  partial,
2531
2532
  parseModule: (path) => ctx?.project.parseSourceFile(path),
2532
2533
  recipeConfigCache,
2533
- reportSurvivors: strict,
2534
+ reportSurvivors: failOnUnfolded,
2534
2535
  sourceFile
2535
2536
  });
2536
2537
  } catch (error) {
@@ -2541,7 +2542,7 @@ const bamboocss = (options = {}) => {
2541
2542
  totals.folded += result.folded.length;
2542
2543
  if (result.folded.length) totals.filesWithFolds++;
2543
2544
  for (const entry of result.skipped) totals.skipped.set(entry.reason, (totals.skipped.get(entry.reason) ?? 0) + 1);
2544
- if (strict) {
2545
+ if (failOnUnfolded) {
2545
2546
  for (const entry of result.skipped) {
2546
2547
  if (!SURVIVES_TO_RUNTIME.has(entry.reason)) continue;
2547
2548
  survivors.push({
@@ -2568,7 +2569,7 @@ const bamboocss = (options = {}) => {
2568
2569
  };
2569
2570
  },
2570
2571
  buildEnd() {
2571
- if (strict && survivors.length) {
2572
+ if (failOnUnfolded && survivors.length) {
2572
2573
  const byFile = /* @__PURE__ */ new Map();
2573
2574
  for (const entry of survivors) {
2574
2575
  const list = byFile.get(entry.file) ?? [];
@@ -2576,7 +2577,7 @@ const bamboocss = (options = {}) => {
2576
2577
  byFile.set(entry.file, list);
2577
2578
  }
2578
2579
  const detail = Array.from(byFile.entries()).map(([file, entries]) => [` ${file}`, ...entries.map((e) => ` ${e.line}: ${e.name}${e.reason === "runtime-binding" ? "" : "()"} — ${e.reason}`)].join("\n")).join("\n");
2579
- throw new Error(`bamboocss: ${survivors.length} call(s) could not be folded, and \`strict\` is on.\n\n${detail}\n\nEach one keeps \`styled-system/css\` in the bundle, so the engine cannot be dropped however many other calls folded. Make the values static, move the variation into a \`cva\` variant, or generate them with \`staticCss\` — or set \`strict: false\` to accept the runtime.`);
2580
+ throw new Error(`bamboocss: ${survivors.length} call(s) could not be folded, and \`failOnUnfolded\` is on.\n\n${detail}\n\nEach one keeps \`styled-system/css\` in the bundle, so the engine cannot be dropped however many other calls folded. Make the values static, move the variation into a \`cva\` variant, or generate them with \`staticCss\` — or set \`failOnUnfolded: false\` to accept the runtime.`);
2580
2581
  }
2581
2582
  if (!transform || !reportSummary) return;
2582
2583
  const declined = Array.from(totals.skipped.values()).reduce((sum, count) => sum + count, 0);
package/dist/index.d.cts CHANGED
@@ -198,7 +198,7 @@ interface FoldOptions {
198
198
  *
199
199
  * This asks what the guarantee actually claims: after the rewrite, is anything from a
200
200
  * bamboo module still referenced? Off by default because it costs an identifier walk, and
201
- * only `strict` needs an answer it can fail a build on.
201
+ * only `failOnUnfolded` needs an answer it can fail a build on.
202
202
  */
203
203
  reportSurvivors?: boolean;
204
204
  /**
@@ -284,9 +284,13 @@ interface BambooVitePluginOptions {
284
284
  * writing recipes — and recipes keep their own much smaller runtime by design. What this
285
285
  * guarantees is narrower and checkable: nothing still calls `css()`.
286
286
  *
287
+ * Named for what it checks. It was `strict`, which meant nothing in common with
288
+ * `strictTokens` or a pattern's old `strict` — three unrelated options sharing a word, to
289
+ * the point that comments in this repo used a bare "strict" for all three.
290
+ *
287
291
  * @default false
288
292
  */
289
- strict?: boolean;
293
+ failOnUnfolded?: boolean;
290
294
  }
291
295
  /**
292
296
  * Vite integration for Bamboo CSS.
package/dist/index.d.mts CHANGED
@@ -198,7 +198,7 @@ interface FoldOptions {
198
198
  *
199
199
  * This asks what the guarantee actually claims: after the rewrite, is anything from a
200
200
  * bamboo module still referenced? Off by default because it costs an identifier walk, and
201
- * only `strict` needs an answer it can fail a build on.
201
+ * only `failOnUnfolded` needs an answer it can fail a build on.
202
202
  */
203
203
  reportSurvivors?: boolean;
204
204
  /**
@@ -284,9 +284,13 @@ interface BambooVitePluginOptions {
284
284
  * writing recipes — and recipes keep their own much smaller runtime by design. What this
285
285
  * guarantees is narrower and checkable: nothing still calls `css()`.
286
286
  *
287
+ * Named for what it checks. It was `strict`, which meant nothing in common with
288
+ * `strictTokens` or a pattern's old `strict` — three unrelated options sharing a word, to
289
+ * the point that comments in this repo used a bare "strict" for all three.
290
+ *
287
291
  * @default false
288
292
  */
289
- strict?: boolean;
293
+ failOnUnfolded?: boolean;
290
294
  }
291
295
  /**
292
296
  * Vite integration for Bamboo CSS.
package/dist/index.mjs CHANGED
@@ -1244,7 +1244,7 @@ const UNFOLDABLE_TYPES = new Set(["cva", "sva"]);
1244
1244
  *
1245
1245
  * `overlapping` is handled by the enclosing fold, and `not-imported` is somebody else's
1246
1246
  * function of the same name — neither leaves a call of ours. `not-foldable` is a `cva`/`sva`
1247
- * definition, which keeps the recipe runtime rather than the css engine; see `strict`.
1247
+ * definition, which keeps the recipe runtime rather than the css engine; see `failOnUnfolded`.
1248
1248
  */
1249
1249
  const SURVIVES_TO_RUNTIME = new Set([
1250
1250
  "dynamic",
@@ -1306,7 +1306,7 @@ const isValueReference = (identifier) => {
1306
1306
  *
1307
1307
  * `cva` and `sva` are there for the reason `SURVIVES_TO_RUNTIME` omits `not-foldable`: a
1308
1308
  * recipe *definition* cannot fold to a class string and never could, and what it keeps is the
1309
- * recipe runtime rather than the css engine — which `strict` accepts. Their unfoldable
1309
+ * recipe runtime rather than the css engine — which `failOnUnfolded` accepts. Their unfoldable
1310
1310
  * invocations are reported separately, as `recipe-call`.
1311
1311
  */
1312
1312
  const PERMITTED_BINDINGS = new Set([
@@ -1329,10 +1329,11 @@ const TRAILING_INDEX = /\/index$/;
1329
1329
  /**
1330
1330
  * An argument that cannot run anything when it is evaluated.
1331
1331
  *
1332
- * `token(path, fallback)` evaluates both arguments before the call, so a fold that drops
1333
- * the fallback also drops whatever evaluating it would have done. `token('x', compute())`
1334
- * is pathological, but the fold's contract is behaviour preservation and a literal is the
1335
- * cheap way to prove it: no call, no property read, no getter.
1332
+ * `token()` takes one argument, but javascript evaluates every argument a call site passes
1333
+ * before the call — so a fold that drops an extra one also drops whatever evaluating it would
1334
+ * have done. `token('x', compute())` is pathological and no longer type-checks, and the fold's
1335
+ * contract is behaviour preservation regardless: a literal is the cheap way to prove it, since
1336
+ * it means no call, no property read, no getter.
1336
1337
  */
1337
1338
  const isInertArgument = (node) => Node.isStringLiteral(node) || Node.isNumericLiteral(node) || Node.isNoSubstitutionTemplateLiteral(node) || node.getKind() === SyntaxKind.TrueKeyword || node.getKind() === SyntaxKind.FalseKeyword || node.getKind() === SyntaxKind.NullKeyword || Node.isIdentifier(node) && node.getText() === "undefined";
1338
1339
  /**
@@ -2241,7 +2242,7 @@ const foldSource = (options) => {
2241
2242
  * Deliberately not driven by `parserResult`: that is the recogniser, and the point here is
2242
2243
  * to catch what it did not see. A namespace import called as `s.cva(...)`, a default
2243
2244
  * import, a specifier that resolved to nothing — each leaves a live reference and no ledger
2244
- * entry at all, which is how `strict` came to pass a build that still shipped the engine.
2245
+ * entry at all, which is how `failOnUnfolded` came to pass a build that still shipped the engine.
2245
2246
  *
2246
2247
  * The helpers the fold itself writes are excluded: `cx`, `cvaPick`, `splitProps` and the
2247
2248
  * leaf helper live in `cx` and pull no engine, so a reference to one is the fold working
@@ -2403,7 +2404,7 @@ const formatSkipped = (id, skipped) => {
2403
2404
  * with no matching rule.
2404
2405
  */
2405
2406
  const bamboocss = (options = {}) => {
2406
- const { transform = true, partial, configPath, cwd, reportSkipped = false, reportSummary = true, strict = false } = options;
2407
+ const { transform = true, partial, configPath, cwd, reportSkipped = false, reportSummary = true, failOnUnfolded = false } = options;
2407
2408
  /** Totals across the build, for the summary. */
2408
2409
  const totals = {
2409
2410
  folded: 0,
@@ -2411,7 +2412,7 @@ const bamboocss = (options = {}) => {
2411
2412
  filesWithFolds: 0,
2412
2413
  skipped: /* @__PURE__ */ new Map()
2413
2414
  };
2414
- /** Under `strict`, every call that would still reach the runtime. */
2415
+ /** Under `failOnUnfolded`, every call that would still reach the runtime. */
2415
2416
  const survivors = [];
2416
2417
  /**
2417
2418
  * Recipe configs read out of modules other than the one being transformed.
@@ -2493,7 +2494,7 @@ const bamboocss = (options = {}) => {
2493
2494
  try {
2494
2495
  const sourceFile = ctx.project.addSourceFile(filePath, code);
2495
2496
  const parserResult = ctx.project.parseSourceFile(filePath);
2496
- if (!parserResult || parserResult.isEmpty() && !strict) return null;
2497
+ if (!parserResult || parserResult.isEmpty() && !failOnUnfolded) return null;
2497
2498
  result = foldSource({
2498
2499
  ctx,
2499
2500
  code,
@@ -2503,7 +2504,7 @@ const bamboocss = (options = {}) => {
2503
2504
  partial,
2504
2505
  parseModule: (path) => ctx?.project.parseSourceFile(path),
2505
2506
  recipeConfigCache,
2506
- reportSurvivors: strict,
2507
+ reportSurvivors: failOnUnfolded,
2507
2508
  sourceFile
2508
2509
  });
2509
2510
  } catch (error) {
@@ -2514,7 +2515,7 @@ const bamboocss = (options = {}) => {
2514
2515
  totals.folded += result.folded.length;
2515
2516
  if (result.folded.length) totals.filesWithFolds++;
2516
2517
  for (const entry of result.skipped) totals.skipped.set(entry.reason, (totals.skipped.get(entry.reason) ?? 0) + 1);
2517
- if (strict) {
2518
+ if (failOnUnfolded) {
2518
2519
  for (const entry of result.skipped) {
2519
2520
  if (!SURVIVES_TO_RUNTIME.has(entry.reason)) continue;
2520
2521
  survivors.push({
@@ -2541,7 +2542,7 @@ const bamboocss = (options = {}) => {
2541
2542
  };
2542
2543
  },
2543
2544
  buildEnd() {
2544
- if (strict && survivors.length) {
2545
+ if (failOnUnfolded && survivors.length) {
2545
2546
  const byFile = /* @__PURE__ */ new Map();
2546
2547
  for (const entry of survivors) {
2547
2548
  const list = byFile.get(entry.file) ?? [];
@@ -2549,7 +2550,7 @@ const bamboocss = (options = {}) => {
2549
2550
  byFile.set(entry.file, list);
2550
2551
  }
2551
2552
  const detail = Array.from(byFile.entries()).map(([file, entries]) => [` ${file}`, ...entries.map((e) => ` ${e.line}: ${e.name}${e.reason === "runtime-binding" ? "" : "()"} — ${e.reason}`)].join("\n")).join("\n");
2552
- throw new Error(`bamboocss: ${survivors.length} call(s) could not be folded, and \`strict\` is on.\n\n${detail}\n\nEach one keeps \`styled-system/css\` in the bundle, so the engine cannot be dropped however many other calls folded. Make the values static, move the variation into a \`cva\` variant, or generate them with \`staticCss\` — or set \`strict: false\` to accept the runtime.`);
2553
+ throw new Error(`bamboocss: ${survivors.length} call(s) could not be folded, and \`failOnUnfolded\` is on.\n\n${detail}\n\nEach one keeps \`styled-system/css\` in the bundle, so the engine cannot be dropped however many other calls folded. Make the values static, move the variation into a \`cva\` variant, or generate them with \`staticCss\` — or set \`failOnUnfolded: false\` to accept the runtime.`);
2553
2554
  }
2554
2555
  if (!transform || !reportSummary) return;
2555
2556
  const declined = Array.from(totals.skipped.values()).reduce((sum, count) => sum + count, 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/vite",
3
- "version": "1.30.1",
3
+ "version": "1.31.0",
4
4
  "description": "Vite integration for Bamboo CSS",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -37,18 +37,18 @@
37
37
  "dependencies": {
38
38
  "magic-string": "0.30.21",
39
39
  "ts-morph": "28.0.0",
40
- "@bamboocss/config": "1.30.1",
41
- "@bamboocss/core": "1.30.1",
42
- "@bamboocss/node": "1.30.1",
43
- "@bamboocss/logger": "1.30.1",
44
- "@bamboocss/extractor": "1.30.1",
45
- "@bamboocss/shared": "1.30.1",
46
- "@bamboocss/types": "1.30.1"
40
+ "@bamboocss/config": "1.31.0",
41
+ "@bamboocss/extractor": "1.31.0",
42
+ "@bamboocss/node": "1.31.0",
43
+ "@bamboocss/logger": "1.31.0",
44
+ "@bamboocss/core": "1.31.0",
45
+ "@bamboocss/shared": "1.31.0",
46
+ "@bamboocss/types": "1.31.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@jridgewell/trace-mapping": "^0.3.31",
50
50
  "vite": "7.2.6",
51
- "@bamboocss/fixture": "1.30.1"
51
+ "@bamboocss/fixture": "1.31.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "vite": ">=5"