@bamboocss/node 1.46.3 → 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/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 {
@@ -227,7 +226,6 @@ declare class Builder {
227
226
  private explicitDepsMeta;
228
227
  private affecteds;
229
228
  private configDependencies;
230
- private pendingConfigCrawl;
231
229
  /** Last complete included inventory, including members which have since been deleted. */
232
230
  private sourceInventory;
233
231
  /** Existing included owners selected by the last resolution-ledger invalidation pass. */
@@ -262,6 +260,25 @@ declare class Builder {
262
260
  private resolutionAffectedThisPass;
263
261
  /** Per-pass digests of re-read values, so N dependents of one edit digest each value once. */
264
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;
265
282
  /** @internal Current and missing resolver paths which can change the stylesheet. */
266
283
  getResolutionReadFiles: () => readonly string[];
267
284
  /** @internal Exact local package/tsconfig files which can change semantic resolution. */
@@ -269,17 +286,7 @@ declare class Builder {
269
286
  private readResolutionConfiguration;
270
287
  private changedResolutionConfigurations;
271
288
  private snapshotResolutionConfigurations;
272
- /**
273
- * Remember what to crawl; do not crawl yet.
274
- *
275
- * The crawl walks the config's own import graph, and resolving a bare specifier there loads a
276
- * whole TypeScript compiler. Only `registerDependency` reads the result, and only the PostCSS
277
- * plugin calls that — the CLI and the Vite plugin (which crawls separately, when it watches)
278
- * paid ~155ms of compiler load per build for a set neither of them ever read.
279
- */
280
- setConfigDependencies(options: SetupContextOptions): void;
281
- /** Crawl on first read, once per `setConfigDependencies`. */
282
- private crawlConfigDependencies;
289
+ private recordConfigDependencies;
283
290
  setup: (options?: {
284
291
  configPath?: string;
285
292
  cwd?: string;
@@ -347,31 +354,19 @@ declare class Builder {
347
354
  };
348
355
  extractFile: (ctx: BambooContext, file: string) => import("@bamboocss/parser").ParserResult | undefined;
349
356
  extract: () => void;
350
- isValidRoot: (root: Root) => boolean;
351
- write: (root: Root) => void;
352
357
  /**
353
358
  * The finished stylesheet, as a string.
354
359
  *
355
- * The same sheet `write` injects into a postcss root, for callers that want the css
356
- * rather than a mutated root -- the vite plugin serves it as a virtual module. Both go
357
- * through here so a build cannot depend on which integration asked for it.
358
- *
359
- * `layerParams` is the one thing that differs between them, and it is not cosmetic: the
360
- * `@layer a, b, c;` statement is what fixes layer *order*, and css layers are ordered by
361
- * first appearance otherwise. `write` leaves it out because the root it appends to is a
362
- * file that already declares it -- that declaration is what `isValidRoot` matches on. A
363
- * 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.
364
362
  *
365
363
  * `extract` has to have run first: this reads the encoder rather than filling it.
366
364
  */
367
365
  toCss: ({
368
- layerParams,
369
- includeRecipes
366
+ layerParams
370
367
  }?: {
371
368
  layerParams?: boolean;
372
- includeRecipes?: boolean;
373
369
  }) => string;
374
- registerDependency: (fn: (dep: Message) => void) => void;
375
370
  }
376
371
  interface FileMeta {
377
372
  mtime: number;
@@ -439,15 +434,11 @@ declare const setLogStream: (options: LogstreamOptions) => {
439
434
  [Symbol.dispose]: () => void;
440
435
  };
441
436
  //#endregion
442
- //#region src/parse-dependency.d.ts
443
- declare function parseDependency(fileOrGlob: string): Message | null;
444
- //#endregion
445
437
  //#region src/setup-config.d.ts
446
438
  type SetupOptions = Partial<Config> & {
447
439
  force?: boolean;
448
440
  };
449
441
  declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
450
- declare function setupPostcss(cwd: string): Promise<void>;
451
442
  //#endregion
452
443
  //#region src/spec.d.ts
453
444
  interface SpecOptions {
@@ -472,4 +463,4 @@ declare const hasUncompilableSources: (options: {
472
463
  include?: readonly string[];
473
464
  }) => boolean;
474
465
  //#endregion
475
- export { BambooContext, Builder, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive, parseDependency, setLogStream, setupConfig, setupGitIgnore, setupPostcss, spec, startProfiling };
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 {
@@ -227,7 +226,6 @@ declare class Builder {
227
226
  private explicitDepsMeta;
228
227
  private affecteds;
229
228
  private configDependencies;
230
- private pendingConfigCrawl;
231
229
  /** Last complete included inventory, including members which have since been deleted. */
232
230
  private sourceInventory;
233
231
  /** Existing included owners selected by the last resolution-ledger invalidation pass. */
@@ -262,6 +260,25 @@ declare class Builder {
262
260
  private resolutionAffectedThisPass;
263
261
  /** Per-pass digests of re-read values, so N dependents of one edit digest each value once. */
264
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;
265
282
  /** @internal Current and missing resolver paths which can change the stylesheet. */
266
283
  getResolutionReadFiles: () => readonly string[];
267
284
  /** @internal Exact local package/tsconfig files which can change semantic resolution. */
@@ -269,17 +286,7 @@ declare class Builder {
269
286
  private readResolutionConfiguration;
270
287
  private changedResolutionConfigurations;
271
288
  private snapshotResolutionConfigurations;
272
- /**
273
- * Remember what to crawl; do not crawl yet.
274
- *
275
- * The crawl walks the config's own import graph, and resolving a bare specifier there loads a
276
- * whole TypeScript compiler. Only `registerDependency` reads the result, and only the PostCSS
277
- * plugin calls that — the CLI and the Vite plugin (which crawls separately, when it watches)
278
- * paid ~155ms of compiler load per build for a set neither of them ever read.
279
- */
280
- setConfigDependencies(options: SetupContextOptions): void;
281
- /** Crawl on first read, once per `setConfigDependencies`. */
282
- private crawlConfigDependencies;
289
+ private recordConfigDependencies;
283
290
  setup: (options?: {
284
291
  configPath?: string;
285
292
  cwd?: string;
@@ -347,31 +354,19 @@ declare class Builder {
347
354
  };
348
355
  extractFile: (ctx: BambooContext, file: string) => import("@bamboocss/parser").ParserResult | undefined;
349
356
  extract: () => void;
350
- isValidRoot: (root: Root) => boolean;
351
- write: (root: Root) => void;
352
357
  /**
353
358
  * The finished stylesheet, as a string.
354
359
  *
355
- * The same sheet `write` injects into a postcss root, for callers that want the css
356
- * rather than a mutated root -- the vite plugin serves it as a virtual module. Both go
357
- * through here so a build cannot depend on which integration asked for it.
358
- *
359
- * `layerParams` is the one thing that differs between them, and it is not cosmetic: the
360
- * `@layer a, b, c;` statement is what fixes layer *order*, and css layers are ordered by
361
- * first appearance otherwise. `write` leaves it out because the root it appends to is a
362
- * file that already declares it -- that declaration is what `isValidRoot` matches on. A
363
- * 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.
364
362
  *
365
363
  * `extract` has to have run first: this reads the encoder rather than filling it.
366
364
  */
367
365
  toCss: ({
368
- layerParams,
369
- includeRecipes
366
+ layerParams
370
367
  }?: {
371
368
  layerParams?: boolean;
372
- includeRecipes?: boolean;
373
369
  }) => string;
374
- registerDependency: (fn: (dep: Message) => void) => void;
375
370
  }
376
371
  interface FileMeta {
377
372
  mtime: number;
@@ -439,15 +434,11 @@ declare const setLogStream: (options: LogstreamOptions) => {
439
434
  [Symbol.dispose]: () => void;
440
435
  };
441
436
  //#endregion
442
- //#region src/parse-dependency.d.ts
443
- declare function parseDependency(fileOrGlob: string): Message | null;
444
- //#endregion
445
437
  //#region src/setup-config.d.ts
446
438
  type SetupOptions = Partial<Config> & {
447
439
  force?: boolean;
448
440
  };
449
441
  declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
450
- declare function setupPostcss(cwd: string): Promise<void>;
451
442
  //#endregion
452
443
  //#region src/spec.d.ts
453
444
  interface SpecOptions {
@@ -472,4 +463,4 @@ declare const hasUncompilableSources: (options: {
472
463
  include?: readonly string[];
473
464
  }) => boolean;
474
465
  //#endregion
475
- export { BambooContext, Builder, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive, parseDependency, setLogStream, setupConfig, setupGitIgnore, setupPostcss, spec, startProfiling };
466
+ export { BambooContext, Builder, type CssGenOptions, analyze, buildInfo, codegen, cssgen, debug, findViteConfig, generate, generatePackageExports, hasUncompilableSources, isStaticCompilerActive, loadConfigAndCreateContext, markStaticCompilerActive, setLogStream, setupConfig, setupGitIgnore, spec, startProfiling };