@bamboocss/node 1.52.0 → 1.53.1

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
@@ -275,6 +275,10 @@ const localTargetOf = (specifier, importer, options) => {
275
275
  * records where each file's other imports point; the second walks those edges backwards from
276
276
  * the marked set, because a file that imports a module carrying bamboo bindings may be using
277
277
  * one — a recipe defined with `cva` in one file and called in another is exactly that shape.
278
+ *
279
+ * The edges are worth more than the walk they were built for. Every one of them names a module
280
+ * that is *going* to be demanded, so the same scan that decides what to parse also says what to
281
+ * install — see `auxiliary`.
278
282
  */
279
283
  const selectExtractable = (files, options) => {
280
284
  const keep = /* @__PURE__ */ new Set();
@@ -285,10 +289,7 @@ const selectExtractable = (files, options) => {
285
289
  keep.add(file);
286
290
  continue;
287
291
  }
288
- if (options.entrypoints.some((entrypoint) => text.includes(entrypoint))) {
289
- keep.add(file);
290
- continue;
291
- }
292
+ if (options.entrypoints.some((entrypoint) => text.includes(entrypoint))) keep.add(file);
292
293
  const specifiers = scanSpecifiers(text);
293
294
  if (specifiers === void 0) {
294
295
  keep.add(file);
@@ -312,7 +313,11 @@ const selectExtractable = (files, options) => {
312
313
  }
313
314
  frontier = next;
314
315
  }
315
- return files.filter((file) => keep.has(file));
316
+ const inventory = new Set(files);
317
+ return {
318
+ auxiliary: [...importers.keys()].filter((target) => !inventory.has(target)),
319
+ extractable: files.filter((file) => keep.has(file))
320
+ };
316
321
  };
317
322
  //#endregion
318
323
  //#region ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
@@ -2495,7 +2500,7 @@ var BambooContext = class extends _bamboocss_generator.Generator {
2495
2500
  extractableFiles = (files) => {
2496
2501
  const { baseUrl, paths } = this.project.resolutionOptions;
2497
2502
  const measure = _bamboocss_logger.logger.time.debug("Selected extractable files");
2498
- const extractable = selectExtractable(files, {
2503
+ const { auxiliary, extractable } = selectExtractable(files, {
2499
2504
  baseUrl,
2500
2505
  cwd: this.config.cwd,
2501
2506
  entrypoints: this.entrypointSpecifiers,
@@ -2508,10 +2513,17 @@ var BambooContext = class extends _bamboocss_generator.Generator {
2508
2513
  }
2509
2514
  }
2510
2515
  });
2511
- _bamboocss_logger.logger.debug("file:extract", `${extractable.length} of ${files.length} file(s) can reach a bamboo entrypoint; ${files.length - extractable.length} cannot and are not parsed`);
2516
+ if (auxiliary.length) this.project.addSourceFiles(this.readSources(auxiliary));
2517
+ _bamboocss_logger.logger.debug("file:extract", `${extractable.length} of ${files.length} file(s) can reach a bamboo entrypoint; ${files.length - extractable.length} cannot and are not parsed; ${auxiliary.length} import target(s) outside the inventory installed up front`);
2512
2518
  measure();
2513
2519
  return extractable;
2514
2520
  };
2521
+ /** Path/content pairs for a bulk install, skipping anything that cannot be read. */
2522
+ readSources = function* (files) {
2523
+ for (const file of files) try {
2524
+ yield [file, this.runtime.fs.readFileSync(file)];
2525
+ } catch {}
2526
+ };
2515
2527
  parseFiles = (styleEncoder) => {
2516
2528
  const encoder = styleEncoder || this.parserOptions.encoder;
2517
2529
  const files = this.extractableFiles(this.getFiles());
@@ -2776,8 +2788,8 @@ function accountSnapshot(ctx, snapshot, accounting) {
2776
2788
  });
2777
2789
  return;
2778
2790
  }
2791
+ if (!mentionsToken(ctx, parsed)) return;
2779
2792
  if (ctx.project.getSyntacticDiagnosticCount(filePath)) {
2780
- if (!mentionsToken(ctx, parsed)) return;
2781
2793
  declined.push({
2782
2794
  filePath,
2783
2795
  line: 1,
@@ -2785,7 +2797,6 @@ function accountSnapshot(ctx, snapshot, accounting) {
2785
2797
  });
2786
2798
  return;
2787
2799
  }
2788
- if (!mentionsToken(ctx, parsed)) return;
2789
2800
  accountFile(ctx, sourceFile, filePath, paths, prefixes, declined);
2790
2801
  }
2791
2802
  /**
package/dist/index.d.cts CHANGED
@@ -219,6 +219,8 @@ declare class BambooContext extends Generator {
219
219
  * what is *parsed*, not what the project holds.
220
220
  */
221
221
  extractableFiles: (files: readonly string[]) => string[];
222
+ /** Path/content pairs for a bulk install, skipping anything that cannot be read. */
223
+ private readSources;
222
224
  parseFiles: (styleEncoder?: StyleEncoder) => {
223
225
  filesWithCss: string[];
224
226
  files: string[];
package/dist/index.d.mts CHANGED
@@ -219,6 +219,8 @@ declare class BambooContext extends Generator {
219
219
  * what is *parsed*, not what the project holds.
220
220
  */
221
221
  extractableFiles: (files: readonly string[]) => string[];
222
+ /** Path/content pairs for a bulk install, skipping anything that cannot be read. */
223
+ private readSources;
222
224
  parseFiles: (styleEncoder?: StyleEncoder) => {
223
225
  filesWithCss: string[];
224
226
  files: string[];
package/dist/index.mjs CHANGED
@@ -263,6 +263,10 @@ const localTargetOf = (specifier, importer, options) => {
263
263
  * records where each file's other imports point; the second walks those edges backwards from
264
264
  * the marked set, because a file that imports a module carrying bamboo bindings may be using
265
265
  * one — a recipe defined with `cva` in one file and called in another is exactly that shape.
266
+ *
267
+ * The edges are worth more than the walk they were built for. Every one of them names a module
268
+ * that is *going* to be demanded, so the same scan that decides what to parse also says what to
269
+ * install — see `auxiliary`.
266
270
  */
267
271
  const selectExtractable = (files, options) => {
268
272
  const keep = /* @__PURE__ */ new Set();
@@ -273,10 +277,7 @@ const selectExtractable = (files, options) => {
273
277
  keep.add(file);
274
278
  continue;
275
279
  }
276
- if (options.entrypoints.some((entrypoint) => text.includes(entrypoint))) {
277
- keep.add(file);
278
- continue;
279
- }
280
+ if (options.entrypoints.some((entrypoint) => text.includes(entrypoint))) keep.add(file);
280
281
  const specifiers = scanSpecifiers(text);
281
282
  if (specifiers === void 0) {
282
283
  keep.add(file);
@@ -300,7 +301,11 @@ const selectExtractable = (files, options) => {
300
301
  }
301
302
  frontier = next;
302
303
  }
303
- return files.filter((file) => keep.has(file));
304
+ const inventory = new Set(files);
305
+ return {
306
+ auxiliary: [...importers.keys()].filter((target) => !inventory.has(target)),
307
+ extractable: files.filter((file) => keep.has(file))
308
+ };
304
309
  };
305
310
  //#endregion
306
311
  //#region ../../node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
@@ -2483,7 +2488,7 @@ var BambooContext = class extends Generator {
2483
2488
  extractableFiles = (files) => {
2484
2489
  const { baseUrl, paths } = this.project.resolutionOptions;
2485
2490
  const measure = logger.time.debug("Selected extractable files");
2486
- const extractable = selectExtractable(files, {
2491
+ const { auxiliary, extractable } = selectExtractable(files, {
2487
2492
  baseUrl,
2488
2493
  cwd: this.config.cwd,
2489
2494
  entrypoints: this.entrypointSpecifiers,
@@ -2496,10 +2501,17 @@ var BambooContext = class extends Generator {
2496
2501
  }
2497
2502
  }
2498
2503
  });
2499
- logger.debug("file:extract", `${extractable.length} of ${files.length} file(s) can reach a bamboo entrypoint; ${files.length - extractable.length} cannot and are not parsed`);
2504
+ if (auxiliary.length) this.project.addSourceFiles(this.readSources(auxiliary));
2505
+ logger.debug("file:extract", `${extractable.length} of ${files.length} file(s) can reach a bamboo entrypoint; ${files.length - extractable.length} cannot and are not parsed; ${auxiliary.length} import target(s) outside the inventory installed up front`);
2500
2506
  measure();
2501
2507
  return extractable;
2502
2508
  };
2509
+ /** Path/content pairs for a bulk install, skipping anything that cannot be read. */
2510
+ readSources = function* (files) {
2511
+ for (const file of files) try {
2512
+ yield [file, this.runtime.fs.readFileSync(file)];
2513
+ } catch {}
2514
+ };
2503
2515
  parseFiles = (styleEncoder) => {
2504
2516
  const encoder = styleEncoder || this.parserOptions.encoder;
2505
2517
  const files = this.extractableFiles(this.getFiles());
@@ -2764,8 +2776,8 @@ function accountSnapshot(ctx, snapshot, accounting) {
2764
2776
  });
2765
2777
  return;
2766
2778
  }
2779
+ if (!mentionsToken(ctx, parsed)) return;
2767
2780
  if (ctx.project.getSyntacticDiagnosticCount(filePath)) {
2768
- if (!mentionsToken(ctx, parsed)) return;
2769
2781
  declined.push({
2770
2782
  filePath,
2771
2783
  line: 1,
@@ -2773,7 +2785,6 @@ function accountSnapshot(ctx, snapshot, accounting) {
2773
2785
  });
2774
2786
  return;
2775
2787
  }
2776
- if (!mentionsToken(ctx, parsed)) return;
2777
2788
  accountFile(ctx, sourceFile, filePath, paths, prefixes, declined);
2778
2789
  }
2779
2790
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.52.0",
3
+ "version": "1.53.1",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -61,18 +61,18 @@
61
61
  "pkg-types": "2.3.0",
62
62
  "pluralize": "8.0.0",
63
63
  "ts-pattern": "5.9.0",
64
- "@bamboocss/config": "1.52.0",
65
- "@bamboocss/core": "1.52.0",
66
- "@bamboocss/generator": "1.52.0",
67
- "@bamboocss/logger": "1.52.0",
68
- "@bamboocss/parser": "1.52.0",
69
- "@bamboocss/plugin-svelte": "1.52.0",
70
- "@bamboocss/plugin-vue": "1.52.0",
71
- "@bamboocss/reporter": "1.52.0",
72
- "@bamboocss/shared": "1.52.0",
73
- "@bamboocss/token-dictionary": "1.52.0",
74
- "@bamboocss/ts-ast": "1.52.0",
75
- "@bamboocss/types": "1.52.0"
64
+ "@bamboocss/config": "1.53.1",
65
+ "@bamboocss/core": "1.53.1",
66
+ "@bamboocss/generator": "1.53.1",
67
+ "@bamboocss/logger": "1.53.1",
68
+ "@bamboocss/parser": "1.53.1",
69
+ "@bamboocss/plugin-svelte": "1.53.1",
70
+ "@bamboocss/plugin-vue": "1.53.1",
71
+ "@bamboocss/reporter": "1.53.1",
72
+ "@bamboocss/shared": "1.53.1",
73
+ "@bamboocss/token-dictionary": "1.53.1",
74
+ "@bamboocss/ts-ast": "1.53.1",
75
+ "@bamboocss/types": "1.53.1"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@types/fs-extra": "11.0.4",