@bamboocss/vite 1.35.1 → 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 CHANGED
@@ -2348,11 +2348,17 @@ const foldSource = (options) => {
2348
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;
2349
2349
  const survivor = nameNode.findReferencesAsNodes().find((ref) => !applied.some(([from, to]) => ref.getStart() >= from && ref.getStart() < to));
2350
2350
  if (!survivor) continue;
2351
+ const survivorFile = survivor.getSourceFile();
2352
+ const foreign = survivorFile !== sourceFile;
2351
2353
  skipped.push({
2352
2354
  name: binding,
2353
2355
  reason: "runtime-binding",
2354
- start: survivor.getStart(),
2355
- 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
+ } } : {}
2356
2362
  });
2357
2363
  }
2358
2364
  const bambooModules = [
@@ -2815,7 +2821,12 @@ const bamboocss = (options = {}) => {
2815
2821
  for (const entry of result.skipped) {
2816
2822
  if (entry.reason === "not-imported" || entry.reason === "overlapping") continue;
2817
2823
  if (entry.name === "cx" && entry.reason === "dynamic") continue;
2818
- addSurvivor({
2824
+ addSurvivor(entry.origin ? {
2825
+ file: entry.origin.filePath,
2826
+ line: entry.origin.line,
2827
+ name: entry.name,
2828
+ reason: entry.reason
2829
+ } : {
2819
2830
  file: filePath,
2820
2831
  line: lineAt(code, entry.start),
2821
2832
  name: entry.name,
@@ -2835,7 +2846,7 @@ const bamboocss = (options = {}) => {
2835
2846
  buildEnd() {
2836
2847
  if (survivors.length) throw createSurvivorError(survivors);
2837
2848
  if (typeof this.getModuleInfo === "function") {
2838
- if (!staticSession.cssLoaded) throw new Error(`bamboocss: compiled class values were produced, but ${JSON.stringify(VIRTUAL_CSS_ID)} was not imported. Import it once from the application entry so the compiled rules are emitted.`);
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.`);
2839
2850
  const outsideExtraction = [...staticSession.transformedFiles].filter((file) => !staticSession.extractedFiles.has(file));
2840
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}`), {
2841
2852
  unit: "file",
package/dist/index.mjs CHANGED
@@ -2318,11 +2318,17 @@ const foldSource = (options) => {
2318
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;
2319
2319
  const survivor = nameNode.findReferencesAsNodes().find((ref) => !applied.some(([from, to]) => ref.getStart() >= from && ref.getStart() < to));
2320
2320
  if (!survivor) continue;
2321
+ const survivorFile = survivor.getSourceFile();
2322
+ const foreign = survivorFile !== sourceFile;
2321
2323
  skipped.push({
2322
2324
  name: binding,
2323
2325
  reason: "runtime-binding",
2324
- start: survivor.getStart(),
2325
- 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
+ } } : {}
2326
2332
  });
2327
2333
  }
2328
2334
  const bambooModules = [
@@ -2785,7 +2791,12 @@ const bamboocss = (options = {}) => {
2785
2791
  for (const entry of result.skipped) {
2786
2792
  if (entry.reason === "not-imported" || entry.reason === "overlapping") continue;
2787
2793
  if (entry.name === "cx" && entry.reason === "dynamic") continue;
2788
- addSurvivor({
2794
+ addSurvivor(entry.origin ? {
2795
+ file: entry.origin.filePath,
2796
+ line: entry.origin.line,
2797
+ name: entry.name,
2798
+ reason: entry.reason
2799
+ } : {
2789
2800
  file: filePath,
2790
2801
  line: lineAt(code, entry.start),
2791
2802
  name: entry.name,
@@ -2805,7 +2816,7 @@ const bamboocss = (options = {}) => {
2805
2816
  buildEnd() {
2806
2817
  if (survivors.length) throw createSurvivorError(survivors);
2807
2818
  if (typeof this.getModuleInfo === "function") {
2808
- if (!staticSession.cssLoaded) throw new Error(`bamboocss: compiled class values were produced, but ${JSON.stringify(VIRTUAL_CSS_ID)} was not imported. Import it once from the application entry so the compiled rules are emitted.`);
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.`);
2809
2820
  const outsideExtraction = [...staticSession.transformedFiles].filter((file) => !staticSession.extractedFiles.has(file));
2810
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}`), {
2811
2822
  unit: "file",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/vite",
3
- "version": "1.35.1",
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.1",
44
- "@bamboocss/core": "1.35.1",
45
- "@bamboocss/extractor": "1.35.1",
46
- "@bamboocss/node": "1.35.1",
47
- "@bamboocss/logger": "1.35.1",
48
- "@bamboocss/shared": "1.35.1",
49
- "@bamboocss/types": "1.35.1"
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.1"
54
+ "@bamboocss/fixture": "1.35.2"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "vite": ">=5"