@rsbuild/core 2.2.11 → 2.2.13
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/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.d.ts +16 -2
- package/compiled/html-rspack-plugin/index.js +78 -28
- package/compiled/jiti/lib/jiti-cli.mjs +0 -0
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/ws/index.d.ts +4 -0
- package/compiled/ws/package.json +1 -1
- package/dist/cssUrlLoader.mjs +15 -5
- package/dist/launch-editor-middleware.js +1 -1
- package/dist/loader/cssUrlLoader.d.ts +1 -0
- package/dist/m.js +324 -179
- package/dist/manifest-plugin.js +1 -1
- package/dist/memfs.js +1 -1
- package/dist/plugins/fileSize.d.ts +11 -0
- package/dist/server/assets-middleware/getFileFromUrl.d.ts +1 -0
- package/dist/server/assets-middleware/setupOutputFileSystem.d.ts +1 -2
- package/dist/server/assets-middleware/setupWriteToDisk.d.ts +10 -13
- package/dist/server/hostCheck.d.ts +7 -0
- package/dist/types/config.d.ts +8 -1
- package/dist/types/plugin.d.ts +1 -0
- package/package.json +13 -9
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
* modified from https://github.com/facebook/create-react-app
|
|
3
3
|
* license at https://github.com/facebook/create-react-app/blob/master/LICENSE
|
|
4
4
|
*/ import type { InternalContext, PrintFileSizeAsset, RsbuildPlugin } from '../types/index.js';
|
|
5
|
+
type AssetProcessor = (names: string[], processAsset: (name: string, index: number) => Promise<void>) => Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Processes up to 16 assets at a time across all environments in one build.
|
|
8
|
+
* Reads each asset only when a slot is available and starts the next asset
|
|
9
|
+
* as soon as one finishes. Passes the original index to preserve result order.
|
|
10
|
+
*
|
|
11
|
+
* On failure, stops starting new tasks. Each call waits for its running tasks
|
|
12
|
+
* to finish before throwing the first error. Create a new processor for each
|
|
13
|
+
* build to reset this error state.
|
|
14
|
+
*/ export declare function createAssetProcessor(): AssetProcessor;
|
|
5
15
|
/** Normalize file path by removing hash for comparison across builds */ export declare function normalizeFilePath(filePath: string): string;
|
|
6
16
|
/** Exclude source map, license, and type declaration files by default */ export declare const excludeAsset: (asset: PrintFileSizeAsset) => boolean;
|
|
7
17
|
export declare const pluginFileSize: (context: InternalContext) => RsbuildPlugin;
|
|
18
|
+
export { };
|
|
@@ -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
|
-
|
|
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 {
|
|
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
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
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[],
|
|
27
|
+
*/ export declare function setupWriteToDisk(compilers: Compiler[], writeToDiskList: WriteToDisk[], logger: Logger): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IncomingHttpHeaders } from 'node:http';
|
|
2
|
+
import type { Connect } from '../types/index.js';
|
|
3
|
+
import type { UpgradeEvent } from './helper.js';
|
|
4
|
+
export declare function createHostCheckMiddleware(allowedHosts: readonly string[]): Connect.NextHandleFunction;
|
|
5
|
+
export declare function withHostCheck(onUpgrade: UpgradeEvent, allowedHosts: readonly string[]): UpgradeEvent;
|
|
6
|
+
export declare function isRequestHostAllowed(headers: IncomingHttpHeaders, allowedHosts: readonly string[]): boolean;
|
|
7
|
+
/** Check a Host header against local hosts, IP addresses, and additional hosts. */ export declare function isHostAllowed(hostHeader: string | undefined, allowedHosts: readonly string[]): boolean;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -345,6 +345,13 @@ export interface ServerConfig {
|
|
|
345
345
|
* @default 'localhost'
|
|
346
346
|
*/ host?: string | boolean;
|
|
347
347
|
/**
|
|
348
|
+
* Hostnames allowed to access the dev or preview server.
|
|
349
|
+
* `true` disables Host validation.
|
|
350
|
+
* Localhost, IP addresses, and `server.host` are always allowed.
|
|
351
|
+
* A leading dot allows a hostname and all its subdomains.
|
|
352
|
+
* @default true
|
|
353
|
+
*/ allowedHosts?: string[] | true;
|
|
354
|
+
/**
|
|
348
355
|
* Adds headers to all responses.
|
|
349
356
|
*/ headers?: Record<string, string | string[]>;
|
|
350
357
|
/**
|
|
@@ -402,7 +409,7 @@ export interface ServerConfig {
|
|
|
402
409
|
* such as registering custom middleware or running pre-start tasks.
|
|
403
410
|
*
|
|
404
411
|
* When `server.setup` is called, Rsbuild built-in middlewares are not registered yet,
|
|
405
|
-
* so middlewares you add run earlier than built-ins.
|
|
412
|
+
* so middlewares you add run earlier than built-ins, except Host validation.
|
|
406
413
|
*
|
|
407
414
|
* `server.setup` can return a callback function. After built-in middlewares are registered,
|
|
408
415
|
* Rsbuild will execute that callback. Middlewares registered in the callback run later than built-ins.
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "2.2.13",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
19
|
"default": "./dist/index.js"
|
|
20
20
|
},
|
|
21
|
+
"./jiti": {
|
|
22
|
+
"types": "./compiled/jiti/lib/jiti.d.mts",
|
|
23
|
+
"default": "./compiled/jiti/lib/jiti.mjs"
|
|
24
|
+
},
|
|
21
25
|
"./types": {
|
|
22
26
|
"types": "./types.d.ts"
|
|
23
27
|
},
|
|
@@ -35,21 +39,21 @@
|
|
|
35
39
|
"types.d.ts"
|
|
36
40
|
],
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@rspack/core": "~2.2.
|
|
42
|
+
"@rspack/core": "~2.2.9",
|
|
39
43
|
"@swc/helpers": "^0.5.23"
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
42
46
|
"@jridgewell/remapping": "^2.3.5",
|
|
43
47
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
44
|
-
"@jsonjoy.com/fs-core": "4.
|
|
48
|
+
"@jsonjoy.com/fs-core": "4.80.0",
|
|
45
49
|
"@rstackjs/load-config": "^1.0.1",
|
|
46
50
|
"@types/cors": "^2.8.19",
|
|
47
|
-
"@types/node": "^24.
|
|
51
|
+
"@types/node": "^24.19.2",
|
|
48
52
|
"@types/on-finished": "2.3.5",
|
|
49
53
|
"@types/range-parser": "^1.2.7",
|
|
50
|
-
"@types/ws": "^8.18.
|
|
54
|
+
"@types/ws": "^8.18.2",
|
|
51
55
|
"browserslist-load-config": "^1.0.3",
|
|
52
|
-
"cac": "^7.0.
|
|
56
|
+
"cac": "^7.0.1",
|
|
53
57
|
"chokidar": "^5.0.0",
|
|
54
58
|
"connect-next": "5.0.0",
|
|
55
59
|
"core-js": "^3.50.0",
|
|
@@ -61,12 +65,12 @@
|
|
|
61
65
|
"html-rspack-plugin": "6.1.11",
|
|
62
66
|
"http-proxy-middleware": "4.2.0",
|
|
63
67
|
"jiti": "^2.7.0",
|
|
64
|
-
"launch-editor-middleware": "^2.14.
|
|
65
|
-
"memfs": "4.
|
|
68
|
+
"launch-editor-middleware": "^2.14.2",
|
|
69
|
+
"memfs": "4.80.0",
|
|
66
70
|
"mrmime": "^2.0.1",
|
|
67
71
|
"on-finished": "2.4.1",
|
|
68
72
|
"open": "^11.0.4",
|
|
69
|
-
"postcss": "^8.5.
|
|
73
|
+
"postcss": "^8.5.29",
|
|
70
74
|
"postcss-load-config": "6.0.1",
|
|
71
75
|
"postcss-loader": "8.2.1",
|
|
72
76
|
"prebundle": "1.6.5",
|