@bamboocss/node 1.46.0 → 1.46.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
@@ -3275,6 +3275,8 @@ var Builder = class {
3275
3275
  resolutionConfigurationBytes = /* @__PURE__ */ new Map();
3276
3276
  /** Previous effective tsconfig read-set, needed to classify its deletion as an option reload. */
3277
3277
  tsconfigResolutionFiles = [];
3278
+ /** Config-graph mtimes as of the last completed setup, consulted by the dev fast path. */
3279
+ configGraphMtimes;
3278
3280
  /** @internal Current and missing resolver paths which can change the stylesheet. */
3279
3281
  getResolutionReadFiles = () => {
3280
3282
  const files = /* @__PURE__ */ new Set();
@@ -3347,6 +3349,33 @@ var Builder = class {
3347
3349
  });
3348
3350
  const ctx = this.getContextOrThrow();
3349
3351
  const previousTsconfigFiles = this.tsconfigResolutionFiles.length ? this.tsconfigResolutionFiles : ctx.diff.getResolutionConfigFiles();
3352
+ /**
3353
+ * Dev fast path: skip the config reload when nothing that can change the resolved config
3354
+ * has moved on disk.
3355
+ *
3356
+ * `reloadConfigAndRefreshContext` re-bundles and re-evaluates the config file and the
3357
+ * tsconfig chain on every call, and a dev server reaches `setup` on every stylesheet
3358
+ * rebuild — that is 10–18ms paid per source edit for a config that cannot have changed,
3359
+ * since editing the config restarts the dev server outside this method's control anyway.
3360
+ * The guard set is exactly what the reload would re-read: the config file, its bundled
3361
+ * import graph, the explicit `dependencies`, and the tsconfig files behind resolution. Any
3362
+ * of them moving — including appearing or disappearing, which `getFileMeta` reports as a
3363
+ * changed mtime — takes the full reload below, as does a file the last snapshot never saw.
3364
+ *
3365
+ * Dev-only because the reload is also the recovery for edits this guard cannot see — a
3366
+ * preset external to the config bundle — and a one-shot build keeps paying the reload
3367
+ * rather than trading that recovery for a latency only watch mode feels.
3368
+ */
3369
+ if (options.dev && this.configGraphUnchanged(configPath)) {
3370
+ this.affecteds = {
3371
+ artifacts: /* @__PURE__ */ new Set(),
3372
+ hasConfigChanged: false,
3373
+ diffs: []
3374
+ };
3375
+ this.explicitDepsMeta = this.checkFilesChanged(this.context.explicitDeps);
3376
+ this.refreshSourceState(ctx, previousTsconfigFiles);
3377
+ return;
3378
+ }
3350
3379
  this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
3351
3380
  this.context = new BambooContext(conf);
3352
3381
  });
@@ -3375,8 +3404,35 @@ var Builder = class {
3375
3404
  config: ctx.config,
3376
3405
  changes: this.affecteds
3377
3406
  });
3407
+ this.snapshotConfigGraphMtimes(configPath);
3378
3408
  return;
3379
3409
  }
3410
+ this.refreshSourceState(ctx, previousTsconfigFiles);
3411
+ this.snapshotConfigGraphMtimes(configPath);
3412
+ };
3413
+ /** Every file whose content participates in the resolved config, for the dev fast path. */
3414
+ configGraphFiles = (configPath) => (0, _bamboocss_shared.uniq)([
3415
+ ...configPath ? [configPath] : [],
3416
+ ...this.configDependencies,
3417
+ ...this.tsconfigResolutionFiles,
3418
+ ...this.context?.explicitDeps ?? []
3419
+ ].map(path.normalize));
3420
+ configGraphUnchanged = (configPath) => {
3421
+ const snapshot = this.configGraphMtimes;
3422
+ if (!snapshot) return false;
3423
+ for (const file of this.configGraphFiles(configPath)) {
3424
+ const recorded = snapshot.get(file);
3425
+ if (recorded === void 0 || recorded !== this.getFileMeta(file).mtime) return false;
3426
+ }
3427
+ return true;
3428
+ };
3429
+ snapshotConfigGraphMtimes = (configPath) => {
3430
+ const snapshot = /* @__PURE__ */ new Map();
3431
+ for (const file of this.configGraphFiles(configPath)) snapshot.set(file, this.getFileMeta(file).mtime);
3432
+ this.configGraphMtimes = snapshot;
3433
+ };
3434
+ /** The per-pass source bookkeeping every setup ends with, config reload or not. */
3435
+ refreshSourceState = (ctx, previousTsconfigFiles) => {
3380
3436
  const changedResolutionConfigurations = this.changedResolutionConfigurations();
3381
3437
  const changedResolutionSet = new Set(changedResolutionConfigurations);
3382
3438
  const resolutionAffected = /* @__PURE__ */ new Set();
@@ -3587,7 +3643,7 @@ var Builder = class {
3587
3643
  ctx.assertExtracted();
3588
3644
  return ctx.assertNoDeadCalls();
3589
3645
  }
3590
- const files = ctx.getFiles();
3646
+ const files = !hasConfigChanged && this.sourceInventory ? [...this.sourceInventory] : ctx.getFiles();
3591
3647
  const inventory = new Set(files.map(this.sourcePath));
3592
3648
  if (hasConfigChanged) {
3593
3649
  this.resolutionReadSets.clear();
package/dist/index.d.cts CHANGED
@@ -246,6 +246,8 @@ declare class Builder {
246
246
  private resolutionConfigurationBytes;
247
247
  /** Previous effective tsconfig read-set, needed to classify its deletion as an option reload. */
248
248
  private tsconfigResolutionFiles;
249
+ /** Config-graph mtimes as of the last completed setup, consulted by the dev fast path. */
250
+ private configGraphMtimes;
249
251
  /** @internal Current and missing resolver paths which can change the stylesheet. */
250
252
  getResolutionReadFiles: () => readonly string[];
251
253
  /** @internal Exact local package/tsconfig files which can change semantic resolution. */
@@ -269,6 +271,12 @@ declare class Builder {
269
271
  cwd?: string;
270
272
  dev?: boolean;
271
273
  }) => Promise<BambooContext | undefined>;
274
+ /** Every file whose content participates in the resolved config, for the dev fast path. */
275
+ private configGraphFiles;
276
+ private configGraphUnchanged;
277
+ private snapshotConfigGraphMtimes;
278
+ /** The per-pass source bookkeeping every setup ends with, config reload or not. */
279
+ private refreshSourceState;
272
280
  /** Normalize the path identity shared by the Project ledger and file-owner keys. */
273
281
  private sourcePath;
274
282
  /**
package/dist/index.d.mts CHANGED
@@ -246,6 +246,8 @@ declare class Builder {
246
246
  private resolutionConfigurationBytes;
247
247
  /** Previous effective tsconfig read-set, needed to classify its deletion as an option reload. */
248
248
  private tsconfigResolutionFiles;
249
+ /** Config-graph mtimes as of the last completed setup, consulted by the dev fast path. */
250
+ private configGraphMtimes;
249
251
  /** @internal Current and missing resolver paths which can change the stylesheet. */
250
252
  getResolutionReadFiles: () => readonly string[];
251
253
  /** @internal Exact local package/tsconfig files which can change semantic resolution. */
@@ -269,6 +271,12 @@ declare class Builder {
269
271
  cwd?: string;
270
272
  dev?: boolean;
271
273
  }) => Promise<BambooContext | undefined>;
274
+ /** Every file whose content participates in the resolved config, for the dev fast path. */
275
+ private configGraphFiles;
276
+ private configGraphUnchanged;
277
+ private snapshotConfigGraphMtimes;
278
+ /** The per-pass source bookkeeping every setup ends with, config reload or not. */
279
+ private refreshSourceState;
272
280
  /** Normalize the path identity shared by the Project ledger and file-owner keys. */
273
281
  private sourcePath;
274
282
  /**
package/dist/index.mjs CHANGED
@@ -3261,6 +3261,8 @@ var Builder = class {
3261
3261
  resolutionConfigurationBytes = /* @__PURE__ */ new Map();
3262
3262
  /** Previous effective tsconfig read-set, needed to classify its deletion as an option reload. */
3263
3263
  tsconfigResolutionFiles = [];
3264
+ /** Config-graph mtimes as of the last completed setup, consulted by the dev fast path. */
3265
+ configGraphMtimes;
3264
3266
  /** @internal Current and missing resolver paths which can change the stylesheet. */
3265
3267
  getResolutionReadFiles = () => {
3266
3268
  const files = /* @__PURE__ */ new Set();
@@ -3333,6 +3335,33 @@ var Builder = class {
3333
3335
  });
3334
3336
  const ctx = this.getContextOrThrow();
3335
3337
  const previousTsconfigFiles = this.tsconfigResolutionFiles.length ? this.tsconfigResolutionFiles : ctx.diff.getResolutionConfigFiles();
3338
+ /**
3339
+ * Dev fast path: skip the config reload when nothing that can change the resolved config
3340
+ * has moved on disk.
3341
+ *
3342
+ * `reloadConfigAndRefreshContext` re-bundles and re-evaluates the config file and the
3343
+ * tsconfig chain on every call, and a dev server reaches `setup` on every stylesheet
3344
+ * rebuild — that is 10–18ms paid per source edit for a config that cannot have changed,
3345
+ * since editing the config restarts the dev server outside this method's control anyway.
3346
+ * The guard set is exactly what the reload would re-read: the config file, its bundled
3347
+ * import graph, the explicit `dependencies`, and the tsconfig files behind resolution. Any
3348
+ * of them moving — including appearing or disappearing, which `getFileMeta` reports as a
3349
+ * changed mtime — takes the full reload below, as does a file the last snapshot never saw.
3350
+ *
3351
+ * Dev-only because the reload is also the recovery for edits this guard cannot see — a
3352
+ * preset external to the config bundle — and a one-shot build keeps paying the reload
3353
+ * rather than trading that recovery for a latency only watch mode feels.
3354
+ */
3355
+ if (options.dev && this.configGraphUnchanged(configPath)) {
3356
+ this.affecteds = {
3357
+ artifacts: /* @__PURE__ */ new Set(),
3358
+ hasConfigChanged: false,
3359
+ diffs: []
3360
+ };
3361
+ this.explicitDepsMeta = this.checkFilesChanged(this.context.explicitDeps);
3362
+ this.refreshSourceState(ctx, previousTsconfigFiles);
3363
+ return;
3364
+ }
3336
3365
  this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
3337
3366
  this.context = new BambooContext(conf);
3338
3367
  });
@@ -3361,8 +3390,35 @@ var Builder = class {
3361
3390
  config: ctx.config,
3362
3391
  changes: this.affecteds
3363
3392
  });
3393
+ this.snapshotConfigGraphMtimes(configPath);
3364
3394
  return;
3365
3395
  }
3396
+ this.refreshSourceState(ctx, previousTsconfigFiles);
3397
+ this.snapshotConfigGraphMtimes(configPath);
3398
+ };
3399
+ /** Every file whose content participates in the resolved config, for the dev fast path. */
3400
+ configGraphFiles = (configPath) => uniq([
3401
+ ...configPath ? [configPath] : [],
3402
+ ...this.configDependencies,
3403
+ ...this.tsconfigResolutionFiles,
3404
+ ...this.context?.explicitDeps ?? []
3405
+ ].map(normalize));
3406
+ configGraphUnchanged = (configPath) => {
3407
+ const snapshot = this.configGraphMtimes;
3408
+ if (!snapshot) return false;
3409
+ for (const file of this.configGraphFiles(configPath)) {
3410
+ const recorded = snapshot.get(file);
3411
+ if (recorded === void 0 || recorded !== this.getFileMeta(file).mtime) return false;
3412
+ }
3413
+ return true;
3414
+ };
3415
+ snapshotConfigGraphMtimes = (configPath) => {
3416
+ const snapshot = /* @__PURE__ */ new Map();
3417
+ for (const file of this.configGraphFiles(configPath)) snapshot.set(file, this.getFileMeta(file).mtime);
3418
+ this.configGraphMtimes = snapshot;
3419
+ };
3420
+ /** The per-pass source bookkeeping every setup ends with, config reload or not. */
3421
+ refreshSourceState = (ctx, previousTsconfigFiles) => {
3366
3422
  const changedResolutionConfigurations = this.changedResolutionConfigurations();
3367
3423
  const changedResolutionSet = new Set(changedResolutionConfigurations);
3368
3424
  const resolutionAffected = /* @__PURE__ */ new Set();
@@ -3573,7 +3629,7 @@ var Builder = class {
3573
3629
  ctx.assertExtracted();
3574
3630
  return ctx.assertNoDeadCalls();
3575
3631
  }
3576
- const files = ctx.getFiles();
3632
+ const files = !hasConfigChanged && this.sourceInventory ? [...this.sourceInventory] : ctx.getFiles();
3577
3633
  const inventory = new Set(files.map(this.sourcePath));
3578
3634
  if (hasConfigChanged) {
3579
3635
  this.resolutionReadSets.clear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/node",
3
- "version": "1.46.0",
3
+ "version": "1.46.1",
4
4
  "description": "The core css bamboo library",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -65,17 +65,17 @@
65
65
  "postcss": "8.5.26",
66
66
  "ts-morph": "28.0.0",
67
67
  "ts-pattern": "5.9.0",
68
- "@bamboocss/config": "1.46.0",
69
- "@bamboocss/core": "1.46.0",
70
- "@bamboocss/logger": "1.46.0",
71
- "@bamboocss/parser": "1.46.0",
72
- "@bamboocss/generator": "1.46.0",
73
- "@bamboocss/plugin-svelte": "1.46.0",
74
- "@bamboocss/plugin-vue": "1.46.0",
75
- "@bamboocss/reporter": "1.46.0",
76
- "@bamboocss/shared": "1.46.0",
77
- "@bamboocss/token-dictionary": "1.46.0",
78
- "@bamboocss/types": "1.46.0"
68
+ "@bamboocss/config": "1.46.1",
69
+ "@bamboocss/core": "1.46.1",
70
+ "@bamboocss/generator": "1.46.1",
71
+ "@bamboocss/logger": "1.46.1",
72
+ "@bamboocss/parser": "1.46.1",
73
+ "@bamboocss/plugin-svelte": "1.46.1",
74
+ "@bamboocss/plugin-vue": "1.46.1",
75
+ "@bamboocss/reporter": "1.46.1",
76
+ "@bamboocss/shared": "1.46.1",
77
+ "@bamboocss/token-dictionary": "1.46.1",
78
+ "@bamboocss/types": "1.46.1"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@types/fs-extra": "11.0.4",