@rsbuild/core 2.2.11 → 2.2.12

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.
@@ -1,5 +1,6 @@
1
1
  import type { Stats as FSStats } from 'node:fs';
2
2
  import type { InternalContext, Rspack } from '../../types/index.js';
3
+ export declare const UP_PATH_REGEXP: RegExp;
3
4
  /**
4
5
  * Resolves URL to file path with security checks and retrieves file from
5
6
  * the build output directories.
@@ -1,3 +1,2 @@
1
1
  import type { Compiler, OutputFileSystem } from '@rspack/core';
2
- import type { ResolvedWriteToDisk } from './setupWriteToDisk.js';
3
- export declare function setupOutputFileSystem(writeToDisk: ResolvedWriteToDisk, compilers: Compiler[]): Promise<OutputFileSystem>;
2
+ export declare function setupOutputFileSystem(writeAllToDisk: boolean, compilers: Compiler[]): Promise<OutputFileSystem>;
@@ -1,30 +1,27 @@
1
1
  import type { Compiler } from '@rspack/core';
2
2
  import type { Logger } from '../../logger.js';
3
- import type { EnvironmentContext, NormalizedDevConfig } from '../../types/index.js';
3
+ import type { WriteToDisk } from '../../types/index.js';
4
4
  declare module '@rspack/core' {
5
5
  interface Compiler {
6
6
  __hasRsbuildAssetEmittedCallback?: boolean;
7
7
  }
8
8
  }
9
- export type ResolvedWriteToDisk = boolean | ((filePath: string, name?: string) => boolean);
10
- /**
11
- * Resolve writeToDisk config across multiple environments.
12
- * Returns the unified config if all environments have the same value,
13
- * otherwise returns a function that resolves config based on compilation.
14
- */ export declare const resolveWriteToDiskConfig: (config: NormalizedDevConfig, environments: Record<string, EnvironmentContext>, environmentList: EnvironmentContext[]) => ResolvedWriteToDisk;
15
9
  /**
16
10
  * Copy selected assets from the compiler's output file system to disk.
17
11
  * Rspack always writes to compiler.outputFileSystem; this hook handles any
18
- * additional disk writes requested by dev.writeToDisk:
12
+ * additional disk writes requested by each environment's dev.writeToDisk:
19
13
  *
14
+ * - With `false`, no hook is registered, so the environment's assets are
15
+ * never read for disk writes.
20
16
  * - With `true` and the native Node.js fs, Rspack already writes to disk,
21
17
  * so no extra write is needed.
22
18
  * - With a predicate, Rspack writes to memory and this hook copies only
23
19
  * the files accepted by the predicate to disk.
24
- * - With different settings across environments, Rspack writes to memory
25
- * and the resolved predicate selects files using each environment's setting.
26
- * - With `true` and a custom output file system, keep copying to disk because
27
- * the custom file system may store assets somewhere else, such as memory.
20
+ * - With `true` and a non-native output file system, copy every file to disk.
21
+ * This happens when environments have different settings and share the
22
+ * memory fs, or with a custom output file system that may store assets
23
+ * somewhere else.
28
24
  *
25
+ * `writeToDiskList` holds the writeToDisk value for each compiler, in order.
29
26
  * When all environments disable writeToDisk, the caller skips this setup.
30
- */ export declare function setupWriteToDisk(compilers: Compiler[], writeToDisk: ResolvedWriteToDisk, logger: Logger): void;
27
+ */ export declare function setupWriteToDisk(compilers: Compiler[], writeToDiskList: WriteToDisk[], logger: Logger): void;
@@ -63,6 +63,7 @@ export type AsyncHook<Callback extends (...args: any[]) => T, T = any> = {
63
63
  * The callback can be a plain function or a HookDescriptor that includes execution order.
64
64
  * @param cb The callback function or hook descriptor to register
65
65
  */ tap: (cb: Callback | HookDescriptor<Callback>) => void;
66
+ /** Registers a callback that is removed before its first execution. */ tapOnce: (cb: Callback | HookDescriptor<Callback>) => void;
66
67
  /**
67
68
  * Executes callbacks in sequence, passing the result of each callback as the first argument
68
69
  * to the next callback in the chain. If a callback returns undefined, the original arguments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.2.11",
3
+ "version": "2.2.12",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -41,13 +41,13 @@
41
41
  "devDependencies": {
42
42
  "@jridgewell/remapping": "^2.3.5",
43
43
  "@jridgewell/trace-mapping": "^0.3.31",
44
- "@jsonjoy.com/fs-core": "4.79.0",
44
+ "@jsonjoy.com/fs-core": "4.80.0",
45
45
  "@rstackjs/load-config": "^1.0.1",
46
46
  "@types/cors": "^2.8.19",
47
- "@types/node": "^24.13.6",
47
+ "@types/node": "^24.19.1",
48
48
  "@types/on-finished": "2.3.5",
49
49
  "@types/range-parser": "^1.2.7",
50
- "@types/ws": "^8.18.1",
50
+ "@types/ws": "^8.18.2",
51
51
  "browserslist-load-config": "^1.0.3",
52
52
  "cac": "^7.0.0",
53
53
  "chokidar": "^5.0.0",
@@ -62,7 +62,7 @@
62
62
  "http-proxy-middleware": "4.2.0",
63
63
  "jiti": "^2.7.0",
64
64
  "launch-editor-middleware": "^2.14.1",
65
- "memfs": "4.79.0",
65
+ "memfs": "4.80.0",
66
66
  "mrmime": "^2.0.1",
67
67
  "on-finished": "2.4.1",
68
68
  "open": "^11.0.4",