@bamboocss/vite 1.36.2 → 1.36.4
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 +30 -4
- package/dist/index.mjs +30 -4
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -150,6 +150,19 @@ const VIRTUAL_CSS_ID = "virtual:bamboo.css";
|
|
|
150
150
|
* not to try reading it off disk.
|
|
151
151
|
*/
|
|
152
152
|
const RESOLVED_ID = `\0${VIRTUAL_CSS_ID}`;
|
|
153
|
+
/**
|
|
154
|
+
* A thrown value Vite can actually report.
|
|
155
|
+
*
|
|
156
|
+
* `catch` binds `unknown`, and anything under compilation — a dependency, a config hook, a
|
|
157
|
+
* bare `throw 'string'` — may throw a primitive. Vite's dev error middleware puts what it is
|
|
158
|
+
* handed into a `WeakSet` to deduplicate it, which throws `TypeError: Invalid value used in
|
|
159
|
+
* weak set` for anything that is not an object, and the real failure is lost behind that.
|
|
160
|
+
*
|
|
161
|
+
* Shared by every hook that can throw while the dev server is serving, so the two cannot
|
|
162
|
+
* drift: a request for the stylesheet reaches `load`, and a request for a module reaches
|
|
163
|
+
* `transform`, and both are answered by the same middleware.
|
|
164
|
+
*/
|
|
165
|
+
const asError = (error, context) => error instanceof Error ? error : new Error(`bamboocss: ${context}: ${String(error)}`, { cause: error });
|
|
153
166
|
const INLINE_SOURCE_MAP = /\n?\/\/# sourceMappingURL=data:application\/json[^\n]*$/;
|
|
154
167
|
/** Rewrite one generated chunk without invalidating all mappings after the changed string. */
|
|
155
168
|
const replaceChunkReference = (chunk, bundle, previous, next, sourcemap) => {
|
|
@@ -308,7 +321,12 @@ const bamboocssCss = (options) => {
|
|
|
308
321
|
},
|
|
309
322
|
async load(id) {
|
|
310
323
|
if (id !== RESOLVED_ID) return null;
|
|
311
|
-
|
|
324
|
+
let css;
|
|
325
|
+
try {
|
|
326
|
+
css = await generate();
|
|
327
|
+
} catch (error) {
|
|
328
|
+
throw asError(error, `failed to generate ${VIRTUAL_CSS_ID}`);
|
|
329
|
+
}
|
|
312
330
|
if (this.addWatchFile) for (const file of builder.context?.getFiles() ?? []) this.addWatchFile(builder.context.runtime.path.abs(builder.context.config.cwd, file));
|
|
313
331
|
return css;
|
|
314
332
|
},
|
|
@@ -2873,7 +2891,11 @@ const bamboocss = (options = {}) => {
|
|
|
2873
2891
|
survivorKeys.clear();
|
|
2874
2892
|
recipeConfigCache.clear();
|
|
2875
2893
|
resetStaticCompilationSession(staticSession);
|
|
2876
|
-
|
|
2894
|
+
try {
|
|
2895
|
+
await ensureContext();
|
|
2896
|
+
} catch (error) {
|
|
2897
|
+
throw asError(error, "failed to load the bamboo config");
|
|
2898
|
+
}
|
|
2877
2899
|
},
|
|
2878
2900
|
/**
|
|
2879
2901
|
* Take a changed module out of the parser's hands before the rebuild reads it.
|
|
@@ -2909,7 +2931,11 @@ const bamboocss = (options = {}) => {
|
|
|
2909
2931
|
},
|
|
2910
2932
|
async transform(code, id) {
|
|
2911
2933
|
if (!shouldTransform(id)) return null;
|
|
2912
|
-
|
|
2934
|
+
try {
|
|
2935
|
+
await ensureContext();
|
|
2936
|
+
} catch (error) {
|
|
2937
|
+
throw asError(error, "failed to load the bamboo config");
|
|
2938
|
+
}
|
|
2913
2939
|
if (!ctx || !runtimeCss || !styleCompiler) return null;
|
|
2914
2940
|
const [filePath] = id.split("?");
|
|
2915
2941
|
clearSurvivorsFor(filePath);
|
|
@@ -2942,7 +2968,7 @@ const bamboocss = (options = {}) => {
|
|
|
2942
2968
|
name: "compiler",
|
|
2943
2969
|
reason: "compile-failed"
|
|
2944
2970
|
});
|
|
2945
|
-
if (command === "serve") throw error
|
|
2971
|
+
if (command === "serve") throw asError(error, `failed to compile ${filePath}`);
|
|
2946
2972
|
return null;
|
|
2947
2973
|
}
|
|
2948
2974
|
totals.files++;
|
package/dist/index.mjs
CHANGED
|
@@ -120,6 +120,19 @@ const VIRTUAL_CSS_ID = "virtual:bamboo.css";
|
|
|
120
120
|
* not to try reading it off disk.
|
|
121
121
|
*/
|
|
122
122
|
const RESOLVED_ID = `\0${VIRTUAL_CSS_ID}`;
|
|
123
|
+
/**
|
|
124
|
+
* A thrown value Vite can actually report.
|
|
125
|
+
*
|
|
126
|
+
* `catch` binds `unknown`, and anything under compilation — a dependency, a config hook, a
|
|
127
|
+
* bare `throw 'string'` — may throw a primitive. Vite's dev error middleware puts what it is
|
|
128
|
+
* handed into a `WeakSet` to deduplicate it, which throws `TypeError: Invalid value used in
|
|
129
|
+
* weak set` for anything that is not an object, and the real failure is lost behind that.
|
|
130
|
+
*
|
|
131
|
+
* Shared by every hook that can throw while the dev server is serving, so the two cannot
|
|
132
|
+
* drift: a request for the stylesheet reaches `load`, and a request for a module reaches
|
|
133
|
+
* `transform`, and both are answered by the same middleware.
|
|
134
|
+
*/
|
|
135
|
+
const asError = (error, context) => error instanceof Error ? error : new Error(`bamboocss: ${context}: ${String(error)}`, { cause: error });
|
|
123
136
|
const INLINE_SOURCE_MAP = /\n?\/\/# sourceMappingURL=data:application\/json[^\n]*$/;
|
|
124
137
|
/** Rewrite one generated chunk without invalidating all mappings after the changed string. */
|
|
125
138
|
const replaceChunkReference = (chunk, bundle, previous, next, sourcemap) => {
|
|
@@ -278,7 +291,12 @@ const bamboocssCss = (options) => {
|
|
|
278
291
|
},
|
|
279
292
|
async load(id) {
|
|
280
293
|
if (id !== RESOLVED_ID) return null;
|
|
281
|
-
|
|
294
|
+
let css;
|
|
295
|
+
try {
|
|
296
|
+
css = await generate();
|
|
297
|
+
} catch (error) {
|
|
298
|
+
throw asError(error, `failed to generate ${VIRTUAL_CSS_ID}`);
|
|
299
|
+
}
|
|
282
300
|
if (this.addWatchFile) for (const file of builder.context?.getFiles() ?? []) this.addWatchFile(builder.context.runtime.path.abs(builder.context.config.cwd, file));
|
|
283
301
|
return css;
|
|
284
302
|
},
|
|
@@ -2843,7 +2861,11 @@ const bamboocss = (options = {}) => {
|
|
|
2843
2861
|
survivorKeys.clear();
|
|
2844
2862
|
recipeConfigCache.clear();
|
|
2845
2863
|
resetStaticCompilationSession(staticSession);
|
|
2846
|
-
|
|
2864
|
+
try {
|
|
2865
|
+
await ensureContext();
|
|
2866
|
+
} catch (error) {
|
|
2867
|
+
throw asError(error, "failed to load the bamboo config");
|
|
2868
|
+
}
|
|
2847
2869
|
},
|
|
2848
2870
|
/**
|
|
2849
2871
|
* Take a changed module out of the parser's hands before the rebuild reads it.
|
|
@@ -2879,7 +2901,11 @@ const bamboocss = (options = {}) => {
|
|
|
2879
2901
|
},
|
|
2880
2902
|
async transform(code, id) {
|
|
2881
2903
|
if (!shouldTransform(id)) return null;
|
|
2882
|
-
|
|
2904
|
+
try {
|
|
2905
|
+
await ensureContext();
|
|
2906
|
+
} catch (error) {
|
|
2907
|
+
throw asError(error, "failed to load the bamboo config");
|
|
2908
|
+
}
|
|
2883
2909
|
if (!ctx || !runtimeCss || !styleCompiler) return null;
|
|
2884
2910
|
const [filePath] = id.split("?");
|
|
2885
2911
|
clearSurvivorsFor(filePath);
|
|
@@ -2912,7 +2938,7 @@ const bamboocss = (options = {}) => {
|
|
|
2912
2938
|
name: "compiler",
|
|
2913
2939
|
reason: "compile-failed"
|
|
2914
2940
|
});
|
|
2915
|
-
if (command === "serve") throw error
|
|
2941
|
+
if (command === "serve") throw asError(error, `failed to compile ${filePath}`);
|
|
2916
2942
|
return null;
|
|
2917
2943
|
}
|
|
2918
2944
|
totals.files++;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/vite",
|
|
3
|
-
"version": "1.36.
|
|
3
|
+
"version": "1.36.4",
|
|
4
4
|
"description": "Vite integration for Bamboo CSS",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"postcss": "8.5.26",
|
|
41
41
|
"postcss-selector-parser": "7.1.5",
|
|
42
42
|
"ts-morph": "28.0.0",
|
|
43
|
-
"@bamboocss/config": "1.36.
|
|
44
|
-
"@bamboocss/core": "1.36.
|
|
45
|
-
"@bamboocss/extractor": "1.36.
|
|
46
|
-
"@bamboocss/
|
|
47
|
-
"@bamboocss/
|
|
48
|
-
"@bamboocss/shared": "1.36.
|
|
49
|
-
"@bamboocss/types": "1.36.
|
|
43
|
+
"@bamboocss/config": "1.36.4",
|
|
44
|
+
"@bamboocss/core": "1.36.4",
|
|
45
|
+
"@bamboocss/extractor": "1.36.4",
|
|
46
|
+
"@bamboocss/logger": "1.36.4",
|
|
47
|
+
"@bamboocss/node": "1.36.4",
|
|
48
|
+
"@bamboocss/shared": "1.36.4",
|
|
49
|
+
"@bamboocss/types": "1.36.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
53
53
|
"vite": "7.2.6",
|
|
54
|
-
"@bamboocss/fixture": "1.36.
|
|
54
|
+
"@bamboocss/fixture": "1.36.4"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"vite": ">=5"
|