@bamboocss/node 1.47.0 → 1.48.0
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/README.md +1 -4
- package/dist/index.cjs +58 -185
- package/dist/index.d.cts +25 -37
- package/dist/index.d.mts +25 -37
- package/dist/index.mjs +60 -184
- package/package.json +12 -17
package/README.md
CHANGED
|
@@ -18,8 +18,7 @@ Everything below is exported from `@bamboocss/node`.
|
|
|
18
18
|
- `BambooContext` – the resolved config plus everything derived from it: tokens, utilities, conditions, recipes,
|
|
19
19
|
patterns, the `ts-morph` project, the output engine and the diff engine.
|
|
20
20
|
- `Builder` – the incremental driver the bundler plugins use. It owns context setup, tracks which files and config
|
|
21
|
-
dependencies changed, re-extracts only those, and hands back the stylesheet (`toCss`)
|
|
22
|
-
(`write`).
|
|
21
|
+
dependencies changed, re-extracts only those, and hands back the stylesheet (`toCss`).
|
|
23
22
|
|
|
24
23
|
### Commands
|
|
25
24
|
|
|
@@ -37,8 +36,6 @@ Each takes a `BambooContext`, and each backs the CLI command of the same name.
|
|
|
37
36
|
|
|
38
37
|
- `setupConfig(cwd, options?)` – scaffold `bamboo.config.ts`.
|
|
39
38
|
- `setupGitIgnore(ctx)` – add the outdir to `.gitignore`, unless `config.gitignore` is off.
|
|
40
|
-
- `parseDependency(fileOrGlob)` – turn a `config.dependencies` entry into a PostCSS `dependency` or `dir-dependency`
|
|
41
|
-
message.
|
|
42
39
|
- `setLogStream({ cwd, logfile })` – tee logs to a file.
|
|
43
40
|
- `startProfiling(cwd, prefix, isWatching?)` – start a V8 CPU profile; the returned function stops it and writes
|
|
44
41
|
`bamboo-{prefix}-{timestamp}.cpuprofile` into `cwd`.
|
package/dist/index.cjs
CHANGED
|
@@ -55,10 +55,6 @@ let fs_extra = require("fs-extra");
|
|
|
55
55
|
fs_extra = __toESM(fs_extra);
|
|
56
56
|
let picomatch = require("picomatch");
|
|
57
57
|
picomatch = __toESM(picomatch);
|
|
58
|
-
let is_glob = require("is-glob");
|
|
59
|
-
is_glob = __toESM(is_glob);
|
|
60
|
-
let glob_parent = require("glob-parent");
|
|
61
|
-
glob_parent = __toESM(glob_parent);
|
|
62
58
|
let matcher = require("matcher");
|
|
63
59
|
let _bamboocss_config_ts_path = require("@bamboocss/config/ts-path");
|
|
64
60
|
let node_readline = require("node:readline");
|
|
@@ -2293,12 +2289,12 @@ var BambooContext = class extends _bamboocss_generator.Generator {
|
|
|
2293
2289
|
}]
|
|
2294
2290
|
});
|
|
2295
2291
|
};
|
|
2296
|
-
writeSplitCss = async (sheet
|
|
2292
|
+
writeSplitCss = async (sheet) => {
|
|
2297
2293
|
const { path: pathUtil, fs } = this.runtime;
|
|
2298
2294
|
const rootDir = this.paths.root;
|
|
2299
2295
|
const stylesDir = [...rootDir, "styles"];
|
|
2300
|
-
const artifacts = this.getSplitCssArtifacts(sheet
|
|
2301
|
-
const subDirs = new Set(
|
|
2296
|
+
const artifacts = this.getSplitCssArtifacts(sheet);
|
|
2297
|
+
const subDirs = new Set(artifacts.themes.map((a) => a.dir).filter(Boolean));
|
|
2302
2298
|
fs.ensureDirSync(pathUtil.join(...stylesDir));
|
|
2303
2299
|
subDirs.forEach((dir) => fs.ensureDirSync(pathUtil.join(...stylesDir, dir)));
|
|
2304
2300
|
const styleFiles = [];
|
|
@@ -2309,20 +2305,6 @@ var BambooContext = class extends _bamboocss_generator.Generator {
|
|
|
2309
2305
|
});
|
|
2310
2306
|
_bamboocss_logger.logger.info("css", pathUtil.join(...stylesDir, layer.file));
|
|
2311
2307
|
}
|
|
2312
|
-
for (const recipe of artifacts.recipes) {
|
|
2313
|
-
styleFiles.push({
|
|
2314
|
-
file: `${recipe.dir}/${recipe.file}`,
|
|
2315
|
-
code: recipe.code
|
|
2316
|
-
});
|
|
2317
|
-
_bamboocss_logger.logger.info("css", pathUtil.join(...stylesDir, recipe.dir, recipe.file));
|
|
2318
|
-
}
|
|
2319
|
-
if (artifacts.recipes.length) {
|
|
2320
|
-
styleFiles.push({
|
|
2321
|
-
file: "recipes.css",
|
|
2322
|
-
code: artifacts.recipesIndex
|
|
2323
|
-
});
|
|
2324
|
-
_bamboocss_logger.logger.info("css", pathUtil.join(...stylesDir, "recipes.css"));
|
|
2325
|
-
}
|
|
2326
2308
|
for (const theme of artifacts.themes) {
|
|
2327
2309
|
styleFiles.push({
|
|
2328
2310
|
file: `${theme.dir}/${theme.file}`,
|
|
@@ -2344,12 +2326,10 @@ var BambooContext = class extends _bamboocss_generator.Generator {
|
|
|
2344
2326
|
code: artifacts.index
|
|
2345
2327
|
}]
|
|
2346
2328
|
});
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
if (fs.existsSync(recipesDir)) fs.rmFileSync(recipesDir);
|
|
2352
|
-
}
|
|
2329
|
+
const recipesIndex = pathUtil.join(...stylesDir, "recipes.css");
|
|
2330
|
+
const recipesDir = pathUtil.join(...stylesDir, "recipes");
|
|
2331
|
+
if (fs.existsSync(recipesIndex)) fs.rmFileSync(recipesIndex);
|
|
2332
|
+
if (fs.existsSync(recipesDir)) fs.rmFileSync(recipesDir);
|
|
2353
2333
|
};
|
|
2354
2334
|
watchConfig = (cb, opts) => {
|
|
2355
2335
|
const { cwd, poll, exclude } = opts ?? {};
|
|
@@ -2453,44 +2433,6 @@ async function loadConfigAndCreateContext(options = {}) {
|
|
|
2453
2433
|
return new BambooContext(conf);
|
|
2454
2434
|
}
|
|
2455
2435
|
//#endregion
|
|
2456
|
-
//#region src/parse-glob.ts
|
|
2457
|
-
function parseGlob(pattern) {
|
|
2458
|
-
let glob = pattern;
|
|
2459
|
-
const base = (0, glob_parent.default)(pattern);
|
|
2460
|
-
if (base !== ".") {
|
|
2461
|
-
glob = pattern.substring(base.length);
|
|
2462
|
-
if (glob.charAt(0) === "/") glob = glob.substring(1);
|
|
2463
|
-
}
|
|
2464
|
-
if (glob.substring(0, 2) === "./") glob = glob.substring(2);
|
|
2465
|
-
if (glob.charAt(0) === "/") glob = glob.substring(1);
|
|
2466
|
-
return {
|
|
2467
|
-
base,
|
|
2468
|
-
glob
|
|
2469
|
-
};
|
|
2470
|
-
}
|
|
2471
|
-
//#endregion
|
|
2472
|
-
//#region src/parse-dependency.ts
|
|
2473
|
-
function parseDependency(fileOrGlob) {
|
|
2474
|
-
if (fileOrGlob.startsWith("!")) return null;
|
|
2475
|
-
let message = null;
|
|
2476
|
-
if ((0, is_glob.default)(fileOrGlob)) {
|
|
2477
|
-
const { base, glob } = parseGlob(fileOrGlob);
|
|
2478
|
-
message = {
|
|
2479
|
-
type: "dir-dependency",
|
|
2480
|
-
dir: (0, path.normalize)((0, path.resolve)(base)),
|
|
2481
|
-
glob
|
|
2482
|
-
};
|
|
2483
|
-
} else message = {
|
|
2484
|
-
type: "dependency",
|
|
2485
|
-
file: (0, path.normalize)((0, path.resolve)(fileOrGlob))
|
|
2486
|
-
};
|
|
2487
|
-
if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") message = {
|
|
2488
|
-
type: "dependency",
|
|
2489
|
-
file: (0, path.normalize)((0, path.resolve)(message.dir))
|
|
2490
|
-
};
|
|
2491
|
-
return message;
|
|
2492
|
-
}
|
|
2493
|
-
//#endregion
|
|
2494
2436
|
//#region src/source-snapshots.ts
|
|
2495
2437
|
/**
|
|
2496
2438
|
* Every file `include` covers, read once.
|
|
@@ -3303,22 +3245,14 @@ function collectRenderedElements(ctx) {
|
|
|
3303
3245
|
* Vite, `bamboo cssgen`, and the CLI `bamboo` command all finish here so a recipe lowered to
|
|
3304
3246
|
* atoms cannot have a different sheet depending on which integration asked for it.
|
|
3305
3247
|
*/
|
|
3306
|
-
const assembleExtractedSheet = (ctx, { layerParams = false,
|
|
3307
|
-
|
|
3308
|
-
if (!includeRecipes) ctx.encoder.atomizeObservedRecipes();
|
|
3248
|
+
const assembleExtractedSheet = (ctx, { layerParams = false, sourceScanCache, mtimeOf, sourceInventory } = {}) => {
|
|
3249
|
+
ctx.encoder.atomizeObservedRecipes();
|
|
3309
3250
|
const sheet = ctx.createSheet();
|
|
3310
|
-
if (layerParams)
|
|
3311
|
-
else {
|
|
3251
|
+
if (layerParams) {
|
|
3312
3252
|
const recipeLayer = ctx.config.layers?.recipes ?? "recipes";
|
|
3313
3253
|
sheet.layers.root.prepend(`@layer ${sheet.layers.layerNames.filter((name) => name !== recipeLayer).join(", ")};`);
|
|
3314
3254
|
}
|
|
3315
|
-
ctx.appendBaselineCss(sheet);
|
|
3316
|
-
if (!includeRecipes) {
|
|
3317
|
-
sheet.layers.recipes.removeAll();
|
|
3318
|
-
sheet.layers.recipes_base.removeAll();
|
|
3319
|
-
sheet.layers.recipes_slots.removeAll();
|
|
3320
|
-
sheet.layers.recipes_slots_base.removeAll();
|
|
3321
|
-
}
|
|
3255
|
+
ctx.appendBaselineCss(sheet, { atomizeRecipes: true });
|
|
3322
3256
|
const collectElements = (0, _bamboocss_core.prunesPreflight)(ctx.config.preflight);
|
|
3323
3257
|
const pruneKeyframes = Boolean(ctx.config.prune?.keyframes);
|
|
3324
3258
|
const declaredKeyframes = pruneKeyframes ? keyframeNames(ctx) : [];
|
|
@@ -3334,24 +3268,6 @@ const assembleExtractedSheet = (ctx, { layerParams = false, includeRecipes = fal
|
|
|
3334
3268
|
//#endregion
|
|
3335
3269
|
//#region src/builder.ts
|
|
3336
3270
|
const fileModifiedMap = /* @__PURE__ */ new Map();
|
|
3337
|
-
/**
|
|
3338
|
-
* The declaration that says generated css is already present in a root.
|
|
3339
|
-
*
|
|
3340
|
-
* `generateGlobalCss` emits it unconditionally and `appendBaselineCss` always reaches that
|
|
3341
|
-
* artifact, so anything carrying it holds a copy of the sheet however it got there — written
|
|
3342
|
-
* by `write` on an earlier pass, or inlined from `styles.css` by `postcss-import`.
|
|
3343
|
-
*
|
|
3344
|
-
* A declaration rather than a comment because it has to survive the css being minified
|
|
3345
|
-
* between the copy landing and this check running, which a comment does not.
|
|
3346
|
-
*/
|
|
3347
|
-
const GENERATED_SENTINEL = "--made-with-bamboo";
|
|
3348
|
-
function hasGeneratedCss(root) {
|
|
3349
|
-
let found = false;
|
|
3350
|
-
root.walkDecls(GENERATED_SENTINEL, () => {
|
|
3351
|
-
found = true;
|
|
3352
|
-
});
|
|
3353
|
-
return found;
|
|
3354
|
-
}
|
|
3355
3271
|
var Builder = class {
|
|
3356
3272
|
/**
|
|
3357
3273
|
* The current bamboo context
|
|
@@ -3362,7 +3278,6 @@ var Builder = class {
|
|
|
3362
3278
|
explicitDepsMeta;
|
|
3363
3279
|
affecteds;
|
|
3364
3280
|
configDependencies = /* @__PURE__ */ new Set();
|
|
3365
|
-
pendingConfigCrawl;
|
|
3366
3281
|
/** Last complete included inventory, including members which have since been deleted. */
|
|
3367
3282
|
sourceInventory;
|
|
3368
3283
|
/** Existing included owners selected by the last resolution-ledger invalidation pass. */
|
|
@@ -3397,6 +3312,35 @@ var Builder = class {
|
|
|
3397
3312
|
resolutionAffectedThisPass = false;
|
|
3398
3313
|
/** Per-pass digests of re-read values, so N dependents of one edit digest each value once. */
|
|
3399
3314
|
readDigestMemo = /* @__PURE__ */ new Map();
|
|
3315
|
+
/** Resolution ledger as it stood before this pass's first physical source mutation. */
|
|
3316
|
+
capturedLedger;
|
|
3317
|
+
/**
|
|
3318
|
+
* Reload one edited source, keeping the closure the next extraction pass has to select.
|
|
3319
|
+
*
|
|
3320
|
+
* An integration which shares this context has to refresh an edited module before anything
|
|
3321
|
+
* folds against it — a consumer is transformed before the module it imports, so the fold
|
|
3322
|
+
* would otherwise bake in the previous contents. Doing that through the Project directly
|
|
3323
|
+
* loses the graph the rebuild needs: reloading retracts the file's own forward edges, and
|
|
3324
|
+
* `invalidateChangedSources` reads them afterwards to find its dependents. So the mutation
|
|
3325
|
+
* belongs here, behind a snapshot taken before the first of them.
|
|
3326
|
+
*
|
|
3327
|
+
* Once per pass, not once per file: the first mutation is the boundary, and every later one
|
|
3328
|
+
* in the same event is already described by that snapshot. `refreshSourceState` consumes it.
|
|
3329
|
+
*/
|
|
3330
|
+
reloadSource = (filePath) => {
|
|
3331
|
+
const ctx = this.getContextOrThrow();
|
|
3332
|
+
this.captureResolutionLedger(ctx);
|
|
3333
|
+
return ctx.project.reloadSourceFile(filePath);
|
|
3334
|
+
};
|
|
3335
|
+
/** The deletion half of `reloadSource`, with the same snapshot obligation. */
|
|
3336
|
+
removeSource = (filePath) => {
|
|
3337
|
+
const ctx = this.getContextOrThrow();
|
|
3338
|
+
this.captureResolutionLedger(ctx);
|
|
3339
|
+
return ctx.project.removeSourceFile(filePath);
|
|
3340
|
+
};
|
|
3341
|
+
captureResolutionLedger = (ctx) => {
|
|
3342
|
+
this.capturedLedger ??= ctx.project.getResolutionLedger();
|
|
3343
|
+
};
|
|
3400
3344
|
/** @internal Current and missing resolver paths which can change the stylesheet. */
|
|
3401
3345
|
getResolutionReadFiles = () => {
|
|
3402
3346
|
const files = /* @__PURE__ */ new Set();
|
|
@@ -3427,41 +3371,13 @@ var Builder = class {
|
|
|
3427
3371
|
for (const file of current) this.resolutionConfigurationBytes.set(file, this.readResolutionConfiguration(file));
|
|
3428
3372
|
for (const file of this.resolutionConfigurationBytes.keys()) if (!current.has(file)) this.resolutionConfigurationBytes.delete(file);
|
|
3429
3373
|
};
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
* whole TypeScript compiler. Only `registerDependency` reads the result, and only the PostCSS
|
|
3435
|
-
* plugin calls that — the CLI and the Vite plugin (which crawls separately, when it watches)
|
|
3436
|
-
* paid ~155ms of compiler load per build for a set neither of them ever read.
|
|
3437
|
-
*/
|
|
3438
|
-
setConfigDependencies(options) {
|
|
3439
|
-
this.pendingConfigCrawl = options;
|
|
3440
|
-
const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
|
|
3441
|
-
for (const file of this.context?.conf.dependencies ?? []) this.configDependencies.add((0, path.resolve)(cwd, file));
|
|
3442
|
-
}
|
|
3443
|
-
/** Crawl on first read, once per `setConfigDependencies`. */
|
|
3444
|
-
crawlConfigDependencies() {
|
|
3445
|
-
const options = this.pendingConfigCrawl;
|
|
3446
|
-
if (!options) return;
|
|
3447
|
-
this.pendingConfigCrawl = void 0;
|
|
3448
|
-
const tsOptions = this.context?.conf.tsOptions ?? {
|
|
3449
|
-
baseUrl: void 0,
|
|
3450
|
-
pathMappings: []
|
|
3451
|
-
};
|
|
3452
|
-
const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
|
|
3453
|
-
const { deps } = (0, _bamboocss_config.getConfigDependencies)(options.configPath, tsOptions, compilerOptions);
|
|
3454
|
-
deps.forEach((file) => this.configDependencies.add(file));
|
|
3455
|
-
_bamboocss_logger.logger.debug("builder", "Config dependencies");
|
|
3456
|
-
_bamboocss_logger.logger.debug("builder", deps);
|
|
3457
|
-
}
|
|
3374
|
+
recordConfigDependencies = (ctx, cwd) => {
|
|
3375
|
+
const root = cwd ?? ctx.config.cwd;
|
|
3376
|
+
for (const file of (0, _bamboocss_shared.uniq)([...ctx.conf.dependencies, ...ctx.explicitDeps])) this.configDependencies.add((0, path.resolve)(root, file));
|
|
3377
|
+
};
|
|
3458
3378
|
setup = async (options = {}) => {
|
|
3459
3379
|
_bamboocss_logger.logger.debug("builder", "🚧 Setup");
|
|
3460
3380
|
const configPath = options.configPath ?? (0, _bamboocss_config.findConfig)({ cwd: options.cwd });
|
|
3461
|
-
this.setConfigDependencies({
|
|
3462
|
-
configPath,
|
|
3463
|
-
cwd: options.cwd
|
|
3464
|
-
});
|
|
3465
3381
|
if (!this.context) return this.setupContext({
|
|
3466
3382
|
configPath,
|
|
3467
3383
|
cwd: options.cwd,
|
|
@@ -3499,7 +3415,9 @@ var Builder = class {
|
|
|
3499
3415
|
this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
|
|
3500
3416
|
this.context = new BambooContext(conf);
|
|
3501
3417
|
});
|
|
3502
|
-
|
|
3418
|
+
const nextContext = this.getContextOrThrow();
|
|
3419
|
+
this.recordConfigDependencies(nextContext, options.cwd);
|
|
3420
|
+
this.tsconfigResolutionFiles = nextContext.diff.getResolutionConfigFiles();
|
|
3503
3421
|
_bamboocss_logger.logger.debug("builder", this.affecteds);
|
|
3504
3422
|
this.explicitDepsMeta = this.checkFilesChanged(this.context.explicitDeps);
|
|
3505
3423
|
if (this.explicitDepsMeta.hasFilesChanged) {
|
|
@@ -3523,6 +3441,7 @@ var Builder = class {
|
|
|
3523
3441
|
this.sourceScanCache.entries.clear();
|
|
3524
3442
|
this.extractionReadsByOwner.clear();
|
|
3525
3443
|
this.recipeSurfaceByOwner.clear();
|
|
3444
|
+
this.capturedLedger = void 0;
|
|
3526
3445
|
await ctx.hooks["config:change"]?.({
|
|
3527
3446
|
config: ctx.config,
|
|
3528
3447
|
changes: this.affecteds
|
|
@@ -3559,7 +3478,8 @@ var Builder = class {
|
|
|
3559
3478
|
const changedResolutionConfigurations = this.changedResolutionConfigurations();
|
|
3560
3479
|
const changedResolutionSet = new Set(changedResolutionConfigurations);
|
|
3561
3480
|
const resolutionAffected = /* @__PURE__ */ new Set();
|
|
3562
|
-
const resolutionLedger = changedResolutionConfigurations.length ? ctx.project.getResolutionLedger() : void 0;
|
|
3481
|
+
const resolutionLedger = this.capturedLedger ?? (changedResolutionConfigurations.length ? ctx.project.getResolutionLedger() : void 0);
|
|
3482
|
+
this.capturedLedger = void 0;
|
|
3563
3483
|
for (const [owner, configurations] of this.resolutionConfigurationSets) if (configurations.some((file) => changedResolutionSet.has(file))) resolutionAffected.add(owner);
|
|
3564
3484
|
this.resolutionAffectedThisPass = resolutionAffected.size > 0;
|
|
3565
3485
|
if (changedResolutionConfigurations.length) {
|
|
@@ -3697,9 +3617,7 @@ var Builder = class {
|
|
|
3697
3617
|
cwd,
|
|
3698
3618
|
dev
|
|
3699
3619
|
});
|
|
3700
|
-
|
|
3701
|
-
this.configDependencies.add((0, path.resolve)(cwd || ctx.conf.config.cwd, file));
|
|
3702
|
-
});
|
|
3620
|
+
this.recordConfigDependencies(ctx, cwd);
|
|
3703
3621
|
this.context = ctx;
|
|
3704
3622
|
this.tsconfigResolutionFiles = ctx.diff.getResolutionConfigFiles();
|
|
3705
3623
|
return ctx;
|
|
@@ -3858,59 +3776,24 @@ var Builder = class {
|
|
|
3858
3776
|
ctx.assertExtracted(files);
|
|
3859
3777
|
ctx.assertNoDeadCalls(files);
|
|
3860
3778
|
};
|
|
3861
|
-
isValidRoot = (root) => {
|
|
3862
|
-
const ctx = this.getContextOrThrow();
|
|
3863
|
-
let valid = false;
|
|
3864
|
-
root.walkAtRules("layer", (rule) => {
|
|
3865
|
-
if (ctx.isValidLayerParams(rule.params)) valid = true;
|
|
3866
|
-
});
|
|
3867
|
-
return valid;
|
|
3868
|
-
};
|
|
3869
|
-
write = (root) => {
|
|
3870
|
-
if (hasGeneratedCss(root)) {
|
|
3871
|
-
_bamboocss_logger.logger.warn("postcss", "Generated css is already present in this file, so nothing was injected. It is imported and generated here at once — keep the `@import` of `styles.css` or the `@layer` statement that the postcss plugin injects at, not both.");
|
|
3872
|
-
return;
|
|
3873
|
-
}
|
|
3874
|
-
root.append(this.toCss());
|
|
3875
|
-
};
|
|
3876
3779
|
/**
|
|
3877
3780
|
* The finished stylesheet, as a string.
|
|
3878
3781
|
*
|
|
3879
|
-
*
|
|
3880
|
-
*
|
|
3881
|
-
* through here so a build cannot depend on which integration asked for it.
|
|
3882
|
-
*
|
|
3883
|
-
* `layerParams` is the one thing that differs between them, and it is not cosmetic: the
|
|
3884
|
-
* `@layer a, b, c;` statement is what fixes layer *order*, and css layers are ordered by
|
|
3885
|
-
* first appearance otherwise. `write` leaves it out because the root it appends to is a
|
|
3886
|
-
* file that already declares it -- that declaration is what `isValidRoot` matches on. A
|
|
3887
|
-
* virtual module is the whole stylesheet and has nothing to inherit it from.
|
|
3782
|
+
* `layerParams` controls the `@layer a, b, c;` statement that fixes layer order. CSS layers
|
|
3783
|
+
* are ordered by first appearance otherwise.
|
|
3888
3784
|
*
|
|
3889
3785
|
* `extract` has to have run first: this reads the encoder rather than filling it.
|
|
3890
3786
|
*/
|
|
3891
|
-
toCss = ({ layerParams = false
|
|
3787
|
+
toCss = ({ layerParams = false } = {}) => {
|
|
3892
3788
|
const ctx = this.getContextOrThrow();
|
|
3893
3789
|
const sheet = assembleExtractedSheet(ctx, {
|
|
3894
3790
|
layerParams,
|
|
3895
|
-
includeRecipes,
|
|
3896
3791
|
sourceScanCache: this.sourceScanCache,
|
|
3897
3792
|
mtimeOf: (filePath) => this.filesMeta?.changes.get(filePath)?.mtime,
|
|
3898
3793
|
sourceInventory: this.sourceInventory
|
|
3899
3794
|
});
|
|
3900
3795
|
return ctx.getCss(sheet);
|
|
3901
3796
|
};
|
|
3902
|
-
registerDependency = (fn) => {
|
|
3903
|
-
const ctx = this.getContextOrThrow();
|
|
3904
|
-
this.crawlConfigDependencies();
|
|
3905
|
-
for (const fileOrGlob of ctx.config.include) {
|
|
3906
|
-
const dependency = parseDependency(fileOrGlob);
|
|
3907
|
-
if (dependency) fn(dependency);
|
|
3908
|
-
}
|
|
3909
|
-
for (const file of this.configDependencies) fn({
|
|
3910
|
-
type: "dependency",
|
|
3911
|
-
file: (0, path.normalize)((0, path.resolve)(file))
|
|
3912
|
-
});
|
|
3913
|
-
};
|
|
3914
3797
|
};
|
|
3915
3798
|
//#endregion
|
|
3916
3799
|
//#region src/cpu-profile.ts
|
|
@@ -3995,11 +3878,8 @@ const cssgen = async (ctx, options) => {
|
|
|
3995
3878
|
} else {
|
|
3996
3879
|
const { files } = ctx.parseFiles();
|
|
3997
3880
|
const done = _bamboocss_logger.logger.time.info(ctx.messages.buildComplete(files.length));
|
|
3998
|
-
const sheet = assembleExtractedSheet(ctx, {
|
|
3999
|
-
|
|
4000
|
-
includeRecipes: false
|
|
4001
|
-
});
|
|
4002
|
-
if (splitting) await ctx.writeSplitCss(sheet, { includeRecipes: false });
|
|
3881
|
+
const sheet = assembleExtractedSheet(ctx, { layerParams: true });
|
|
3882
|
+
if (splitting) await ctx.writeSplitCss(sheet);
|
|
4003
3883
|
else if (outfile) {
|
|
4004
3884
|
const css = ctx.getCss(sheet);
|
|
4005
3885
|
_bamboocss_logger.logger.info("css", ctx.runtime.path.resolve(outfile));
|
|
@@ -4064,10 +3944,7 @@ async function build(ctx, artifactIds) {
|
|
|
4064
3944
|
if (ctx.config.emitTokensOnly) return _bamboocss_logger.logger.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens ✨");
|
|
4065
3945
|
const done = _bamboocss_logger.logger.time.info("");
|
|
4066
3946
|
const parsed = ctx.parseFiles();
|
|
4067
|
-
const sheet = assembleExtractedSheet(ctx, {
|
|
4068
|
-
layerParams: true,
|
|
4069
|
-
includeRecipes: false
|
|
4070
|
-
});
|
|
3947
|
+
const sheet = assembleExtractedSheet(ctx, { layerParams: true });
|
|
4071
3948
|
await ctx.writeCss(sheet);
|
|
4072
3949
|
done(ctx.messages.buildComplete(parsed.files.length));
|
|
4073
3950
|
}
|
|
@@ -4108,10 +3985,7 @@ async function generate(config, configPath) {
|
|
|
4108
3985
|
if (parsed === 0) return;
|
|
4109
3986
|
const outfile = ctx.runtime.path.join(...ctx.paths.root, "styles.css");
|
|
4110
3987
|
const done = _bamboocss_logger.logger.time.info(ctx.messages.buildComplete(parsed));
|
|
4111
|
-
const sheet = assembleExtractedSheet(ctx, {
|
|
4112
|
-
layerParams: true,
|
|
4113
|
-
includeRecipes: false
|
|
4114
|
-
});
|
|
3988
|
+
const sheet = assembleExtractedSheet(ctx, { layerParams: true });
|
|
4115
3989
|
const css = ctx.getCss(sheet);
|
|
4116
3990
|
await ctx.runtime.fs.writeFile(outfile, css);
|
|
4117
3991
|
done();
|
|
@@ -4331,7 +4205,6 @@ exports.hasUncompilableSources = hasUncompilableSources;
|
|
|
4331
4205
|
exports.isStaticCompilerActive = require_static_compiler.isStaticCompilerActive;
|
|
4332
4206
|
exports.loadConfigAndCreateContext = loadConfigAndCreateContext;
|
|
4333
4207
|
exports.markStaticCompilerActive = require_static_compiler.markStaticCompilerActive;
|
|
4334
|
-
exports.parseDependency = parseDependency;
|
|
4335
4208
|
exports.setLogStream = setLogStream;
|
|
4336
4209
|
exports.setupConfig = setupConfig;
|
|
4337
4210
|
exports.setupGitIgnore = setupGitIgnore;
|
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,6 @@ import { AnalysisOptions, Artifact, ArtifactId, BambooHooks, Config, CssArtifact
|
|
|
4
4
|
import { DeadImport, StyleEncoder, Stylesheet } from "@bamboocss/core";
|
|
5
5
|
import { Generator, generatePackageExports } from "@bamboocss/generator";
|
|
6
6
|
import { ParserResult, Project } from "@bamboocss/parser";
|
|
7
|
-
import { Message, Root } from "postcss";
|
|
8
7
|
|
|
9
8
|
//#region src/diff-engine.d.ts
|
|
10
9
|
declare class DiffEngine {
|
|
@@ -195,11 +194,7 @@ declare class BambooContext extends Generator {
|
|
|
195
194
|
results: ParserResult[];
|
|
196
195
|
};
|
|
197
196
|
writeCss: (sheet?: Stylesheet) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
198
|
-
writeSplitCss: (sheet: Stylesheet
|
|
199
|
-
includeRecipes
|
|
200
|
-
}?: {
|
|
201
|
-
includeRecipes?: boolean;
|
|
202
|
-
}) => Promise<void>;
|
|
197
|
+
writeSplitCss: (sheet: Stylesheet) => Promise<void>;
|
|
203
198
|
watchConfig: (cb: (file: string) => void | Promise<void>, opts?: Omit<WatchOptions, "include">) => void;
|
|
204
199
|
watchFiles: (cb: (event: WatcherEventType, file: string) => void | Promise<void>, opts?: Omit<WatchOptions, "include" | "exclude" | "poll" | "cwd" | "logger">) => void;
|
|
205
200
|
}
|
|
@@ -231,7 +226,6 @@ declare class Builder {
|
|
|
231
226
|
private explicitDepsMeta;
|
|
232
227
|
private affecteds;
|
|
233
228
|
private configDependencies;
|
|
234
|
-
private pendingConfigCrawl;
|
|
235
229
|
/** Last complete included inventory, including members which have since been deleted. */
|
|
236
230
|
private sourceInventory;
|
|
237
231
|
/** Existing included owners selected by the last resolution-ledger invalidation pass. */
|
|
@@ -266,6 +260,25 @@ declare class Builder {
|
|
|
266
260
|
private resolutionAffectedThisPass;
|
|
267
261
|
/** Per-pass digests of re-read values, so N dependents of one edit digest each value once. */
|
|
268
262
|
private readDigestMemo;
|
|
263
|
+
/** Resolution ledger as it stood before this pass's first physical source mutation. */
|
|
264
|
+
private capturedLedger;
|
|
265
|
+
/**
|
|
266
|
+
* Reload one edited source, keeping the closure the next extraction pass has to select.
|
|
267
|
+
*
|
|
268
|
+
* An integration which shares this context has to refresh an edited module before anything
|
|
269
|
+
* folds against it — a consumer is transformed before the module it imports, so the fold
|
|
270
|
+
* would otherwise bake in the previous contents. Doing that through the Project directly
|
|
271
|
+
* loses the graph the rebuild needs: reloading retracts the file's own forward edges, and
|
|
272
|
+
* `invalidateChangedSources` reads them afterwards to find its dependents. So the mutation
|
|
273
|
+
* belongs here, behind a snapshot taken before the first of them.
|
|
274
|
+
*
|
|
275
|
+
* Once per pass, not once per file: the first mutation is the boundary, and every later one
|
|
276
|
+
* in the same event is already described by that snapshot. `refreshSourceState` consumes it.
|
|
277
|
+
*/
|
|
278
|
+
reloadSource: (filePath: string) => import("ts-morph").FileSystemRefreshResult | undefined;
|
|
279
|
+
/** The deletion half of `reloadSource`, with the same snapshot obligation. */
|
|
280
|
+
removeSource: (filePath: string) => boolean;
|
|
281
|
+
private captureResolutionLedger;
|
|
269
282
|
/** @internal Current and missing resolver paths which can change the stylesheet. */
|
|
270
283
|
getResolutionReadFiles: () => readonly string[];
|
|
271
284
|
/** @internal Exact local package/tsconfig files which can change semantic resolution. */
|
|
@@ -273,17 +286,7 @@ declare class Builder {
|
|
|
273
286
|
private readResolutionConfiguration;
|
|
274
287
|
private changedResolutionConfigurations;
|
|
275
288
|
private snapshotResolutionConfigurations;
|
|
276
|
-
|
|
277
|
-
* Remember what to crawl; do not crawl yet.
|
|
278
|
-
*
|
|
279
|
-
* The crawl walks the config's own import graph, and resolving a bare specifier there loads a
|
|
280
|
-
* whole TypeScript compiler. Only `registerDependency` reads the result, and only the PostCSS
|
|
281
|
-
* plugin calls that — the CLI and the Vite plugin (which crawls separately, when it watches)
|
|
282
|
-
* paid ~155ms of compiler load per build for a set neither of them ever read.
|
|
283
|
-
*/
|
|
284
|
-
setConfigDependencies(options: SetupContextOptions): void;
|
|
285
|
-
/** Crawl on first read, once per `setConfigDependencies`. */
|
|
286
|
-
private crawlConfigDependencies;
|
|
289
|
+
private recordConfigDependencies;
|
|
287
290
|
setup: (options?: {
|
|
288
291
|
configPath?: string;
|
|
289
292
|
cwd?: string;
|
|
@@ -351,31 +354,19 @@ declare class Builder {
|
|
|
351
354
|
};
|
|
352
355
|
extractFile: (ctx: BambooContext, file: string) => import("@bamboocss/parser").ParserResult | undefined;
|
|
353
356
|
extract: () => void;
|
|
354
|
-
isValidRoot: (root: Root) => boolean;
|
|
355
|
-
write: (root: Root) => void;
|
|
356
357
|
/**
|
|
357
358
|
* The finished stylesheet, as a string.
|
|
358
359
|
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* through here so a build cannot depend on which integration asked for it.
|
|
362
|
-
*
|
|
363
|
-
* `layerParams` is the one thing that differs between them, and it is not cosmetic: the
|
|
364
|
-
* `@layer a, b, c;` statement is what fixes layer *order*, and css layers are ordered by
|
|
365
|
-
* first appearance otherwise. `write` leaves it out because the root it appends to is a
|
|
366
|
-
* file that already declares it -- that declaration is what `isValidRoot` matches on. A
|
|
367
|
-
* virtual module is the whole stylesheet and has nothing to inherit it from.
|
|
360
|
+
* `layerParams` controls the `@layer a, b, c;` statement that fixes layer order. CSS layers
|
|
361
|
+
* are ordered by first appearance otherwise.
|
|
368
362
|
*
|
|
369
363
|
* `extract` has to have run first: this reads the encoder rather than filling it.
|
|
370
364
|
*/
|
|
371
365
|
toCss: ({
|
|
372
|
-
layerParams
|
|
373
|
-
includeRecipes
|
|
366
|
+
layerParams
|
|
374
367
|
}?: {
|
|
375
368
|
layerParams?: boolean;
|
|
376
|
-
includeRecipes?: boolean;
|
|
377
369
|
}) => string;
|
|
378
|
-
registerDependency: (fn: (dep: Message) => void) => void;
|
|
379
370
|
}
|
|
380
371
|
interface FileMeta {
|
|
381
372
|
mtime: number;
|
|
@@ -443,9 +434,6 @@ declare const setLogStream: (options: LogstreamOptions) => {
|
|
|
443
434
|
[Symbol.dispose]: () => void;
|
|
444
435
|
};
|
|
445
436
|
//#endregion
|
|
446
|
-
//#region src/parse-dependency.d.ts
|
|
447
|
-
declare function parseDependency(fileOrGlob: string): Message | null;
|
|
448
|
-
//#endregion
|
|
449
437
|
//#region src/setup-config.d.ts
|
|
450
438
|
type SetupOptions = Partial<Config> & {
|
|
451
439
|
force?: boolean;
|
|
@@ -475,4 +463,4 @@ declare const hasUncompilableSources: (options: {
|
|
|
475
463
|
include?: readonly string[];
|
|
476
464
|
}) => boolean;
|
|
477
465
|
//#endregion
|
|
478
|
-
export { BambooContext, Builder, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive,
|
|
466
|
+
export { BambooContext, Builder, 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
|
@@ -4,7 +4,6 @@ import { DeadImport, StyleEncoder, Stylesheet } from "@bamboocss/core";
|
|
|
4
4
|
import { Generator, generatePackageExports } from "@bamboocss/generator";
|
|
5
5
|
import { ParserResult, Project } from "@bamboocss/parser";
|
|
6
6
|
import { AnalysisOptions, Artifact, ArtifactId, BambooHooks, Config, CssArtifactType, LoadConfigResult, Runtime, SpecFile, WatchOptions, WatcherEventType } from "@bamboocss/types";
|
|
7
|
-
import { Message, Root } from "postcss";
|
|
8
7
|
|
|
9
8
|
//#region src/diff-engine.d.ts
|
|
10
9
|
declare class DiffEngine {
|
|
@@ -195,11 +194,7 @@ declare class BambooContext extends Generator {
|
|
|
195
194
|
results: ParserResult[];
|
|
196
195
|
};
|
|
197
196
|
writeCss: (sheet?: Stylesheet) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
198
|
-
writeSplitCss: (sheet: Stylesheet
|
|
199
|
-
includeRecipes
|
|
200
|
-
}?: {
|
|
201
|
-
includeRecipes?: boolean;
|
|
202
|
-
}) => Promise<void>;
|
|
197
|
+
writeSplitCss: (sheet: Stylesheet) => Promise<void>;
|
|
203
198
|
watchConfig: (cb: (file: string) => void | Promise<void>, opts?: Omit<WatchOptions, "include">) => void;
|
|
204
199
|
watchFiles: (cb: (event: WatcherEventType, file: string) => void | Promise<void>, opts?: Omit<WatchOptions, "include" | "exclude" | "poll" | "cwd" | "logger">) => void;
|
|
205
200
|
}
|
|
@@ -231,7 +226,6 @@ declare class Builder {
|
|
|
231
226
|
private explicitDepsMeta;
|
|
232
227
|
private affecteds;
|
|
233
228
|
private configDependencies;
|
|
234
|
-
private pendingConfigCrawl;
|
|
235
229
|
/** Last complete included inventory, including members which have since been deleted. */
|
|
236
230
|
private sourceInventory;
|
|
237
231
|
/** Existing included owners selected by the last resolution-ledger invalidation pass. */
|
|
@@ -266,6 +260,25 @@ declare class Builder {
|
|
|
266
260
|
private resolutionAffectedThisPass;
|
|
267
261
|
/** Per-pass digests of re-read values, so N dependents of one edit digest each value once. */
|
|
268
262
|
private readDigestMemo;
|
|
263
|
+
/** Resolution ledger as it stood before this pass's first physical source mutation. */
|
|
264
|
+
private capturedLedger;
|
|
265
|
+
/**
|
|
266
|
+
* Reload one edited source, keeping the closure the next extraction pass has to select.
|
|
267
|
+
*
|
|
268
|
+
* An integration which shares this context has to refresh an edited module before anything
|
|
269
|
+
* folds against it — a consumer is transformed before the module it imports, so the fold
|
|
270
|
+
* would otherwise bake in the previous contents. Doing that through the Project directly
|
|
271
|
+
* loses the graph the rebuild needs: reloading retracts the file's own forward edges, and
|
|
272
|
+
* `invalidateChangedSources` reads them afterwards to find its dependents. So the mutation
|
|
273
|
+
* belongs here, behind a snapshot taken before the first of them.
|
|
274
|
+
*
|
|
275
|
+
* Once per pass, not once per file: the first mutation is the boundary, and every later one
|
|
276
|
+
* in the same event is already described by that snapshot. `refreshSourceState` consumes it.
|
|
277
|
+
*/
|
|
278
|
+
reloadSource: (filePath: string) => import("ts-morph").FileSystemRefreshResult | undefined;
|
|
279
|
+
/** The deletion half of `reloadSource`, with the same snapshot obligation. */
|
|
280
|
+
removeSource: (filePath: string) => boolean;
|
|
281
|
+
private captureResolutionLedger;
|
|
269
282
|
/** @internal Current and missing resolver paths which can change the stylesheet. */
|
|
270
283
|
getResolutionReadFiles: () => readonly string[];
|
|
271
284
|
/** @internal Exact local package/tsconfig files which can change semantic resolution. */
|
|
@@ -273,17 +286,7 @@ declare class Builder {
|
|
|
273
286
|
private readResolutionConfiguration;
|
|
274
287
|
private changedResolutionConfigurations;
|
|
275
288
|
private snapshotResolutionConfigurations;
|
|
276
|
-
|
|
277
|
-
* Remember what to crawl; do not crawl yet.
|
|
278
|
-
*
|
|
279
|
-
* The crawl walks the config's own import graph, and resolving a bare specifier there loads a
|
|
280
|
-
* whole TypeScript compiler. Only `registerDependency` reads the result, and only the PostCSS
|
|
281
|
-
* plugin calls that — the CLI and the Vite plugin (which crawls separately, when it watches)
|
|
282
|
-
* paid ~155ms of compiler load per build for a set neither of them ever read.
|
|
283
|
-
*/
|
|
284
|
-
setConfigDependencies(options: SetupContextOptions): void;
|
|
285
|
-
/** Crawl on first read, once per `setConfigDependencies`. */
|
|
286
|
-
private crawlConfigDependencies;
|
|
289
|
+
private recordConfigDependencies;
|
|
287
290
|
setup: (options?: {
|
|
288
291
|
configPath?: string;
|
|
289
292
|
cwd?: string;
|
|
@@ -351,31 +354,19 @@ declare class Builder {
|
|
|
351
354
|
};
|
|
352
355
|
extractFile: (ctx: BambooContext, file: string) => import("@bamboocss/parser").ParserResult | undefined;
|
|
353
356
|
extract: () => void;
|
|
354
|
-
isValidRoot: (root: Root) => boolean;
|
|
355
|
-
write: (root: Root) => void;
|
|
356
357
|
/**
|
|
357
358
|
* The finished stylesheet, as a string.
|
|
358
359
|
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* through here so a build cannot depend on which integration asked for it.
|
|
362
|
-
*
|
|
363
|
-
* `layerParams` is the one thing that differs between them, and it is not cosmetic: the
|
|
364
|
-
* `@layer a, b, c;` statement is what fixes layer *order*, and css layers are ordered by
|
|
365
|
-
* first appearance otherwise. `write` leaves it out because the root it appends to is a
|
|
366
|
-
* file that already declares it -- that declaration is what `isValidRoot` matches on. A
|
|
367
|
-
* virtual module is the whole stylesheet and has nothing to inherit it from.
|
|
360
|
+
* `layerParams` controls the `@layer a, b, c;` statement that fixes layer order. CSS layers
|
|
361
|
+
* are ordered by first appearance otherwise.
|
|
368
362
|
*
|
|
369
363
|
* `extract` has to have run first: this reads the encoder rather than filling it.
|
|
370
364
|
*/
|
|
371
365
|
toCss: ({
|
|
372
|
-
layerParams
|
|
373
|
-
includeRecipes
|
|
366
|
+
layerParams
|
|
374
367
|
}?: {
|
|
375
368
|
layerParams?: boolean;
|
|
376
|
-
includeRecipes?: boolean;
|
|
377
369
|
}) => string;
|
|
378
|
-
registerDependency: (fn: (dep: Message) => void) => void;
|
|
379
370
|
}
|
|
380
371
|
interface FileMeta {
|
|
381
372
|
mtime: number;
|
|
@@ -443,9 +434,6 @@ declare const setLogStream: (options: LogstreamOptions) => {
|
|
|
443
434
|
[Symbol.dispose]: () => void;
|
|
444
435
|
};
|
|
445
436
|
//#endregion
|
|
446
|
-
//#region src/parse-dependency.d.ts
|
|
447
|
-
declare function parseDependency(fileOrGlob: string): Message | null;
|
|
448
|
-
//#endregion
|
|
449
437
|
//#region src/setup-config.d.ts
|
|
450
438
|
type SetupOptions = Partial<Config> & {
|
|
451
439
|
force?: boolean;
|
|
@@ -475,4 +463,4 @@ declare const hasUncompilableSources: (options: {
|
|
|
475
463
|
include?: readonly string[];
|
|
476
464
|
}) => boolean;
|
|
477
465
|
//#endregion
|
|
478
|
-
export { BambooContext, Builder, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive,
|
|
466
|
+
export { BambooContext, Builder, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive, setLogStream, setupConfig, setupGitIgnore, spec, startProfiling };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isStaticCompilerActive, markStaticCompilerActive } from "./static-compiler.mjs";
|
|
2
2
|
import { Reporter, formatRecipeReport, formatTokenReport } from "@bamboocss/reporter";
|
|
3
3
|
import { colors, logger, quote } from "@bamboocss/logger";
|
|
4
|
-
import { convertTsPathsToRegexes, diffConfigs, findConfig,
|
|
4
|
+
import { convertTsPathsToRegexes, diffConfigs, findConfig, loadConfig, mergeHooks } from "@bamboocss/config";
|
|
5
5
|
import { BambooError, cssVarRefs, groupBy, truncateList, uniq } from "@bamboocss/shared";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { appendFileSync, existsSync, readFileSync, statSync, writeFileSync } from "fs";
|
|
@@ -22,8 +22,6 @@ import chokidar from "chokidar";
|
|
|
22
22
|
import glob from "fast-glob";
|
|
23
23
|
import fsExtra from "fs-extra";
|
|
24
24
|
import picomatch from "picomatch";
|
|
25
|
-
import isGlob from "is-glob";
|
|
26
|
-
import globParent from "glob-parent";
|
|
27
25
|
import { isMatch } from "matcher";
|
|
28
26
|
import { resolveTsPathPattern } from "@bamboocss/config/ts-path";
|
|
29
27
|
import readline from "node:readline";
|
|
@@ -2279,12 +2277,12 @@ var BambooContext = class extends Generator {
|
|
|
2279
2277
|
}]
|
|
2280
2278
|
});
|
|
2281
2279
|
};
|
|
2282
|
-
writeSplitCss = async (sheet
|
|
2280
|
+
writeSplitCss = async (sheet) => {
|
|
2283
2281
|
const { path: pathUtil, fs } = this.runtime;
|
|
2284
2282
|
const rootDir = this.paths.root;
|
|
2285
2283
|
const stylesDir = [...rootDir, "styles"];
|
|
2286
|
-
const artifacts = this.getSplitCssArtifacts(sheet
|
|
2287
|
-
const subDirs = new Set(
|
|
2284
|
+
const artifacts = this.getSplitCssArtifacts(sheet);
|
|
2285
|
+
const subDirs = new Set(artifacts.themes.map((a) => a.dir).filter(Boolean));
|
|
2288
2286
|
fs.ensureDirSync(pathUtil.join(...stylesDir));
|
|
2289
2287
|
subDirs.forEach((dir) => fs.ensureDirSync(pathUtil.join(...stylesDir, dir)));
|
|
2290
2288
|
const styleFiles = [];
|
|
@@ -2295,20 +2293,6 @@ var BambooContext = class extends Generator {
|
|
|
2295
2293
|
});
|
|
2296
2294
|
logger.info("css", pathUtil.join(...stylesDir, layer.file));
|
|
2297
2295
|
}
|
|
2298
|
-
for (const recipe of artifacts.recipes) {
|
|
2299
|
-
styleFiles.push({
|
|
2300
|
-
file: `${recipe.dir}/${recipe.file}`,
|
|
2301
|
-
code: recipe.code
|
|
2302
|
-
});
|
|
2303
|
-
logger.info("css", pathUtil.join(...stylesDir, recipe.dir, recipe.file));
|
|
2304
|
-
}
|
|
2305
|
-
if (artifacts.recipes.length) {
|
|
2306
|
-
styleFiles.push({
|
|
2307
|
-
file: "recipes.css",
|
|
2308
|
-
code: artifacts.recipesIndex
|
|
2309
|
-
});
|
|
2310
|
-
logger.info("css", pathUtil.join(...stylesDir, "recipes.css"));
|
|
2311
|
-
}
|
|
2312
2296
|
for (const theme of artifacts.themes) {
|
|
2313
2297
|
styleFiles.push({
|
|
2314
2298
|
file: `${theme.dir}/${theme.file}`,
|
|
@@ -2330,12 +2314,10 @@ var BambooContext = class extends Generator {
|
|
|
2330
2314
|
code: artifacts.index
|
|
2331
2315
|
}]
|
|
2332
2316
|
});
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
if (fs.existsSync(recipesDir)) fs.rmFileSync(recipesDir);
|
|
2338
|
-
}
|
|
2317
|
+
const recipesIndex = pathUtil.join(...stylesDir, "recipes.css");
|
|
2318
|
+
const recipesDir = pathUtil.join(...stylesDir, "recipes");
|
|
2319
|
+
if (fs.existsSync(recipesIndex)) fs.rmFileSync(recipesIndex);
|
|
2320
|
+
if (fs.existsSync(recipesDir)) fs.rmFileSync(recipesDir);
|
|
2339
2321
|
};
|
|
2340
2322
|
watchConfig = (cb, opts) => {
|
|
2341
2323
|
const { cwd, poll, exclude } = opts ?? {};
|
|
@@ -2439,44 +2421,6 @@ async function loadConfigAndCreateContext(options = {}) {
|
|
|
2439
2421
|
return new BambooContext(conf);
|
|
2440
2422
|
}
|
|
2441
2423
|
//#endregion
|
|
2442
|
-
//#region src/parse-glob.ts
|
|
2443
|
-
function parseGlob(pattern) {
|
|
2444
|
-
let glob = pattern;
|
|
2445
|
-
const base = globParent(pattern);
|
|
2446
|
-
if (base !== ".") {
|
|
2447
|
-
glob = pattern.substring(base.length);
|
|
2448
|
-
if (glob.charAt(0) === "/") glob = glob.substring(1);
|
|
2449
|
-
}
|
|
2450
|
-
if (glob.substring(0, 2) === "./") glob = glob.substring(2);
|
|
2451
|
-
if (glob.charAt(0) === "/") glob = glob.substring(1);
|
|
2452
|
-
return {
|
|
2453
|
-
base,
|
|
2454
|
-
glob
|
|
2455
|
-
};
|
|
2456
|
-
}
|
|
2457
|
-
//#endregion
|
|
2458
|
-
//#region src/parse-dependency.ts
|
|
2459
|
-
function parseDependency(fileOrGlob) {
|
|
2460
|
-
if (fileOrGlob.startsWith("!")) return null;
|
|
2461
|
-
let message = null;
|
|
2462
|
-
if (isGlob(fileOrGlob)) {
|
|
2463
|
-
const { base, glob } = parseGlob(fileOrGlob);
|
|
2464
|
-
message = {
|
|
2465
|
-
type: "dir-dependency",
|
|
2466
|
-
dir: normalize(resolve(base)),
|
|
2467
|
-
glob
|
|
2468
|
-
};
|
|
2469
|
-
} else message = {
|
|
2470
|
-
type: "dependency",
|
|
2471
|
-
file: normalize(resolve(fileOrGlob))
|
|
2472
|
-
};
|
|
2473
|
-
if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") message = {
|
|
2474
|
-
type: "dependency",
|
|
2475
|
-
file: normalize(resolve(message.dir))
|
|
2476
|
-
};
|
|
2477
|
-
return message;
|
|
2478
|
-
}
|
|
2479
|
-
//#endregion
|
|
2480
2424
|
//#region src/source-snapshots.ts
|
|
2481
2425
|
/**
|
|
2482
2426
|
* Every file `include` covers, read once.
|
|
@@ -3289,22 +3233,14 @@ function collectRenderedElements(ctx) {
|
|
|
3289
3233
|
* Vite, `bamboo cssgen`, and the CLI `bamboo` command all finish here so a recipe lowered to
|
|
3290
3234
|
* atoms cannot have a different sheet depending on which integration asked for it.
|
|
3291
3235
|
*/
|
|
3292
|
-
const assembleExtractedSheet = (ctx, { layerParams = false,
|
|
3293
|
-
|
|
3294
|
-
if (!includeRecipes) ctx.encoder.atomizeObservedRecipes();
|
|
3236
|
+
const assembleExtractedSheet = (ctx, { layerParams = false, sourceScanCache, mtimeOf, sourceInventory } = {}) => {
|
|
3237
|
+
ctx.encoder.atomizeObservedRecipes();
|
|
3295
3238
|
const sheet = ctx.createSheet();
|
|
3296
|
-
if (layerParams)
|
|
3297
|
-
else {
|
|
3239
|
+
if (layerParams) {
|
|
3298
3240
|
const recipeLayer = ctx.config.layers?.recipes ?? "recipes";
|
|
3299
3241
|
sheet.layers.root.prepend(`@layer ${sheet.layers.layerNames.filter((name) => name !== recipeLayer).join(", ")};`);
|
|
3300
3242
|
}
|
|
3301
|
-
ctx.appendBaselineCss(sheet);
|
|
3302
|
-
if (!includeRecipes) {
|
|
3303
|
-
sheet.layers.recipes.removeAll();
|
|
3304
|
-
sheet.layers.recipes_base.removeAll();
|
|
3305
|
-
sheet.layers.recipes_slots.removeAll();
|
|
3306
|
-
sheet.layers.recipes_slots_base.removeAll();
|
|
3307
|
-
}
|
|
3243
|
+
ctx.appendBaselineCss(sheet, { atomizeRecipes: true });
|
|
3308
3244
|
const collectElements = prunesPreflight(ctx.config.preflight);
|
|
3309
3245
|
const pruneKeyframes = Boolean(ctx.config.prune?.keyframes);
|
|
3310
3246
|
const declaredKeyframes = pruneKeyframes ? keyframeNames(ctx) : [];
|
|
@@ -3320,24 +3256,6 @@ const assembleExtractedSheet = (ctx, { layerParams = false, includeRecipes = fal
|
|
|
3320
3256
|
//#endregion
|
|
3321
3257
|
//#region src/builder.ts
|
|
3322
3258
|
const fileModifiedMap = /* @__PURE__ */ new Map();
|
|
3323
|
-
/**
|
|
3324
|
-
* The declaration that says generated css is already present in a root.
|
|
3325
|
-
*
|
|
3326
|
-
* `generateGlobalCss` emits it unconditionally and `appendBaselineCss` always reaches that
|
|
3327
|
-
* artifact, so anything carrying it holds a copy of the sheet however it got there — written
|
|
3328
|
-
* by `write` on an earlier pass, or inlined from `styles.css` by `postcss-import`.
|
|
3329
|
-
*
|
|
3330
|
-
* A declaration rather than a comment because it has to survive the css being minified
|
|
3331
|
-
* between the copy landing and this check running, which a comment does not.
|
|
3332
|
-
*/
|
|
3333
|
-
const GENERATED_SENTINEL = "--made-with-bamboo";
|
|
3334
|
-
function hasGeneratedCss(root) {
|
|
3335
|
-
let found = false;
|
|
3336
|
-
root.walkDecls(GENERATED_SENTINEL, () => {
|
|
3337
|
-
found = true;
|
|
3338
|
-
});
|
|
3339
|
-
return found;
|
|
3340
|
-
}
|
|
3341
3259
|
var Builder = class {
|
|
3342
3260
|
/**
|
|
3343
3261
|
* The current bamboo context
|
|
@@ -3348,7 +3266,6 @@ var Builder = class {
|
|
|
3348
3266
|
explicitDepsMeta;
|
|
3349
3267
|
affecteds;
|
|
3350
3268
|
configDependencies = /* @__PURE__ */ new Set();
|
|
3351
|
-
pendingConfigCrawl;
|
|
3352
3269
|
/** Last complete included inventory, including members which have since been deleted. */
|
|
3353
3270
|
sourceInventory;
|
|
3354
3271
|
/** Existing included owners selected by the last resolution-ledger invalidation pass. */
|
|
@@ -3383,6 +3300,35 @@ var Builder = class {
|
|
|
3383
3300
|
resolutionAffectedThisPass = false;
|
|
3384
3301
|
/** Per-pass digests of re-read values, so N dependents of one edit digest each value once. */
|
|
3385
3302
|
readDigestMemo = /* @__PURE__ */ new Map();
|
|
3303
|
+
/** Resolution ledger as it stood before this pass's first physical source mutation. */
|
|
3304
|
+
capturedLedger;
|
|
3305
|
+
/**
|
|
3306
|
+
* Reload one edited source, keeping the closure the next extraction pass has to select.
|
|
3307
|
+
*
|
|
3308
|
+
* An integration which shares this context has to refresh an edited module before anything
|
|
3309
|
+
* folds against it — a consumer is transformed before the module it imports, so the fold
|
|
3310
|
+
* would otherwise bake in the previous contents. Doing that through the Project directly
|
|
3311
|
+
* loses the graph the rebuild needs: reloading retracts the file's own forward edges, and
|
|
3312
|
+
* `invalidateChangedSources` reads them afterwards to find its dependents. So the mutation
|
|
3313
|
+
* belongs here, behind a snapshot taken before the first of them.
|
|
3314
|
+
*
|
|
3315
|
+
* Once per pass, not once per file: the first mutation is the boundary, and every later one
|
|
3316
|
+
* in the same event is already described by that snapshot. `refreshSourceState` consumes it.
|
|
3317
|
+
*/
|
|
3318
|
+
reloadSource = (filePath) => {
|
|
3319
|
+
const ctx = this.getContextOrThrow();
|
|
3320
|
+
this.captureResolutionLedger(ctx);
|
|
3321
|
+
return ctx.project.reloadSourceFile(filePath);
|
|
3322
|
+
};
|
|
3323
|
+
/** The deletion half of `reloadSource`, with the same snapshot obligation. */
|
|
3324
|
+
removeSource = (filePath) => {
|
|
3325
|
+
const ctx = this.getContextOrThrow();
|
|
3326
|
+
this.captureResolutionLedger(ctx);
|
|
3327
|
+
return ctx.project.removeSourceFile(filePath);
|
|
3328
|
+
};
|
|
3329
|
+
captureResolutionLedger = (ctx) => {
|
|
3330
|
+
this.capturedLedger ??= ctx.project.getResolutionLedger();
|
|
3331
|
+
};
|
|
3386
3332
|
/** @internal Current and missing resolver paths which can change the stylesheet. */
|
|
3387
3333
|
getResolutionReadFiles = () => {
|
|
3388
3334
|
const files = /* @__PURE__ */ new Set();
|
|
@@ -3413,41 +3359,13 @@ var Builder = class {
|
|
|
3413
3359
|
for (const file of current) this.resolutionConfigurationBytes.set(file, this.readResolutionConfiguration(file));
|
|
3414
3360
|
for (const file of this.resolutionConfigurationBytes.keys()) if (!current.has(file)) this.resolutionConfigurationBytes.delete(file);
|
|
3415
3361
|
};
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
* whole TypeScript compiler. Only `registerDependency` reads the result, and only the PostCSS
|
|
3421
|
-
* plugin calls that — the CLI and the Vite plugin (which crawls separately, when it watches)
|
|
3422
|
-
* paid ~155ms of compiler load per build for a set neither of them ever read.
|
|
3423
|
-
*/
|
|
3424
|
-
setConfigDependencies(options) {
|
|
3425
|
-
this.pendingConfigCrawl = options;
|
|
3426
|
-
const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
|
|
3427
|
-
for (const file of this.context?.conf.dependencies ?? []) this.configDependencies.add(resolve(cwd, file));
|
|
3428
|
-
}
|
|
3429
|
-
/** Crawl on first read, once per `setConfigDependencies`. */
|
|
3430
|
-
crawlConfigDependencies() {
|
|
3431
|
-
const options = this.pendingConfigCrawl;
|
|
3432
|
-
if (!options) return;
|
|
3433
|
-
this.pendingConfigCrawl = void 0;
|
|
3434
|
-
const tsOptions = this.context?.conf.tsOptions ?? {
|
|
3435
|
-
baseUrl: void 0,
|
|
3436
|
-
pathMappings: []
|
|
3437
|
-
};
|
|
3438
|
-
const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
|
|
3439
|
-
const { deps } = getConfigDependencies(options.configPath, tsOptions, compilerOptions);
|
|
3440
|
-
deps.forEach((file) => this.configDependencies.add(file));
|
|
3441
|
-
logger.debug("builder", "Config dependencies");
|
|
3442
|
-
logger.debug("builder", deps);
|
|
3443
|
-
}
|
|
3362
|
+
recordConfigDependencies = (ctx, cwd) => {
|
|
3363
|
+
const root = cwd ?? ctx.config.cwd;
|
|
3364
|
+
for (const file of uniq([...ctx.conf.dependencies, ...ctx.explicitDeps])) this.configDependencies.add(resolve(root, file));
|
|
3365
|
+
};
|
|
3444
3366
|
setup = async (options = {}) => {
|
|
3445
3367
|
logger.debug("builder", "🚧 Setup");
|
|
3446
3368
|
const configPath = options.configPath ?? findConfig({ cwd: options.cwd });
|
|
3447
|
-
this.setConfigDependencies({
|
|
3448
|
-
configPath,
|
|
3449
|
-
cwd: options.cwd
|
|
3450
|
-
});
|
|
3451
3369
|
if (!this.context) return this.setupContext({
|
|
3452
3370
|
configPath,
|
|
3453
3371
|
cwd: options.cwd,
|
|
@@ -3485,7 +3403,9 @@ var Builder = class {
|
|
|
3485
3403
|
this.affecteds = await ctx.diff.reloadConfigAndRefreshContext((conf) => {
|
|
3486
3404
|
this.context = new BambooContext(conf);
|
|
3487
3405
|
});
|
|
3488
|
-
|
|
3406
|
+
const nextContext = this.getContextOrThrow();
|
|
3407
|
+
this.recordConfigDependencies(nextContext, options.cwd);
|
|
3408
|
+
this.tsconfigResolutionFiles = nextContext.diff.getResolutionConfigFiles();
|
|
3489
3409
|
logger.debug("builder", this.affecteds);
|
|
3490
3410
|
this.explicitDepsMeta = this.checkFilesChanged(this.context.explicitDeps);
|
|
3491
3411
|
if (this.explicitDepsMeta.hasFilesChanged) {
|
|
@@ -3509,6 +3429,7 @@ var Builder = class {
|
|
|
3509
3429
|
this.sourceScanCache.entries.clear();
|
|
3510
3430
|
this.extractionReadsByOwner.clear();
|
|
3511
3431
|
this.recipeSurfaceByOwner.clear();
|
|
3432
|
+
this.capturedLedger = void 0;
|
|
3512
3433
|
await ctx.hooks["config:change"]?.({
|
|
3513
3434
|
config: ctx.config,
|
|
3514
3435
|
changes: this.affecteds
|
|
@@ -3545,7 +3466,8 @@ var Builder = class {
|
|
|
3545
3466
|
const changedResolutionConfigurations = this.changedResolutionConfigurations();
|
|
3546
3467
|
const changedResolutionSet = new Set(changedResolutionConfigurations);
|
|
3547
3468
|
const resolutionAffected = /* @__PURE__ */ new Set();
|
|
3548
|
-
const resolutionLedger = changedResolutionConfigurations.length ? ctx.project.getResolutionLedger() : void 0;
|
|
3469
|
+
const resolutionLedger = this.capturedLedger ?? (changedResolutionConfigurations.length ? ctx.project.getResolutionLedger() : void 0);
|
|
3470
|
+
this.capturedLedger = void 0;
|
|
3549
3471
|
for (const [owner, configurations] of this.resolutionConfigurationSets) if (configurations.some((file) => changedResolutionSet.has(file))) resolutionAffected.add(owner);
|
|
3550
3472
|
this.resolutionAffectedThisPass = resolutionAffected.size > 0;
|
|
3551
3473
|
if (changedResolutionConfigurations.length) {
|
|
@@ -3683,9 +3605,7 @@ var Builder = class {
|
|
|
3683
3605
|
cwd,
|
|
3684
3606
|
dev
|
|
3685
3607
|
});
|
|
3686
|
-
|
|
3687
|
-
this.configDependencies.add(resolve(cwd || ctx.conf.config.cwd, file));
|
|
3688
|
-
});
|
|
3608
|
+
this.recordConfigDependencies(ctx, cwd);
|
|
3689
3609
|
this.context = ctx;
|
|
3690
3610
|
this.tsconfigResolutionFiles = ctx.diff.getResolutionConfigFiles();
|
|
3691
3611
|
return ctx;
|
|
@@ -3844,59 +3764,24 @@ var Builder = class {
|
|
|
3844
3764
|
ctx.assertExtracted(files);
|
|
3845
3765
|
ctx.assertNoDeadCalls(files);
|
|
3846
3766
|
};
|
|
3847
|
-
isValidRoot = (root) => {
|
|
3848
|
-
const ctx = this.getContextOrThrow();
|
|
3849
|
-
let valid = false;
|
|
3850
|
-
root.walkAtRules("layer", (rule) => {
|
|
3851
|
-
if (ctx.isValidLayerParams(rule.params)) valid = true;
|
|
3852
|
-
});
|
|
3853
|
-
return valid;
|
|
3854
|
-
};
|
|
3855
|
-
write = (root) => {
|
|
3856
|
-
if (hasGeneratedCss(root)) {
|
|
3857
|
-
logger.warn("postcss", "Generated css is already present in this file, so nothing was injected. It is imported and generated here at once — keep the `@import` of `styles.css` or the `@layer` statement that the postcss plugin injects at, not both.");
|
|
3858
|
-
return;
|
|
3859
|
-
}
|
|
3860
|
-
root.append(this.toCss());
|
|
3861
|
-
};
|
|
3862
3767
|
/**
|
|
3863
3768
|
* The finished stylesheet, as a string.
|
|
3864
3769
|
*
|
|
3865
|
-
*
|
|
3866
|
-
*
|
|
3867
|
-
* through here so a build cannot depend on which integration asked for it.
|
|
3868
|
-
*
|
|
3869
|
-
* `layerParams` is the one thing that differs between them, and it is not cosmetic: the
|
|
3870
|
-
* `@layer a, b, c;` statement is what fixes layer *order*, and css layers are ordered by
|
|
3871
|
-
* first appearance otherwise. `write` leaves it out because the root it appends to is a
|
|
3872
|
-
* file that already declares it -- that declaration is what `isValidRoot` matches on. A
|
|
3873
|
-
* virtual module is the whole stylesheet and has nothing to inherit it from.
|
|
3770
|
+
* `layerParams` controls the `@layer a, b, c;` statement that fixes layer order. CSS layers
|
|
3771
|
+
* are ordered by first appearance otherwise.
|
|
3874
3772
|
*
|
|
3875
3773
|
* `extract` has to have run first: this reads the encoder rather than filling it.
|
|
3876
3774
|
*/
|
|
3877
|
-
toCss = ({ layerParams = false
|
|
3775
|
+
toCss = ({ layerParams = false } = {}) => {
|
|
3878
3776
|
const ctx = this.getContextOrThrow();
|
|
3879
3777
|
const sheet = assembleExtractedSheet(ctx, {
|
|
3880
3778
|
layerParams,
|
|
3881
|
-
includeRecipes,
|
|
3882
3779
|
sourceScanCache: this.sourceScanCache,
|
|
3883
3780
|
mtimeOf: (filePath) => this.filesMeta?.changes.get(filePath)?.mtime,
|
|
3884
3781
|
sourceInventory: this.sourceInventory
|
|
3885
3782
|
});
|
|
3886
3783
|
return ctx.getCss(sheet);
|
|
3887
3784
|
};
|
|
3888
|
-
registerDependency = (fn) => {
|
|
3889
|
-
const ctx = this.getContextOrThrow();
|
|
3890
|
-
this.crawlConfigDependencies();
|
|
3891
|
-
for (const fileOrGlob of ctx.config.include) {
|
|
3892
|
-
const dependency = parseDependency(fileOrGlob);
|
|
3893
|
-
if (dependency) fn(dependency);
|
|
3894
|
-
}
|
|
3895
|
-
for (const file of this.configDependencies) fn({
|
|
3896
|
-
type: "dependency",
|
|
3897
|
-
file: normalize(resolve(file))
|
|
3898
|
-
});
|
|
3899
|
-
};
|
|
3900
3785
|
};
|
|
3901
3786
|
//#endregion
|
|
3902
3787
|
//#region src/cpu-profile.ts
|
|
@@ -3981,11 +3866,8 @@ const cssgen = async (ctx, options) => {
|
|
|
3981
3866
|
} else {
|
|
3982
3867
|
const { files } = ctx.parseFiles();
|
|
3983
3868
|
const done = logger.time.info(ctx.messages.buildComplete(files.length));
|
|
3984
|
-
const sheet = assembleExtractedSheet(ctx, {
|
|
3985
|
-
|
|
3986
|
-
includeRecipes: false
|
|
3987
|
-
});
|
|
3988
|
-
if (splitting) await ctx.writeSplitCss(sheet, { includeRecipes: false });
|
|
3869
|
+
const sheet = assembleExtractedSheet(ctx, { layerParams: true });
|
|
3870
|
+
if (splitting) await ctx.writeSplitCss(sheet);
|
|
3989
3871
|
else if (outfile) {
|
|
3990
3872
|
const css = ctx.getCss(sheet);
|
|
3991
3873
|
logger.info("css", ctx.runtime.path.resolve(outfile));
|
|
@@ -4050,10 +3932,7 @@ async function build(ctx, artifactIds) {
|
|
|
4050
3932
|
if (ctx.config.emitTokensOnly) return logger.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens ✨");
|
|
4051
3933
|
const done = logger.time.info("");
|
|
4052
3934
|
const parsed = ctx.parseFiles();
|
|
4053
|
-
const sheet = assembleExtractedSheet(ctx, {
|
|
4054
|
-
layerParams: true,
|
|
4055
|
-
includeRecipes: false
|
|
4056
|
-
});
|
|
3935
|
+
const sheet = assembleExtractedSheet(ctx, { layerParams: true });
|
|
4057
3936
|
await ctx.writeCss(sheet);
|
|
4058
3937
|
done(ctx.messages.buildComplete(parsed.files.length));
|
|
4059
3938
|
}
|
|
@@ -4094,10 +3973,7 @@ async function generate(config, configPath) {
|
|
|
4094
3973
|
if (parsed === 0) return;
|
|
4095
3974
|
const outfile = ctx.runtime.path.join(...ctx.paths.root, "styles.css");
|
|
4096
3975
|
const done = logger.time.info(ctx.messages.buildComplete(parsed));
|
|
4097
|
-
const sheet = assembleExtractedSheet(ctx, {
|
|
4098
|
-
layerParams: true,
|
|
4099
|
-
includeRecipes: false
|
|
4100
|
-
});
|
|
3976
|
+
const sheet = assembleExtractedSheet(ctx, { layerParams: true });
|
|
4101
3977
|
const css = ctx.getCss(sheet);
|
|
4102
3978
|
await ctx.runtime.fs.writeFile(outfile, css);
|
|
4103
3979
|
done();
|
|
@@ -4298,4 +4174,4 @@ const hasUncompilableSources = (options) => {
|
|
|
4298
4174
|
}
|
|
4299
4175
|
};
|
|
4300
4176
|
//#endregion
|
|
4301
|
-
export { BambooContext, Builder, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive,
|
|
4177
|
+
export { BambooContext, Builder, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive, setLogStream, setupConfig, setupGitIgnore, spec, startProfiling };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.0",
|
|
4
4
|
"description": "The core css bamboo library",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,8 +50,6 @@
|
|
|
50
50
|
"fast-glob": "3.3.3",
|
|
51
51
|
"fs-extra": "11.3.2",
|
|
52
52
|
"get-tsconfig": "^4.13.0",
|
|
53
|
-
"glob-parent": "6.0.2",
|
|
54
|
-
"is-glob": "4.0.3",
|
|
55
53
|
"lodash.merge": "4.6.2",
|
|
56
54
|
"look-it-up": "2.1.0",
|
|
57
55
|
"matcher": "6.0.0",
|
|
@@ -62,25 +60,22 @@
|
|
|
62
60
|
"picomatch": "4.0.5",
|
|
63
61
|
"pkg-types": "2.3.0",
|
|
64
62
|
"pluralize": "8.0.0",
|
|
65
|
-
"postcss": "8.5.26",
|
|
66
63
|
"ts-morph": "28.0.0",
|
|
67
64
|
"ts-pattern": "5.9.0",
|
|
68
|
-
"@bamboocss/config": "1.
|
|
69
|
-
"@bamboocss/core": "1.
|
|
70
|
-
"@bamboocss/generator": "1.
|
|
71
|
-
"@bamboocss/logger": "1.
|
|
72
|
-
"@bamboocss/parser": "1.
|
|
73
|
-
"@bamboocss/plugin-svelte": "1.
|
|
74
|
-
"@bamboocss/plugin-vue": "1.
|
|
75
|
-
"@bamboocss/reporter": "1.
|
|
76
|
-
"@bamboocss/shared": "1.
|
|
77
|
-
"@bamboocss/token-dictionary": "1.
|
|
78
|
-
"@bamboocss/types": "1.
|
|
65
|
+
"@bamboocss/config": "1.48.0",
|
|
66
|
+
"@bamboocss/core": "1.48.0",
|
|
67
|
+
"@bamboocss/generator": "1.48.0",
|
|
68
|
+
"@bamboocss/logger": "1.48.0",
|
|
69
|
+
"@bamboocss/parser": "1.48.0",
|
|
70
|
+
"@bamboocss/plugin-svelte": "1.48.0",
|
|
71
|
+
"@bamboocss/plugin-vue": "1.48.0",
|
|
72
|
+
"@bamboocss/reporter": "1.48.0",
|
|
73
|
+
"@bamboocss/shared": "1.48.0",
|
|
74
|
+
"@bamboocss/token-dictionary": "1.48.0",
|
|
75
|
+
"@bamboocss/types": "1.48.0"
|
|
79
76
|
},
|
|
80
77
|
"devDependencies": {
|
|
81
78
|
"@types/fs-extra": "11.0.4",
|
|
82
|
-
"@types/glob-parent": "5.1.3",
|
|
83
|
-
"@types/is-glob": "4.0.4",
|
|
84
79
|
"@types/picomatch": "4.0.2",
|
|
85
80
|
"boxen": "8.0.1"
|
|
86
81
|
},
|