@bamboocss/node 1.48.0 → 1.48.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 +113 -26
- package/dist/index.d.cts +25 -7
- package/dist/index.d.mts +25 -7
- package/dist/index.mjs +112 -25
- package/package.json +12 -12
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,8 @@ let _bamboocss_shared = require("@bamboocss/shared");
|
|
|
30
30
|
let node_crypto = require("node:crypto");
|
|
31
31
|
let fs = require("fs");
|
|
32
32
|
let path = require("path");
|
|
33
|
+
let picomatch = require("picomatch");
|
|
34
|
+
picomatch = __toESM(picomatch);
|
|
33
35
|
let _bamboocss_plugin_svelte = require("@bamboocss/plugin-svelte");
|
|
34
36
|
let _bamboocss_plugin_vue = require("@bamboocss/plugin-vue");
|
|
35
37
|
let _bamboocss_core = require("@bamboocss/core");
|
|
@@ -53,8 +55,6 @@ let fast_glob = require("fast-glob");
|
|
|
53
55
|
fast_glob = __toESM(fast_glob);
|
|
54
56
|
let fs_extra = require("fs-extra");
|
|
55
57
|
fs_extra = __toESM(fs_extra);
|
|
56
|
-
let picomatch = require("picomatch");
|
|
57
|
-
picomatch = __toESM(picomatch);
|
|
58
58
|
let matcher = require("matcher");
|
|
59
59
|
let _bamboocss_config_ts_path = require("@bamboocss/config/ts-path");
|
|
60
60
|
let node_readline = require("node:readline");
|
|
@@ -3268,6 +3268,48 @@ const assembleExtractedSheet = (ctx, { layerParams = false, sourceScanCache, mti
|
|
|
3268
3268
|
//#endregion
|
|
3269
3269
|
//#region src/builder.ts
|
|
3270
3270
|
const fileModifiedMap = /* @__PURE__ */ new Map();
|
|
3271
|
+
/** Binary minimum heap; callers provide the stable semantic rank used for ties/order. */
|
|
3272
|
+
var MinPriorityQueue = class {
|
|
3273
|
+
compare;
|
|
3274
|
+
values = [];
|
|
3275
|
+
constructor(compare) {
|
|
3276
|
+
this.compare = compare;
|
|
3277
|
+
}
|
|
3278
|
+
get size() {
|
|
3279
|
+
return this.values.length;
|
|
3280
|
+
}
|
|
3281
|
+
push = (value) => {
|
|
3282
|
+
let index = this.values.length;
|
|
3283
|
+
this.values.push(value);
|
|
3284
|
+
while (index > 0) {
|
|
3285
|
+
const parent = index - 1 >> 1;
|
|
3286
|
+
const parentValue = this.values[parent];
|
|
3287
|
+
if (this.compare(value, parentValue) >= 0) break;
|
|
3288
|
+
this.values[index] = parentValue;
|
|
3289
|
+
index = parent;
|
|
3290
|
+
}
|
|
3291
|
+
this.values[index] = value;
|
|
3292
|
+
};
|
|
3293
|
+
pop = () => {
|
|
3294
|
+
if (!this.values.length) return void 0;
|
|
3295
|
+
const first = this.values[0];
|
|
3296
|
+
const last = this.values.pop();
|
|
3297
|
+
if (!this.values.length) return first;
|
|
3298
|
+
let index = 0;
|
|
3299
|
+
while (true) {
|
|
3300
|
+
const left = index * 2 + 1;
|
|
3301
|
+
if (left >= this.values.length) break;
|
|
3302
|
+
const right = left + 1;
|
|
3303
|
+
let next = left;
|
|
3304
|
+
if (right < this.values.length && this.compare(this.values[right], this.values[left]) < 0) next = right;
|
|
3305
|
+
if (this.compare(last, this.values[next]) <= 0) break;
|
|
3306
|
+
this.values[index] = this.values[next];
|
|
3307
|
+
index = next;
|
|
3308
|
+
}
|
|
3309
|
+
this.values[index] = last;
|
|
3310
|
+
return first;
|
|
3311
|
+
};
|
|
3312
|
+
};
|
|
3271
3313
|
var Builder = class {
|
|
3272
3314
|
/**
|
|
3273
3315
|
* The current bamboo context
|
|
@@ -3351,6 +3393,26 @@ var Builder = class {
|
|
|
3351
3393
|
]) for (const dependencies of readSets.values()) for (const dependency of dependencies) files.add(dependency);
|
|
3352
3394
|
return Object.freeze([...files].sort());
|
|
3353
3395
|
};
|
|
3396
|
+
/** @internal The inventory reconciled by the most recent extraction pass. */
|
|
3397
|
+
getSourceFiles = () => Object.freeze([...this.sourceInventory ?? []]);
|
|
3398
|
+
/** @internal Whether creating this path can change source or explicit-dependency membership. */
|
|
3399
|
+
isPotentialSourceFile = (filePath) => {
|
|
3400
|
+
const ctx = this.getContextOrThrow();
|
|
3401
|
+
const absolutePath = this.absOwner(ctx, filePath);
|
|
3402
|
+
const relativePath = this.sourcePath(ctx.runtime.path.relative(ctx.config.cwd, absolutePath));
|
|
3403
|
+
const sourcePatterns = ctx.config.include ?? [];
|
|
3404
|
+
const sourceMatcher = sourcePatterns.length ? (0, picomatch.default)(sourcePatterns, { ignore: globIgnore(ctx.config.exclude) }) : void 0;
|
|
3405
|
+
return sourceMatcher?.(relativePath) || sourceMatcher?.(absolutePath) || false;
|
|
3406
|
+
};
|
|
3407
|
+
/** @internal Whether creating or deleting this path can change a `dependencies` glob. */
|
|
3408
|
+
isPotentialConfigDependency = (filePath) => {
|
|
3409
|
+
const ctx = this.getContextOrThrow();
|
|
3410
|
+
const absolutePath = this.absOwner(ctx, filePath);
|
|
3411
|
+
const relativePath = this.sourcePath(ctx.runtime.path.relative(ctx.config.cwd, absolutePath));
|
|
3412
|
+
const patterns = ctx.config.dependencies ?? [];
|
|
3413
|
+
const matcher = patterns.length ? (0, picomatch.default)(patterns) : void 0;
|
|
3414
|
+
return matcher?.(relativePath) || matcher?.(absolutePath) || false;
|
|
3415
|
+
};
|
|
3354
3416
|
/** @internal Exact local package/tsconfig files which can change semantic resolution. */
|
|
3355
3417
|
getResolutionConfigurationFiles = () => {
|
|
3356
3418
|
const files = /* @__PURE__ */ new Set();
|
|
@@ -3365,7 +3427,7 @@ var Builder = class {
|
|
|
3365
3427
|
throw error;
|
|
3366
3428
|
}
|
|
3367
3429
|
};
|
|
3368
|
-
changedResolutionConfigurations = () => this.getResolutionConfigurationFiles().filter((file) => this.resolutionConfigurationBytes.get(file) !== this.readResolutionConfiguration(file));
|
|
3430
|
+
changedResolutionConfigurations = (knownChanges) => this.getResolutionConfigurationFiles().filter((file) => (!knownChanges || knownChanges.has(this.sourcePath(file))) && this.resolutionConfigurationBytes.get(file) !== this.readResolutionConfiguration(file));
|
|
3369
3431
|
snapshotResolutionConfigurations = () => {
|
|
3370
3432
|
const current = new Set(this.getResolutionConfigurationFiles());
|
|
3371
3433
|
for (const file of current) this.resolutionConfigurationBytes.set(file, this.readResolutionConfiguration(file));
|
|
@@ -3384,6 +3446,7 @@ var Builder = class {
|
|
|
3384
3446
|
dev: options.dev
|
|
3385
3447
|
});
|
|
3386
3448
|
const ctx = this.getContextOrThrow();
|
|
3449
|
+
const previousExplicitDeps = [...ctx.explicitDeps];
|
|
3387
3450
|
const previousTsconfigFiles = this.tsconfigResolutionFiles.length ? this.tsconfigResolutionFiles : ctx.diff.getResolutionConfigFiles();
|
|
3388
3451
|
/**
|
|
3389
3452
|
* Dev fast path: skip the config reload when nothing that can change the resolved config
|
|
@@ -3402,24 +3465,33 @@ var Builder = class {
|
|
|
3402
3465
|
* preset external to the config bundle — and a one-shot build keeps paying the reload
|
|
3403
3466
|
* rather than trading that recovery for a latency only watch mode feels.
|
|
3404
3467
|
*/
|
|
3405
|
-
if (options.dev && this.configGraphUnchanged(configPath)) {
|
|
3468
|
+
if (options.dev && this.configGraphUnchanged(configPath, options.sourceChanges)) {
|
|
3406
3469
|
this.affecteds = {
|
|
3407
3470
|
artifacts: /* @__PURE__ */ new Set(),
|
|
3408
3471
|
hasConfigChanged: false,
|
|
3409
3472
|
diffs: []
|
|
3410
3473
|
};
|
|
3411
3474
|
this.explicitDepsMeta = this.checkFilesChanged(this.context.explicitDeps);
|
|
3412
|
-
this.refreshSourceState(ctx, previousTsconfigFiles);
|
|
3475
|
+
this.refreshSourceState(ctx, previousTsconfigFiles, options.sourceChanges);
|
|
3413
3476
|
return;
|
|
3414
3477
|
}
|
|
3415
3478
|
this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
|
|
3416
3479
|
this.context = new BambooContext(conf);
|
|
3417
3480
|
});
|
|
3418
3481
|
const nextContext = this.getContextOrThrow();
|
|
3482
|
+
if (options.sourceChanges?.needsConfigReload) {
|
|
3483
|
+
const { cwd: configCwd, dependencies } = nextContext.config;
|
|
3484
|
+
nextContext.explicitDeps = dependencies ? nextContext.runtime.fs.glob({
|
|
3485
|
+
include: dependencies,
|
|
3486
|
+
cwd: configCwd
|
|
3487
|
+
}) : [];
|
|
3488
|
+
}
|
|
3419
3489
|
this.recordConfigDependencies(nextContext, options.cwd);
|
|
3420
3490
|
this.tsconfigResolutionFiles = nextContext.diff.getResolutionConfigFiles();
|
|
3421
3491
|
_bamboocss_logger.logger.debug("builder", this.affecteds);
|
|
3422
|
-
|
|
3492
|
+
const explicitDeps = options.sourceChanges?.needsConfigReload ? (0, _bamboocss_shared.uniq)([...previousExplicitDeps, ...this.context.explicitDeps]) : this.context.explicitDeps;
|
|
3493
|
+
const knownChanges = options.sourceChanges ? new Set(options.sourceChanges.files.map((file) => this.absOwner(this.context, file))) : void 0;
|
|
3494
|
+
this.explicitDepsMeta = this.checkFilesChanged(explicitDeps, knownChanges);
|
|
3423
3495
|
if (this.explicitDepsMeta.hasFilesChanged) {
|
|
3424
3496
|
this.explicitDepsMeta.changes.forEach((meta, file) => {
|
|
3425
3497
|
fileModifiedMap.set(file, meta.mtime);
|
|
@@ -3449,7 +3521,7 @@ var Builder = class {
|
|
|
3449
3521
|
this.snapshotConfigGraphMtimes(configPath);
|
|
3450
3522
|
return;
|
|
3451
3523
|
}
|
|
3452
|
-
this.refreshSourceState(ctx, previousTsconfigFiles);
|
|
3524
|
+
this.refreshSourceState(ctx, previousTsconfigFiles, options.sourceChanges);
|
|
3453
3525
|
this.snapshotConfigGraphMtimes(configPath);
|
|
3454
3526
|
};
|
|
3455
3527
|
/** Every file whose content participates in the resolved config, for the dev fast path. */
|
|
@@ -3459,10 +3531,13 @@ var Builder = class {
|
|
|
3459
3531
|
...this.tsconfigResolutionFiles,
|
|
3460
3532
|
...this.context?.explicitDeps ?? []
|
|
3461
3533
|
].map(path.normalize));
|
|
3462
|
-
configGraphUnchanged = (configPath) => {
|
|
3534
|
+
configGraphUnchanged = (configPath, sourceChanges) => {
|
|
3463
3535
|
const snapshot = this.configGraphMtimes;
|
|
3464
3536
|
if (!snapshot) return false;
|
|
3537
|
+
if (sourceChanges?.needsConfigReload) return false;
|
|
3538
|
+
const changed = sourceChanges ? new Set(sourceChanges.files.map((file) => this.sourcePath((0, path.resolve)(this.context?.config.cwd ?? "", file)))) : void 0;
|
|
3465
3539
|
for (const file of this.configGraphFiles(configPath)) {
|
|
3540
|
+
if (changed?.has(this.sourcePath((0, path.resolve)(this.context?.config.cwd ?? "", file)))) return false;
|
|
3466
3541
|
const recorded = snapshot.get(file);
|
|
3467
3542
|
if (recorded === void 0 || recorded !== this.getFileMeta(file).mtime) return false;
|
|
3468
3543
|
}
|
|
@@ -3474,8 +3549,9 @@ var Builder = class {
|
|
|
3474
3549
|
this.configGraphMtimes = snapshot;
|
|
3475
3550
|
};
|
|
3476
3551
|
/** The per-pass source bookkeeping every setup ends with, config reload or not. */
|
|
3477
|
-
refreshSourceState = (ctx, previousTsconfigFiles) => {
|
|
3478
|
-
const
|
|
3552
|
+
refreshSourceState = (ctx, previousTsconfigFiles, sourceChanges) => {
|
|
3553
|
+
const knownChanges = sourceChanges ? new Set(sourceChanges.files.map((file) => this.absOwner(ctx, file))) : void 0;
|
|
3554
|
+
const changedResolutionConfigurations = this.changedResolutionConfigurations(knownChanges);
|
|
3479
3555
|
const changedResolutionSet = new Set(changedResolutionConfigurations);
|
|
3480
3556
|
const resolutionAffected = /* @__PURE__ */ new Set();
|
|
3481
3557
|
const resolutionLedger = this.capturedLedger ?? (changedResolutionConfigurations.length ? ctx.project.getResolutionLedger() : void 0);
|
|
@@ -3487,14 +3563,21 @@ var Builder = class {
|
|
|
3487
3563
|
const replaceCompilerOptions = changedResolutionConfigurations.some((file) => tsconfigCandidates.has(file));
|
|
3488
3564
|
ctx.project.refreshResolutionConfiguration(ctx.conf.tsconfig?.compilerOptions, this.tsconfigResolutionFiles, replaceCompilerOptions);
|
|
3489
3565
|
}
|
|
3490
|
-
const
|
|
3491
|
-
const
|
|
3566
|
+
const needsInventoryScan = !sourceChanges || sourceChanges.needsInventoryScan || this.sourceInventory === void 0;
|
|
3567
|
+
const inventory = needsInventoryScan ? ctx.getFiles() : [...this.sourceInventory];
|
|
3568
|
+
const allTracked = (0, _bamboocss_shared.uniq)([
|
|
3492
3569
|
...this.sourceInventory ?? inventory,
|
|
3493
3570
|
...inventory,
|
|
3494
3571
|
...this.getResolutionReadFiles()
|
|
3495
3572
|
]);
|
|
3496
|
-
|
|
3497
|
-
|
|
3573
|
+
const trackedPaths = new Set(allTracked.map((file) => this.absOwner(ctx, file)));
|
|
3574
|
+
const tracked = knownChanges && !needsInventoryScan ? [...knownChanges].filter((file) => trackedPaths.has(file)) : allTracked;
|
|
3575
|
+
this.filesMeta = tracked.length ? this.checkFilesChanged(tracked, knownChanges) : changedResolutionConfigurations.length ? {
|
|
3576
|
+
changes: /* @__PURE__ */ new Map(),
|
|
3577
|
+
hasFilesChanged: false
|
|
3578
|
+
} : void 0;
|
|
3579
|
+
for (const [file, meta] of this.filesMeta?.changes ?? []) if (!meta.isUnchanged) this.sourceScanCache.entries.delete(this.absOwner(ctx, file));
|
|
3580
|
+
if (this.filesMeta?.hasFilesChanged) {
|
|
3498
3581
|
_bamboocss_logger.logger.debug("builder", "Files changed, invalidating them");
|
|
3499
3582
|
this.invalidateChangedSources(ctx, inventory, resolutionAffected, resolutionLedger);
|
|
3500
3583
|
} else if (changedResolutionConfigurations.length) {
|
|
@@ -3565,21 +3648,21 @@ var Builder = class {
|
|
|
3565
3648
|
for (const fact of ledger) addEdge(fact.target, fact.importer);
|
|
3566
3649
|
for (const [target, importer] of syntheticEdges) addEdge(target, importer);
|
|
3567
3650
|
const compare = (left, right) => (inventoryRank.get(left) ?? 0) - (inventoryRank.get(right) ?? 0);
|
|
3568
|
-
const ready =
|
|
3651
|
+
const ready = new MinPriorityQueue(compare);
|
|
3652
|
+
for (const [file, degree] of indegree) if (degree === 0) ready.push(file);
|
|
3569
3653
|
const ordered = [];
|
|
3570
|
-
|
|
3571
|
-
|
|
3654
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
3655
|
+
while (ready.size) {
|
|
3656
|
+
const file = ready.pop();
|
|
3572
3657
|
ordered.push(file);
|
|
3573
|
-
|
|
3658
|
+
emitted.add(file);
|
|
3659
|
+
for (const importer of outgoing.get(file) ?? []) {
|
|
3574
3660
|
const next = (indegree.get(importer) ?? 0) - 1;
|
|
3575
3661
|
indegree.set(importer, next);
|
|
3576
|
-
if (next === 0)
|
|
3577
|
-
ready.push(importer);
|
|
3578
|
-
ready.sort(compare);
|
|
3579
|
-
}
|
|
3662
|
+
if (next === 0) ready.push(importer);
|
|
3580
3663
|
}
|
|
3581
3664
|
}
|
|
3582
|
-
for (const file of
|
|
3665
|
+
for (const file of byPath.keys()) if (!emitted.has(file)) ordered.push(file);
|
|
3583
3666
|
return ordered.map((file) => byPath.get(file));
|
|
3584
3667
|
};
|
|
3585
3668
|
/**
|
|
@@ -3672,11 +3755,12 @@ var Builder = class {
|
|
|
3672
3755
|
isUnchanged: fileModifiedMap.has(file) && mtime === fileModifiedMap.get(file)
|
|
3673
3756
|
};
|
|
3674
3757
|
};
|
|
3675
|
-
checkFilesChanged(files) {
|
|
3758
|
+
checkFilesChanged(files, knownChanges) {
|
|
3676
3759
|
const changes = /* @__PURE__ */ new Map();
|
|
3677
3760
|
let hasFilesChanged = false;
|
|
3678
3761
|
for (const file of files) {
|
|
3679
3762
|
const meta = this.getFileMeta(file);
|
|
3763
|
+
if (knownChanges?.has(this.sourcePath(file))) meta.isUnchanged = false;
|
|
3680
3764
|
changes.set(file, meta);
|
|
3681
3765
|
if (!meta.isUnchanged) hasFilesChanged = true;
|
|
3682
3766
|
}
|
|
@@ -3769,7 +3853,10 @@ var Builder = class {
|
|
|
3769
3853
|
for (const file of filesToExtract) this.extractFile(ctx, file);
|
|
3770
3854
|
done();
|
|
3771
3855
|
this.sourceInventory = [...files];
|
|
3772
|
-
for (const file of (0, _bamboocss_shared.uniq)([...files, ...this.getResolutionReadFiles()]))
|
|
3856
|
+
for (const file of (0, _bamboocss_shared.uniq)([...files, ...this.getResolutionReadFiles()])) {
|
|
3857
|
+
const mtime = this.filesMeta?.changes.get(file)?.mtime ?? fileModifiedMap.get(file) ?? this.getFileMeta(file).mtime;
|
|
3858
|
+
fileModifiedMap.set(file, mtime);
|
|
3859
|
+
}
|
|
3773
3860
|
this.snapshotResolutionConfigurations();
|
|
3774
3861
|
this.affectedFiles = void 0;
|
|
3775
3862
|
this.extractionOrder = void 0;
|
|
@@ -3789,7 +3876,7 @@ var Builder = class {
|
|
|
3789
3876
|
const sheet = assembleExtractedSheet(ctx, {
|
|
3790
3877
|
layerParams,
|
|
3791
3878
|
sourceScanCache: this.sourceScanCache,
|
|
3792
|
-
mtimeOf: (filePath) => this.filesMeta?.changes.get(filePath)?.mtime,
|
|
3879
|
+
mtimeOf: (filePath) => this.filesMeta?.changes.get(filePath)?.mtime ?? fileModifiedMap.get(filePath),
|
|
3793
3880
|
sourceInventory: this.sourceInventory
|
|
3794
3881
|
});
|
|
3795
3882
|
return ctx.getCss(sheet);
|
package/dist/index.d.cts
CHANGED
|
@@ -216,6 +216,22 @@ declare function analyze(ctx: BambooContext, options?: AnalysisOptions): {
|
|
|
216
216
|
declare function buildInfo(ctx: BambooContext, outfile: string): Promise<void>;
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/builder.d.ts
|
|
219
|
+
/** Files a watcher knows moved since the previous setup. Omit this to retain filesystem discovery. */
|
|
220
|
+
interface BuilderSourceChanges {
|
|
221
|
+
/** Absolute or cwd-relative paths. An empty list authoritatively means no source moved. */
|
|
222
|
+
files: readonly string[];
|
|
223
|
+
/** Additions and deletions can change glob membership, so they still reconcile the inventory. */
|
|
224
|
+
needsInventoryScan?: boolean;
|
|
225
|
+
/** A `dependencies` glob gained or lost a member and must be expanded before config diffing. */
|
|
226
|
+
needsConfigReload?: boolean;
|
|
227
|
+
}
|
|
228
|
+
interface BuilderSetupOptions {
|
|
229
|
+
configPath?: string;
|
|
230
|
+
cwd?: string;
|
|
231
|
+
dev?: boolean;
|
|
232
|
+
/** A watcher-owned change journal. Without one, Builder performs its standalone filesystem scan. */
|
|
233
|
+
sourceChanges?: BuilderSourceChanges;
|
|
234
|
+
}
|
|
219
235
|
declare class Builder {
|
|
220
236
|
/**
|
|
221
237
|
* The current bamboo context
|
|
@@ -281,17 +297,19 @@ declare class Builder {
|
|
|
281
297
|
private captureResolutionLedger;
|
|
282
298
|
/** @internal Current and missing resolver paths which can change the stylesheet. */
|
|
283
299
|
getResolutionReadFiles: () => readonly string[];
|
|
300
|
+
/** @internal The inventory reconciled by the most recent extraction pass. */
|
|
301
|
+
getSourceFiles: () => readonly string[];
|
|
302
|
+
/** @internal Whether creating this path can change source or explicit-dependency membership. */
|
|
303
|
+
isPotentialSourceFile: (filePath: string) => boolean;
|
|
304
|
+
/** @internal Whether creating or deleting this path can change a `dependencies` glob. */
|
|
305
|
+
isPotentialConfigDependency: (filePath: string) => boolean;
|
|
284
306
|
/** @internal Exact local package/tsconfig files which can change semantic resolution. */
|
|
285
307
|
getResolutionConfigurationFiles: () => readonly string[];
|
|
286
308
|
private readResolutionConfiguration;
|
|
287
309
|
private changedResolutionConfigurations;
|
|
288
310
|
private snapshotResolutionConfigurations;
|
|
289
311
|
private recordConfigDependencies;
|
|
290
|
-
setup: (options?:
|
|
291
|
-
configPath?: string;
|
|
292
|
-
cwd?: string;
|
|
293
|
-
dev?: boolean;
|
|
294
|
-
}) => Promise<BambooContext | undefined>;
|
|
312
|
+
setup: (options?: BuilderSetupOptions) => Promise<BambooContext | undefined>;
|
|
295
313
|
/** Every file whose content participates in the resolved config, for the dev fast path. */
|
|
296
314
|
private configGraphFiles;
|
|
297
315
|
private configGraphUnchanged;
|
|
@@ -348,7 +366,7 @@ declare class Builder {
|
|
|
348
366
|
mtime: number;
|
|
349
367
|
isUnchanged: boolean;
|
|
350
368
|
};
|
|
351
|
-
checkFilesChanged(files: string[]): {
|
|
369
|
+
checkFilesChanged(files: readonly string[], knownChanges?: ReadonlySet<string>): {
|
|
352
370
|
changes: Map<string, FileMeta>;
|
|
353
371
|
hasFilesChanged: boolean;
|
|
354
372
|
};
|
|
@@ -463,4 +481,4 @@ declare const hasUncompilableSources: (options: {
|
|
|
463
481
|
include?: readonly string[];
|
|
464
482
|
}) => boolean;
|
|
465
483
|
//#endregion
|
|
466
|
-
export { BambooContext, Builder, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive, setLogStream, setupConfig, setupGitIgnore, spec, startProfiling };
|
|
484
|
+
export { BambooContext, Builder, type BuilderSetupOptions, type BuilderSourceChanges, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive, setLogStream, setupConfig, setupGitIgnore, spec, startProfiling };
|
package/dist/index.d.mts
CHANGED
|
@@ -216,6 +216,22 @@ declare function analyze(ctx: BambooContext, options?: AnalysisOptions): {
|
|
|
216
216
|
declare function buildInfo(ctx: BambooContext, outfile: string): Promise<void>;
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/builder.d.ts
|
|
219
|
+
/** Files a watcher knows moved since the previous setup. Omit this to retain filesystem discovery. */
|
|
220
|
+
interface BuilderSourceChanges {
|
|
221
|
+
/** Absolute or cwd-relative paths. An empty list authoritatively means no source moved. */
|
|
222
|
+
files: readonly string[];
|
|
223
|
+
/** Additions and deletions can change glob membership, so they still reconcile the inventory. */
|
|
224
|
+
needsInventoryScan?: boolean;
|
|
225
|
+
/** A `dependencies` glob gained or lost a member and must be expanded before config diffing. */
|
|
226
|
+
needsConfigReload?: boolean;
|
|
227
|
+
}
|
|
228
|
+
interface BuilderSetupOptions {
|
|
229
|
+
configPath?: string;
|
|
230
|
+
cwd?: string;
|
|
231
|
+
dev?: boolean;
|
|
232
|
+
/** A watcher-owned change journal. Without one, Builder performs its standalone filesystem scan. */
|
|
233
|
+
sourceChanges?: BuilderSourceChanges;
|
|
234
|
+
}
|
|
219
235
|
declare class Builder {
|
|
220
236
|
/**
|
|
221
237
|
* The current bamboo context
|
|
@@ -281,17 +297,19 @@ declare class Builder {
|
|
|
281
297
|
private captureResolutionLedger;
|
|
282
298
|
/** @internal Current and missing resolver paths which can change the stylesheet. */
|
|
283
299
|
getResolutionReadFiles: () => readonly string[];
|
|
300
|
+
/** @internal The inventory reconciled by the most recent extraction pass. */
|
|
301
|
+
getSourceFiles: () => readonly string[];
|
|
302
|
+
/** @internal Whether creating this path can change source or explicit-dependency membership. */
|
|
303
|
+
isPotentialSourceFile: (filePath: string) => boolean;
|
|
304
|
+
/** @internal Whether creating or deleting this path can change a `dependencies` glob. */
|
|
305
|
+
isPotentialConfigDependency: (filePath: string) => boolean;
|
|
284
306
|
/** @internal Exact local package/tsconfig files which can change semantic resolution. */
|
|
285
307
|
getResolutionConfigurationFiles: () => readonly string[];
|
|
286
308
|
private readResolutionConfiguration;
|
|
287
309
|
private changedResolutionConfigurations;
|
|
288
310
|
private snapshotResolutionConfigurations;
|
|
289
311
|
private recordConfigDependencies;
|
|
290
|
-
setup: (options?:
|
|
291
|
-
configPath?: string;
|
|
292
|
-
cwd?: string;
|
|
293
|
-
dev?: boolean;
|
|
294
|
-
}) => Promise<BambooContext | undefined>;
|
|
312
|
+
setup: (options?: BuilderSetupOptions) => Promise<BambooContext | undefined>;
|
|
295
313
|
/** Every file whose content participates in the resolved config, for the dev fast path. */
|
|
296
314
|
private configGraphFiles;
|
|
297
315
|
private configGraphUnchanged;
|
|
@@ -348,7 +366,7 @@ declare class Builder {
|
|
|
348
366
|
mtime: number;
|
|
349
367
|
isUnchanged: boolean;
|
|
350
368
|
};
|
|
351
|
-
checkFilesChanged(files: string[]): {
|
|
369
|
+
checkFilesChanged(files: readonly string[], knownChanges?: ReadonlySet<string>): {
|
|
352
370
|
changes: Map<string, FileMeta>;
|
|
353
371
|
hasFilesChanged: boolean;
|
|
354
372
|
};
|
|
@@ -463,4 +481,4 @@ declare const hasUncompilableSources: (options: {
|
|
|
463
481
|
include?: readonly string[];
|
|
464
482
|
}) => boolean;
|
|
465
483
|
//#endregion
|
|
466
|
-
export { BambooContext, Builder, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive, setLogStream, setupConfig, setupGitIgnore, spec, startProfiling };
|
|
484
|
+
export { BambooContext, Builder, type BuilderSetupOptions, type BuilderSourceChanges, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive, setLogStream, setupConfig, setupGitIgnore, spec, startProfiling };
|
package/dist/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { BambooError, cssVarRefs, groupBy, truncateList, uniq } from "@bamboocss
|
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { appendFileSync, existsSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
8
8
|
import { dirname, extname, isAbsolute, join, normalize, parse, relative, resolve, sep } from "path";
|
|
9
|
+
import picomatch from "picomatch";
|
|
9
10
|
import { pluginSvelte } from "@bamboocss/plugin-svelte";
|
|
10
11
|
import { pluginVue } from "@bamboocss/plugin-vue";
|
|
11
12
|
import { checkNamingAgreement, formatNamingDisagreement, messages, prunesPreflight } from "@bamboocss/core";
|
|
@@ -21,7 +22,6 @@ import { Node, SyntaxKind, ts } from "ts-morph";
|
|
|
21
22
|
import chokidar from "chokidar";
|
|
22
23
|
import glob from "fast-glob";
|
|
23
24
|
import fsExtra from "fs-extra";
|
|
24
|
-
import picomatch from "picomatch";
|
|
25
25
|
import { isMatch } from "matcher";
|
|
26
26
|
import { resolveTsPathPattern } from "@bamboocss/config/ts-path";
|
|
27
27
|
import readline from "node:readline";
|
|
@@ -3256,6 +3256,48 @@ const assembleExtractedSheet = (ctx, { layerParams = false, sourceScanCache, mti
|
|
|
3256
3256
|
//#endregion
|
|
3257
3257
|
//#region src/builder.ts
|
|
3258
3258
|
const fileModifiedMap = /* @__PURE__ */ new Map();
|
|
3259
|
+
/** Binary minimum heap; callers provide the stable semantic rank used for ties/order. */
|
|
3260
|
+
var MinPriorityQueue = class {
|
|
3261
|
+
compare;
|
|
3262
|
+
values = [];
|
|
3263
|
+
constructor(compare) {
|
|
3264
|
+
this.compare = compare;
|
|
3265
|
+
}
|
|
3266
|
+
get size() {
|
|
3267
|
+
return this.values.length;
|
|
3268
|
+
}
|
|
3269
|
+
push = (value) => {
|
|
3270
|
+
let index = this.values.length;
|
|
3271
|
+
this.values.push(value);
|
|
3272
|
+
while (index > 0) {
|
|
3273
|
+
const parent = index - 1 >> 1;
|
|
3274
|
+
const parentValue = this.values[parent];
|
|
3275
|
+
if (this.compare(value, parentValue) >= 0) break;
|
|
3276
|
+
this.values[index] = parentValue;
|
|
3277
|
+
index = parent;
|
|
3278
|
+
}
|
|
3279
|
+
this.values[index] = value;
|
|
3280
|
+
};
|
|
3281
|
+
pop = () => {
|
|
3282
|
+
if (!this.values.length) return void 0;
|
|
3283
|
+
const first = this.values[0];
|
|
3284
|
+
const last = this.values.pop();
|
|
3285
|
+
if (!this.values.length) return first;
|
|
3286
|
+
let index = 0;
|
|
3287
|
+
while (true) {
|
|
3288
|
+
const left = index * 2 + 1;
|
|
3289
|
+
if (left >= this.values.length) break;
|
|
3290
|
+
const right = left + 1;
|
|
3291
|
+
let next = left;
|
|
3292
|
+
if (right < this.values.length && this.compare(this.values[right], this.values[left]) < 0) next = right;
|
|
3293
|
+
if (this.compare(last, this.values[next]) <= 0) break;
|
|
3294
|
+
this.values[index] = this.values[next];
|
|
3295
|
+
index = next;
|
|
3296
|
+
}
|
|
3297
|
+
this.values[index] = last;
|
|
3298
|
+
return first;
|
|
3299
|
+
};
|
|
3300
|
+
};
|
|
3259
3301
|
var Builder = class {
|
|
3260
3302
|
/**
|
|
3261
3303
|
* The current bamboo context
|
|
@@ -3339,6 +3381,26 @@ var Builder = class {
|
|
|
3339
3381
|
]) for (const dependencies of readSets.values()) for (const dependency of dependencies) files.add(dependency);
|
|
3340
3382
|
return Object.freeze([...files].sort());
|
|
3341
3383
|
};
|
|
3384
|
+
/** @internal The inventory reconciled by the most recent extraction pass. */
|
|
3385
|
+
getSourceFiles = () => Object.freeze([...this.sourceInventory ?? []]);
|
|
3386
|
+
/** @internal Whether creating this path can change source or explicit-dependency membership. */
|
|
3387
|
+
isPotentialSourceFile = (filePath) => {
|
|
3388
|
+
const ctx = this.getContextOrThrow();
|
|
3389
|
+
const absolutePath = this.absOwner(ctx, filePath);
|
|
3390
|
+
const relativePath = this.sourcePath(ctx.runtime.path.relative(ctx.config.cwd, absolutePath));
|
|
3391
|
+
const sourcePatterns = ctx.config.include ?? [];
|
|
3392
|
+
const sourceMatcher = sourcePatterns.length ? picomatch(sourcePatterns, { ignore: globIgnore(ctx.config.exclude) }) : void 0;
|
|
3393
|
+
return sourceMatcher?.(relativePath) || sourceMatcher?.(absolutePath) || false;
|
|
3394
|
+
};
|
|
3395
|
+
/** @internal Whether creating or deleting this path can change a `dependencies` glob. */
|
|
3396
|
+
isPotentialConfigDependency = (filePath) => {
|
|
3397
|
+
const ctx = this.getContextOrThrow();
|
|
3398
|
+
const absolutePath = this.absOwner(ctx, filePath);
|
|
3399
|
+
const relativePath = this.sourcePath(ctx.runtime.path.relative(ctx.config.cwd, absolutePath));
|
|
3400
|
+
const patterns = ctx.config.dependencies ?? [];
|
|
3401
|
+
const matcher = patterns.length ? picomatch(patterns) : void 0;
|
|
3402
|
+
return matcher?.(relativePath) || matcher?.(absolutePath) || false;
|
|
3403
|
+
};
|
|
3342
3404
|
/** @internal Exact local package/tsconfig files which can change semantic resolution. */
|
|
3343
3405
|
getResolutionConfigurationFiles = () => {
|
|
3344
3406
|
const files = /* @__PURE__ */ new Set();
|
|
@@ -3353,7 +3415,7 @@ var Builder = class {
|
|
|
3353
3415
|
throw error;
|
|
3354
3416
|
}
|
|
3355
3417
|
};
|
|
3356
|
-
changedResolutionConfigurations = () => this.getResolutionConfigurationFiles().filter((file) => this.resolutionConfigurationBytes.get(file) !== this.readResolutionConfiguration(file));
|
|
3418
|
+
changedResolutionConfigurations = (knownChanges) => this.getResolutionConfigurationFiles().filter((file) => (!knownChanges || knownChanges.has(this.sourcePath(file))) && this.resolutionConfigurationBytes.get(file) !== this.readResolutionConfiguration(file));
|
|
3357
3419
|
snapshotResolutionConfigurations = () => {
|
|
3358
3420
|
const current = new Set(this.getResolutionConfigurationFiles());
|
|
3359
3421
|
for (const file of current) this.resolutionConfigurationBytes.set(file, this.readResolutionConfiguration(file));
|
|
@@ -3372,6 +3434,7 @@ var Builder = class {
|
|
|
3372
3434
|
dev: options.dev
|
|
3373
3435
|
});
|
|
3374
3436
|
const ctx = this.getContextOrThrow();
|
|
3437
|
+
const previousExplicitDeps = [...ctx.explicitDeps];
|
|
3375
3438
|
const previousTsconfigFiles = this.tsconfigResolutionFiles.length ? this.tsconfigResolutionFiles : ctx.diff.getResolutionConfigFiles();
|
|
3376
3439
|
/**
|
|
3377
3440
|
* Dev fast path: skip the config reload when nothing that can change the resolved config
|
|
@@ -3390,24 +3453,33 @@ var Builder = class {
|
|
|
3390
3453
|
* preset external to the config bundle — and a one-shot build keeps paying the reload
|
|
3391
3454
|
* rather than trading that recovery for a latency only watch mode feels.
|
|
3392
3455
|
*/
|
|
3393
|
-
if (options.dev && this.configGraphUnchanged(configPath)) {
|
|
3456
|
+
if (options.dev && this.configGraphUnchanged(configPath, options.sourceChanges)) {
|
|
3394
3457
|
this.affecteds = {
|
|
3395
3458
|
artifacts: /* @__PURE__ */ new Set(),
|
|
3396
3459
|
hasConfigChanged: false,
|
|
3397
3460
|
diffs: []
|
|
3398
3461
|
};
|
|
3399
3462
|
this.explicitDepsMeta = this.checkFilesChanged(this.context.explicitDeps);
|
|
3400
|
-
this.refreshSourceState(ctx, previousTsconfigFiles);
|
|
3463
|
+
this.refreshSourceState(ctx, previousTsconfigFiles, options.sourceChanges);
|
|
3401
3464
|
return;
|
|
3402
3465
|
}
|
|
3403
3466
|
this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
|
|
3404
3467
|
this.context = new BambooContext(conf);
|
|
3405
3468
|
});
|
|
3406
3469
|
const nextContext = this.getContextOrThrow();
|
|
3470
|
+
if (options.sourceChanges?.needsConfigReload) {
|
|
3471
|
+
const { cwd: configCwd, dependencies } = nextContext.config;
|
|
3472
|
+
nextContext.explicitDeps = dependencies ? nextContext.runtime.fs.glob({
|
|
3473
|
+
include: dependencies,
|
|
3474
|
+
cwd: configCwd
|
|
3475
|
+
}) : [];
|
|
3476
|
+
}
|
|
3407
3477
|
this.recordConfigDependencies(nextContext, options.cwd);
|
|
3408
3478
|
this.tsconfigResolutionFiles = nextContext.diff.getResolutionConfigFiles();
|
|
3409
3479
|
logger.debug("builder", this.affecteds);
|
|
3410
|
-
|
|
3480
|
+
const explicitDeps = options.sourceChanges?.needsConfigReload ? uniq([...previousExplicitDeps, ...this.context.explicitDeps]) : this.context.explicitDeps;
|
|
3481
|
+
const knownChanges = options.sourceChanges ? new Set(options.sourceChanges.files.map((file) => this.absOwner(this.context, file))) : void 0;
|
|
3482
|
+
this.explicitDepsMeta = this.checkFilesChanged(explicitDeps, knownChanges);
|
|
3411
3483
|
if (this.explicitDepsMeta.hasFilesChanged) {
|
|
3412
3484
|
this.explicitDepsMeta.changes.forEach((meta, file) => {
|
|
3413
3485
|
fileModifiedMap.set(file, meta.mtime);
|
|
@@ -3437,7 +3509,7 @@ var Builder = class {
|
|
|
3437
3509
|
this.snapshotConfigGraphMtimes(configPath);
|
|
3438
3510
|
return;
|
|
3439
3511
|
}
|
|
3440
|
-
this.refreshSourceState(ctx, previousTsconfigFiles);
|
|
3512
|
+
this.refreshSourceState(ctx, previousTsconfigFiles, options.sourceChanges);
|
|
3441
3513
|
this.snapshotConfigGraphMtimes(configPath);
|
|
3442
3514
|
};
|
|
3443
3515
|
/** Every file whose content participates in the resolved config, for the dev fast path. */
|
|
@@ -3447,10 +3519,13 @@ var Builder = class {
|
|
|
3447
3519
|
...this.tsconfigResolutionFiles,
|
|
3448
3520
|
...this.context?.explicitDeps ?? []
|
|
3449
3521
|
].map(normalize));
|
|
3450
|
-
configGraphUnchanged = (configPath) => {
|
|
3522
|
+
configGraphUnchanged = (configPath, sourceChanges) => {
|
|
3451
3523
|
const snapshot = this.configGraphMtimes;
|
|
3452
3524
|
if (!snapshot) return false;
|
|
3525
|
+
if (sourceChanges?.needsConfigReload) return false;
|
|
3526
|
+
const changed = sourceChanges ? new Set(sourceChanges.files.map((file) => this.sourcePath(resolve(this.context?.config.cwd ?? "", file)))) : void 0;
|
|
3453
3527
|
for (const file of this.configGraphFiles(configPath)) {
|
|
3528
|
+
if (changed?.has(this.sourcePath(resolve(this.context?.config.cwd ?? "", file)))) return false;
|
|
3454
3529
|
const recorded = snapshot.get(file);
|
|
3455
3530
|
if (recorded === void 0 || recorded !== this.getFileMeta(file).mtime) return false;
|
|
3456
3531
|
}
|
|
@@ -3462,8 +3537,9 @@ var Builder = class {
|
|
|
3462
3537
|
this.configGraphMtimes = snapshot;
|
|
3463
3538
|
};
|
|
3464
3539
|
/** The per-pass source bookkeeping every setup ends with, config reload or not. */
|
|
3465
|
-
refreshSourceState = (ctx, previousTsconfigFiles) => {
|
|
3466
|
-
const
|
|
3540
|
+
refreshSourceState = (ctx, previousTsconfigFiles, sourceChanges) => {
|
|
3541
|
+
const knownChanges = sourceChanges ? new Set(sourceChanges.files.map((file) => this.absOwner(ctx, file))) : void 0;
|
|
3542
|
+
const changedResolutionConfigurations = this.changedResolutionConfigurations(knownChanges);
|
|
3467
3543
|
const changedResolutionSet = new Set(changedResolutionConfigurations);
|
|
3468
3544
|
const resolutionAffected = /* @__PURE__ */ new Set();
|
|
3469
3545
|
const resolutionLedger = this.capturedLedger ?? (changedResolutionConfigurations.length ? ctx.project.getResolutionLedger() : void 0);
|
|
@@ -3475,14 +3551,21 @@ var Builder = class {
|
|
|
3475
3551
|
const replaceCompilerOptions = changedResolutionConfigurations.some((file) => tsconfigCandidates.has(file));
|
|
3476
3552
|
ctx.project.refreshResolutionConfiguration(ctx.conf.tsconfig?.compilerOptions, this.tsconfigResolutionFiles, replaceCompilerOptions);
|
|
3477
3553
|
}
|
|
3478
|
-
const
|
|
3479
|
-
const
|
|
3554
|
+
const needsInventoryScan = !sourceChanges || sourceChanges.needsInventoryScan || this.sourceInventory === void 0;
|
|
3555
|
+
const inventory = needsInventoryScan ? ctx.getFiles() : [...this.sourceInventory];
|
|
3556
|
+
const allTracked = uniq([
|
|
3480
3557
|
...this.sourceInventory ?? inventory,
|
|
3481
3558
|
...inventory,
|
|
3482
3559
|
...this.getResolutionReadFiles()
|
|
3483
3560
|
]);
|
|
3484
|
-
|
|
3485
|
-
|
|
3561
|
+
const trackedPaths = new Set(allTracked.map((file) => this.absOwner(ctx, file)));
|
|
3562
|
+
const tracked = knownChanges && !needsInventoryScan ? [...knownChanges].filter((file) => trackedPaths.has(file)) : allTracked;
|
|
3563
|
+
this.filesMeta = tracked.length ? this.checkFilesChanged(tracked, knownChanges) : changedResolutionConfigurations.length ? {
|
|
3564
|
+
changes: /* @__PURE__ */ new Map(),
|
|
3565
|
+
hasFilesChanged: false
|
|
3566
|
+
} : void 0;
|
|
3567
|
+
for (const [file, meta] of this.filesMeta?.changes ?? []) if (!meta.isUnchanged) this.sourceScanCache.entries.delete(this.absOwner(ctx, file));
|
|
3568
|
+
if (this.filesMeta?.hasFilesChanged) {
|
|
3486
3569
|
logger.debug("builder", "Files changed, invalidating them");
|
|
3487
3570
|
this.invalidateChangedSources(ctx, inventory, resolutionAffected, resolutionLedger);
|
|
3488
3571
|
} else if (changedResolutionConfigurations.length) {
|
|
@@ -3553,21 +3636,21 @@ var Builder = class {
|
|
|
3553
3636
|
for (const fact of ledger) addEdge(fact.target, fact.importer);
|
|
3554
3637
|
for (const [target, importer] of syntheticEdges) addEdge(target, importer);
|
|
3555
3638
|
const compare = (left, right) => (inventoryRank.get(left) ?? 0) - (inventoryRank.get(right) ?? 0);
|
|
3556
|
-
const ready =
|
|
3639
|
+
const ready = new MinPriorityQueue(compare);
|
|
3640
|
+
for (const [file, degree] of indegree) if (degree === 0) ready.push(file);
|
|
3557
3641
|
const ordered = [];
|
|
3558
|
-
|
|
3559
|
-
|
|
3642
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
3643
|
+
while (ready.size) {
|
|
3644
|
+
const file = ready.pop();
|
|
3560
3645
|
ordered.push(file);
|
|
3561
|
-
|
|
3646
|
+
emitted.add(file);
|
|
3647
|
+
for (const importer of outgoing.get(file) ?? []) {
|
|
3562
3648
|
const next = (indegree.get(importer) ?? 0) - 1;
|
|
3563
3649
|
indegree.set(importer, next);
|
|
3564
|
-
if (next === 0)
|
|
3565
|
-
ready.push(importer);
|
|
3566
|
-
ready.sort(compare);
|
|
3567
|
-
}
|
|
3650
|
+
if (next === 0) ready.push(importer);
|
|
3568
3651
|
}
|
|
3569
3652
|
}
|
|
3570
|
-
for (const file of
|
|
3653
|
+
for (const file of byPath.keys()) if (!emitted.has(file)) ordered.push(file);
|
|
3571
3654
|
return ordered.map((file) => byPath.get(file));
|
|
3572
3655
|
};
|
|
3573
3656
|
/**
|
|
@@ -3660,11 +3743,12 @@ var Builder = class {
|
|
|
3660
3743
|
isUnchanged: fileModifiedMap.has(file) && mtime === fileModifiedMap.get(file)
|
|
3661
3744
|
};
|
|
3662
3745
|
};
|
|
3663
|
-
checkFilesChanged(files) {
|
|
3746
|
+
checkFilesChanged(files, knownChanges) {
|
|
3664
3747
|
const changes = /* @__PURE__ */ new Map();
|
|
3665
3748
|
let hasFilesChanged = false;
|
|
3666
3749
|
for (const file of files) {
|
|
3667
3750
|
const meta = this.getFileMeta(file);
|
|
3751
|
+
if (knownChanges?.has(this.sourcePath(file))) meta.isUnchanged = false;
|
|
3668
3752
|
changes.set(file, meta);
|
|
3669
3753
|
if (!meta.isUnchanged) hasFilesChanged = true;
|
|
3670
3754
|
}
|
|
@@ -3757,7 +3841,10 @@ var Builder = class {
|
|
|
3757
3841
|
for (const file of filesToExtract) this.extractFile(ctx, file);
|
|
3758
3842
|
done();
|
|
3759
3843
|
this.sourceInventory = [...files];
|
|
3760
|
-
for (const file of uniq([...files, ...this.getResolutionReadFiles()]))
|
|
3844
|
+
for (const file of uniq([...files, ...this.getResolutionReadFiles()])) {
|
|
3845
|
+
const mtime = this.filesMeta?.changes.get(file)?.mtime ?? fileModifiedMap.get(file) ?? this.getFileMeta(file).mtime;
|
|
3846
|
+
fileModifiedMap.set(file, mtime);
|
|
3847
|
+
}
|
|
3761
3848
|
this.snapshotResolutionConfigurations();
|
|
3762
3849
|
this.affectedFiles = void 0;
|
|
3763
3850
|
this.extractionOrder = void 0;
|
|
@@ -3777,7 +3864,7 @@ var Builder = class {
|
|
|
3777
3864
|
const sheet = assembleExtractedSheet(ctx, {
|
|
3778
3865
|
layerParams,
|
|
3779
3866
|
sourceScanCache: this.sourceScanCache,
|
|
3780
|
-
mtimeOf: (filePath) => this.filesMeta?.changes.get(filePath)?.mtime,
|
|
3867
|
+
mtimeOf: (filePath) => this.filesMeta?.changes.get(filePath)?.mtime ?? fileModifiedMap.get(filePath),
|
|
3781
3868
|
sourceInventory: this.sourceInventory
|
|
3782
3869
|
});
|
|
3783
3870
|
return ctx.getCss(sheet);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/node",
|
|
3
|
-
"version": "1.48.
|
|
3
|
+
"version": "1.48.2",
|
|
4
4
|
"description": "The core css bamboo library",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
"pluralize": "8.0.0",
|
|
63
63
|
"ts-morph": "28.0.0",
|
|
64
64
|
"ts-pattern": "5.9.0",
|
|
65
|
-
"@bamboocss/config": "1.48.
|
|
66
|
-
"@bamboocss/core": "1.48.
|
|
67
|
-
"@bamboocss/generator": "1.48.
|
|
68
|
-
"@bamboocss/logger": "1.48.
|
|
69
|
-
"@bamboocss/parser": "1.48.
|
|
70
|
-
"@bamboocss/plugin-svelte": "1.48.
|
|
71
|
-
"@bamboocss/plugin-vue": "1.48.
|
|
72
|
-
"@bamboocss/reporter": "1.48.
|
|
73
|
-
"@bamboocss/shared": "1.48.
|
|
74
|
-
"@bamboocss/token-dictionary": "1.48.
|
|
75
|
-
"@bamboocss/types": "1.48.
|
|
65
|
+
"@bamboocss/config": "1.48.2",
|
|
66
|
+
"@bamboocss/core": "1.48.2",
|
|
67
|
+
"@bamboocss/generator": "1.48.2",
|
|
68
|
+
"@bamboocss/logger": "1.48.2",
|
|
69
|
+
"@bamboocss/parser": "1.48.2",
|
|
70
|
+
"@bamboocss/plugin-svelte": "1.48.2",
|
|
71
|
+
"@bamboocss/plugin-vue": "1.48.2",
|
|
72
|
+
"@bamboocss/reporter": "1.48.2",
|
|
73
|
+
"@bamboocss/shared": "1.48.2",
|
|
74
|
+
"@bamboocss/token-dictionary": "1.48.2",
|
|
75
|
+
"@bamboocss/types": "1.48.2"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/fs-extra": "11.0.4",
|