@bamboocss/vite 1.35.0 → 1.35.2
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 +17 -5
- package/dist/index.mjs +17 -5
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -163,7 +163,8 @@ const replaceAssetReferences = (bundle, previous, next, sourcemap) => {
|
|
|
163
163
|
continue;
|
|
164
164
|
}
|
|
165
165
|
replaceChunkReference(output, bundle, previous, next, sourcemap);
|
|
166
|
-
|
|
166
|
+
const referencedFiles = output.referencedFiles;
|
|
167
|
+
if (referencedFiles) output.referencedFiles = referencedFiles.map(replace);
|
|
167
168
|
const importedCss = output.viteMetadata?.importedCss;
|
|
168
169
|
if (importedCss?.delete(previous)) importedCss.add(next);
|
|
169
170
|
}
|
|
@@ -2347,11 +2348,17 @@ const foldSource = (options) => {
|
|
|
2347
2348
|
if (skipped.filter((item) => SURVIVES_TO_RUNTIME.has(item.reason) && item.end > item.start).some((item) => nameNode.findReferencesAsNodes().some((ref) => ref.getStart() >= item.start && ref.getStart() < item.end))) continue;
|
|
2348
2349
|
const survivor = nameNode.findReferencesAsNodes().find((ref) => !applied.some(([from, to]) => ref.getStart() >= from && ref.getStart() < to));
|
|
2349
2350
|
if (!survivor) continue;
|
|
2351
|
+
const survivorFile = survivor.getSourceFile();
|
|
2352
|
+
const foreign = survivorFile !== sourceFile;
|
|
2350
2353
|
skipped.push({
|
|
2351
2354
|
name: binding,
|
|
2352
2355
|
reason: "runtime-binding",
|
|
2353
|
-
start: survivor.getStart(),
|
|
2354
|
-
end: survivor.getEnd()
|
|
2356
|
+
start: foreign ? nameNode.getStart() : survivor.getStart(),
|
|
2357
|
+
end: foreign ? nameNode.getEnd() : survivor.getEnd(),
|
|
2358
|
+
...foreign ? { origin: {
|
|
2359
|
+
filePath: survivorFile.getFilePath(),
|
|
2360
|
+
line: survivor.getStartLineNumber()
|
|
2361
|
+
} } : {}
|
|
2355
2362
|
});
|
|
2356
2363
|
}
|
|
2357
2364
|
const bambooModules = [
|
|
@@ -2814,7 +2821,12 @@ const bamboocss = (options = {}) => {
|
|
|
2814
2821
|
for (const entry of result.skipped) {
|
|
2815
2822
|
if (entry.reason === "not-imported" || entry.reason === "overlapping") continue;
|
|
2816
2823
|
if (entry.name === "cx" && entry.reason === "dynamic") continue;
|
|
2817
|
-
addSurvivor({
|
|
2824
|
+
addSurvivor(entry.origin ? {
|
|
2825
|
+
file: entry.origin.filePath,
|
|
2826
|
+
line: entry.origin.line,
|
|
2827
|
+
name: entry.name,
|
|
2828
|
+
reason: entry.reason
|
|
2829
|
+
} : {
|
|
2818
2830
|
file: filePath,
|
|
2819
2831
|
line: lineAt(code, entry.start),
|
|
2820
2832
|
name: entry.name,
|
|
@@ -2834,7 +2846,7 @@ const bamboocss = (options = {}) => {
|
|
|
2834
2846
|
buildEnd() {
|
|
2835
2847
|
if (survivors.length) throw createSurvivorError(survivors);
|
|
2836
2848
|
if (typeof this.getModuleInfo === "function") {
|
|
2837
|
-
if (!staticSession.cssLoaded) throw new Error(`bamboocss: compiled class values were produced, but ${JSON.stringify(VIRTUAL_CSS_ID)} was not imported.
|
|
2849
|
+
if (!staticSession.cssLoaded) throw new Error(`bamboocss: compiled class values were produced, but ${JSON.stringify(VIRTUAL_CSS_ID)} was not imported. Add \`import ${JSON.stringify(VIRTUAL_CSS_ID)}\` once, from a JavaScript or TypeScript module in the application entry graph.\n\nIt has to be a JS import. \`@import\` from a stylesheet does not reach it: the id names a virtual module resolved by this plugin, and Vite resolves CSS \`@import\` before plugin resolution, so it fails as an unresolvable path. A project that ships one preloaded stylesheet imports this from its entry module instead, and lets Vite emit the CSS asset.`);
|
|
2838
2850
|
const outsideExtraction = [...staticSession.transformedFiles].filter((file) => !staticSession.extractedFiles.has(file));
|
|
2839
2851
|
if (outsideExtraction.length) throw new Error(`bamboocss: ${outsideExtraction.length} statically compiled module(s) are outside the CSS extraction graph:\n\n${(0, _bamboocss_shared.truncateList)(outsideExtraction.map((file) => ` ${file}`), {
|
|
2840
2852
|
unit: "file",
|
package/dist/index.mjs
CHANGED
|
@@ -133,7 +133,8 @@ const replaceAssetReferences = (bundle, previous, next, sourcemap) => {
|
|
|
133
133
|
continue;
|
|
134
134
|
}
|
|
135
135
|
replaceChunkReference(output, bundle, previous, next, sourcemap);
|
|
136
|
-
|
|
136
|
+
const referencedFiles = output.referencedFiles;
|
|
137
|
+
if (referencedFiles) output.referencedFiles = referencedFiles.map(replace);
|
|
137
138
|
const importedCss = output.viteMetadata?.importedCss;
|
|
138
139
|
if (importedCss?.delete(previous)) importedCss.add(next);
|
|
139
140
|
}
|
|
@@ -2317,11 +2318,17 @@ const foldSource = (options) => {
|
|
|
2317
2318
|
if (skipped.filter((item) => SURVIVES_TO_RUNTIME.has(item.reason) && item.end > item.start).some((item) => nameNode.findReferencesAsNodes().some((ref) => ref.getStart() >= item.start && ref.getStart() < item.end))) continue;
|
|
2318
2319
|
const survivor = nameNode.findReferencesAsNodes().find((ref) => !applied.some(([from, to]) => ref.getStart() >= from && ref.getStart() < to));
|
|
2319
2320
|
if (!survivor) continue;
|
|
2321
|
+
const survivorFile = survivor.getSourceFile();
|
|
2322
|
+
const foreign = survivorFile !== sourceFile;
|
|
2320
2323
|
skipped.push({
|
|
2321
2324
|
name: binding,
|
|
2322
2325
|
reason: "runtime-binding",
|
|
2323
|
-
start: survivor.getStart(),
|
|
2324
|
-
end: survivor.getEnd()
|
|
2326
|
+
start: foreign ? nameNode.getStart() : survivor.getStart(),
|
|
2327
|
+
end: foreign ? nameNode.getEnd() : survivor.getEnd(),
|
|
2328
|
+
...foreign ? { origin: {
|
|
2329
|
+
filePath: survivorFile.getFilePath(),
|
|
2330
|
+
line: survivor.getStartLineNumber()
|
|
2331
|
+
} } : {}
|
|
2325
2332
|
});
|
|
2326
2333
|
}
|
|
2327
2334
|
const bambooModules = [
|
|
@@ -2784,7 +2791,12 @@ const bamboocss = (options = {}) => {
|
|
|
2784
2791
|
for (const entry of result.skipped) {
|
|
2785
2792
|
if (entry.reason === "not-imported" || entry.reason === "overlapping") continue;
|
|
2786
2793
|
if (entry.name === "cx" && entry.reason === "dynamic") continue;
|
|
2787
|
-
addSurvivor({
|
|
2794
|
+
addSurvivor(entry.origin ? {
|
|
2795
|
+
file: entry.origin.filePath,
|
|
2796
|
+
line: entry.origin.line,
|
|
2797
|
+
name: entry.name,
|
|
2798
|
+
reason: entry.reason
|
|
2799
|
+
} : {
|
|
2788
2800
|
file: filePath,
|
|
2789
2801
|
line: lineAt(code, entry.start),
|
|
2790
2802
|
name: entry.name,
|
|
@@ -2804,7 +2816,7 @@ const bamboocss = (options = {}) => {
|
|
|
2804
2816
|
buildEnd() {
|
|
2805
2817
|
if (survivors.length) throw createSurvivorError(survivors);
|
|
2806
2818
|
if (typeof this.getModuleInfo === "function") {
|
|
2807
|
-
if (!staticSession.cssLoaded) throw new Error(`bamboocss: compiled class values were produced, but ${JSON.stringify(VIRTUAL_CSS_ID)} was not imported.
|
|
2819
|
+
if (!staticSession.cssLoaded) throw new Error(`bamboocss: compiled class values were produced, but ${JSON.stringify(VIRTUAL_CSS_ID)} was not imported. Add \`import ${JSON.stringify(VIRTUAL_CSS_ID)}\` once, from a JavaScript or TypeScript module in the application entry graph.\n\nIt has to be a JS import. \`@import\` from a stylesheet does not reach it: the id names a virtual module resolved by this plugin, and Vite resolves CSS \`@import\` before plugin resolution, so it fails as an unresolvable path. A project that ships one preloaded stylesheet imports this from its entry module instead, and lets Vite emit the CSS asset.`);
|
|
2808
2820
|
const outsideExtraction = [...staticSession.transformedFiles].filter((file) => !staticSession.extractedFiles.has(file));
|
|
2809
2821
|
if (outsideExtraction.length) throw new Error(`bamboocss: ${outsideExtraction.length} statically compiled module(s) are outside the CSS extraction graph:\n\n${truncateList(outsideExtraction.map((file) => ` ${file}`), {
|
|
2810
2822
|
unit: "file",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/vite",
|
|
3
|
-
"version": "1.35.
|
|
3
|
+
"version": "1.35.2",
|
|
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.35.
|
|
44
|
-
"@bamboocss/core": "1.35.
|
|
45
|
-
"@bamboocss/
|
|
46
|
-
"@bamboocss/
|
|
47
|
-
"@bamboocss/
|
|
48
|
-
"@bamboocss/shared": "1.35.
|
|
49
|
-
"@bamboocss/types": "1.35.
|
|
43
|
+
"@bamboocss/config": "1.35.2",
|
|
44
|
+
"@bamboocss/core": "1.35.2",
|
|
45
|
+
"@bamboocss/node": "1.35.2",
|
|
46
|
+
"@bamboocss/extractor": "1.35.2",
|
|
47
|
+
"@bamboocss/logger": "1.35.2",
|
|
48
|
+
"@bamboocss/shared": "1.35.2",
|
|
49
|
+
"@bamboocss/types": "1.35.2"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
53
53
|
"vite": "7.2.6",
|
|
54
|
-
"@bamboocss/fixture": "1.35.
|
|
54
|
+
"@bamboocss/fixture": "1.35.2"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"vite": ">=5"
|