@bamboocss/vite 1.31.0 → 1.32.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 +16 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +16 -7
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1108,8 +1108,7 @@ const createCssContext = (ctx) => ({
|
|
|
1108
1108
|
hash: Boolean(ctx.hash.className),
|
|
1109
1109
|
conditions: {
|
|
1110
1110
|
shift: ctx.conditions.shift,
|
|
1111
|
-
finalize: ctx.conditions.finalize
|
|
1112
|
-
breakpoints: { keys: ctx.conditions.breakpoints.keys }
|
|
1111
|
+
finalize: ctx.conditions.finalize
|
|
1113
1112
|
},
|
|
1114
1113
|
utility: {
|
|
1115
1114
|
prefix: ctx.utility.prefix,
|
|
@@ -1196,8 +1195,7 @@ const createRuntimeRecipe = (ctx) => {
|
|
|
1196
1195
|
hash: Boolean(ctx.hash.className),
|
|
1197
1196
|
conditions: {
|
|
1198
1197
|
shift: ctx.conditions.shift,
|
|
1199
|
-
finalize: ctx.conditions.finalize
|
|
1200
|
-
breakpoints: { keys: ctx.conditions.breakpoints.keys }
|
|
1198
|
+
finalize: ctx.conditions.finalize
|
|
1201
1199
|
},
|
|
1202
1200
|
utility: {
|
|
1203
1201
|
prefix: ctx.utility.prefix,
|
|
@@ -1280,7 +1278,8 @@ const SURVIVES_TO_RUNTIME = new Set([
|
|
|
1280
1278
|
"unsupported-kind",
|
|
1281
1279
|
"no-call-expression",
|
|
1282
1280
|
"empty",
|
|
1283
|
-
"unresolved-token"
|
|
1281
|
+
"unresolved-token",
|
|
1282
|
+
"fold-failed"
|
|
1284
1283
|
]);
|
|
1285
1284
|
/**
|
|
1286
1285
|
* A call of a recipe the file bound itself: `const badge = cva(...)`, then `badge({ tone })`.
|
|
@@ -2536,6 +2535,14 @@ const bamboocss = (options = {}) => {
|
|
|
2536
2535
|
});
|
|
2537
2536
|
} catch (error) {
|
|
2538
2537
|
_bamboocss_logger.logger.caughtError("vite:transform", `Failed to fold ${filePath}`, error);
|
|
2538
|
+
totals.files++;
|
|
2539
|
+
totals.skipped.set("fold-failed", (totals.skipped.get("fold-failed") ?? 0) + 1);
|
|
2540
|
+
if (failOnUnfolded) survivors.push({
|
|
2541
|
+
file: filePath,
|
|
2542
|
+
line: 1,
|
|
2543
|
+
name: "fold",
|
|
2544
|
+
reason: "fold-failed"
|
|
2545
|
+
});
|
|
2539
2546
|
return null;
|
|
2540
2547
|
}
|
|
2541
2548
|
totals.files++;
|
|
@@ -2576,8 +2583,10 @@ const bamboocss = (options = {}) => {
|
|
|
2576
2583
|
list.push(entry);
|
|
2577
2584
|
byFile.set(entry.file, list);
|
|
2578
2585
|
}
|
|
2579
|
-
const
|
|
2580
|
-
|
|
2586
|
+
const named = (e) => e.reason === "runtime-binding" || e.reason === "fold-failed" ? e.name : `${e.name}()`;
|
|
2587
|
+
const detail = Array.from(byFile.entries()).map(([file, entries]) => [` ${file}`, ...entries.map((e) => ` ${e.line}: ${named(e)} — ${e.reason}`)].join("\n")).join("\n");
|
|
2588
|
+
const threw = survivors.some((entry) => entry.reason === "fold-failed");
|
|
2589
|
+
throw new Error(`bamboocss: ${survivors.length} call(s) could not be folded, and \`failOnUnfolded\` is on.\n\n${detail}\n\n` + (threw ? "`fold-failed` is a module the fold threw on — see the error logged for it above. Nothing was established about its calls either way, so it cannot support the guarantee this option makes.\n\n" : "") + "Each 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.");
|
|
2581
2590
|
}
|
|
2582
2591
|
if (!transform || !reportSummary) return;
|
|
2583
2592
|
const declined = Array.from(totals.skipped.values()).reduce((sum, count) => sum + count, 0);
|
package/dist/index.d.cts
CHANGED
|
@@ -105,7 +105,7 @@ declare const createRuntimeCss: (ctx: Context) => RuntimeCss;
|
|
|
105
105
|
* Why a call site was left alone. Surfaced through `panda`-style diagnostics so a
|
|
106
106
|
* user can tell the difference between "this folded" and "this silently didn't".
|
|
107
107
|
*/
|
|
108
|
-
type SkipReason = 'dynamic' | 'raw-call' | 'not-foldable' | 'recipe-call' | 'unsupported-kind' | 'not-imported' | 'no-call-expression' | 'overlapping' | 'empty' | 'unresolved-token' | 'runtime-binding';
|
|
108
|
+
type SkipReason = 'dynamic' | 'raw-call' | 'not-foldable' | 'recipe-call' | 'unsupported-kind' | 'not-imported' | 'no-call-expression' | 'overlapping' | 'empty' | 'unresolved-token' | 'runtime-binding' | 'fold-failed';
|
|
109
109
|
interface FoldedCall {
|
|
110
110
|
name: string;
|
|
111
111
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -105,7 +105,7 @@ declare const createRuntimeCss: (ctx: Context) => RuntimeCss;
|
|
|
105
105
|
* Why a call site was left alone. Surfaced through `panda`-style diagnostics so a
|
|
106
106
|
* user can tell the difference between "this folded" and "this silently didn't".
|
|
107
107
|
*/
|
|
108
|
-
type SkipReason = 'dynamic' | 'raw-call' | 'not-foldable' | 'recipe-call' | 'unsupported-kind' | 'not-imported' | 'no-call-expression' | 'overlapping' | 'empty' | 'unresolved-token' | 'runtime-binding';
|
|
108
|
+
type SkipReason = 'dynamic' | 'raw-call' | 'not-foldable' | 'recipe-call' | 'unsupported-kind' | 'not-imported' | 'no-call-expression' | 'overlapping' | 'empty' | 'unresolved-token' | 'runtime-binding' | 'fold-failed';
|
|
109
109
|
interface FoldedCall {
|
|
110
110
|
name: string;
|
|
111
111
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1081,8 +1081,7 @@ const createCssContext = (ctx) => ({
|
|
|
1081
1081
|
hash: Boolean(ctx.hash.className),
|
|
1082
1082
|
conditions: {
|
|
1083
1083
|
shift: ctx.conditions.shift,
|
|
1084
|
-
finalize: ctx.conditions.finalize
|
|
1085
|
-
breakpoints: { keys: ctx.conditions.breakpoints.keys }
|
|
1084
|
+
finalize: ctx.conditions.finalize
|
|
1086
1085
|
},
|
|
1087
1086
|
utility: {
|
|
1088
1087
|
prefix: ctx.utility.prefix,
|
|
@@ -1169,8 +1168,7 @@ const createRuntimeRecipe = (ctx) => {
|
|
|
1169
1168
|
hash: Boolean(ctx.hash.className),
|
|
1170
1169
|
conditions: {
|
|
1171
1170
|
shift: ctx.conditions.shift,
|
|
1172
|
-
finalize: ctx.conditions.finalize
|
|
1173
|
-
breakpoints: { keys: ctx.conditions.breakpoints.keys }
|
|
1171
|
+
finalize: ctx.conditions.finalize
|
|
1174
1172
|
},
|
|
1175
1173
|
utility: {
|
|
1176
1174
|
prefix: ctx.utility.prefix,
|
|
@@ -1253,7 +1251,8 @@ const SURVIVES_TO_RUNTIME = new Set([
|
|
|
1253
1251
|
"unsupported-kind",
|
|
1254
1252
|
"no-call-expression",
|
|
1255
1253
|
"empty",
|
|
1256
|
-
"unresolved-token"
|
|
1254
|
+
"unresolved-token",
|
|
1255
|
+
"fold-failed"
|
|
1257
1256
|
]);
|
|
1258
1257
|
/**
|
|
1259
1258
|
* A call of a recipe the file bound itself: `const badge = cva(...)`, then `badge({ tone })`.
|
|
@@ -2509,6 +2508,14 @@ const bamboocss = (options = {}) => {
|
|
|
2509
2508
|
});
|
|
2510
2509
|
} catch (error) {
|
|
2511
2510
|
logger.caughtError("vite:transform", `Failed to fold ${filePath}`, error);
|
|
2511
|
+
totals.files++;
|
|
2512
|
+
totals.skipped.set("fold-failed", (totals.skipped.get("fold-failed") ?? 0) + 1);
|
|
2513
|
+
if (failOnUnfolded) survivors.push({
|
|
2514
|
+
file: filePath,
|
|
2515
|
+
line: 1,
|
|
2516
|
+
name: "fold",
|
|
2517
|
+
reason: "fold-failed"
|
|
2518
|
+
});
|
|
2512
2519
|
return null;
|
|
2513
2520
|
}
|
|
2514
2521
|
totals.files++;
|
|
@@ -2549,8 +2556,10 @@ const bamboocss = (options = {}) => {
|
|
|
2549
2556
|
list.push(entry);
|
|
2550
2557
|
byFile.set(entry.file, list);
|
|
2551
2558
|
}
|
|
2552
|
-
const
|
|
2553
|
-
|
|
2559
|
+
const named = (e) => e.reason === "runtime-binding" || e.reason === "fold-failed" ? e.name : `${e.name}()`;
|
|
2560
|
+
const detail = Array.from(byFile.entries()).map(([file, entries]) => [` ${file}`, ...entries.map((e) => ` ${e.line}: ${named(e)} — ${e.reason}`)].join("\n")).join("\n");
|
|
2561
|
+
const threw = survivors.some((entry) => entry.reason === "fold-failed");
|
|
2562
|
+
throw new Error(`bamboocss: ${survivors.length} call(s) could not be folded, and \`failOnUnfolded\` is on.\n\n${detail}\n\n` + (threw ? "`fold-failed` is a module the fold threw on — see the error logged for it above. Nothing was established about its calls either way, so it cannot support the guarantee this option makes.\n\n" : "") + "Each 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.");
|
|
2554
2563
|
}
|
|
2555
2564
|
if (!transform || !reportSummary) return;
|
|
2556
2565
|
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.
|
|
3
|
+
"version": "1.32.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/
|
|
41
|
-
"@bamboocss/
|
|
42
|
-
"@bamboocss/
|
|
43
|
-
"@bamboocss/
|
|
44
|
-
"@bamboocss/
|
|
45
|
-
"@bamboocss/shared": "1.
|
|
46
|
-
"@bamboocss/types": "1.
|
|
40
|
+
"@bamboocss/core": "1.32.0",
|
|
41
|
+
"@bamboocss/config": "1.32.0",
|
|
42
|
+
"@bamboocss/extractor": "1.32.0",
|
|
43
|
+
"@bamboocss/node": "1.32.0",
|
|
44
|
+
"@bamboocss/logger": "1.32.0",
|
|
45
|
+
"@bamboocss/shared": "1.32.0",
|
|
46
|
+
"@bamboocss/types": "1.32.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
50
50
|
"vite": "7.2.6",
|
|
51
|
-
"@bamboocss/fixture": "1.
|
|
51
|
+
"@bamboocss/fixture": "1.32.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"vite": ">=5"
|