@rspack/browser 2.0.0-alpha.0 → 2.0.0-beta.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/Compiler.d.ts +1 -0
- package/dist/builtin-loader/swc/types.d.ts +4 -0
- package/dist/builtin-plugin/index.d.ts +1 -0
- package/dist/builtin-plugin/rsc/Coordinator.d.ts +8 -0
- package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +13 -0
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +14 -0
- package/dist/builtin-plugin/rsc/index.d.ts +24 -0
- package/dist/config/normalization.d.ts +1 -2
- package/dist/config/types.d.ts +84 -42
- package/dist/exports.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +231 -157
- package/dist/napi-binding.d.ts +26 -8
- package/dist/rspack.wasi-browser.js +1 -0
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/package.json +1 -1
package/dist/Compiler.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export type CompilerHooks = {
|
|
|
79
79
|
entryOption: liteTapable.SyncBailHook<[string, EntryNormalized], any>;
|
|
80
80
|
additionalPass: liteTapable.AsyncSeriesHook<[]>;
|
|
81
81
|
};
|
|
82
|
+
export declare const GET_COMPILER_ID: unique symbol;
|
|
82
83
|
declare class Compiler {
|
|
83
84
|
#private;
|
|
84
85
|
hooks: CompilerHooks;
|
|
@@ -21,6 +21,10 @@ export type SwcLoaderOptions = Config & {
|
|
|
21
21
|
*/
|
|
22
22
|
rspackExperiments?: {
|
|
23
23
|
import?: PluginImportOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Enable React Server Components support.
|
|
26
|
+
*/
|
|
27
|
+
reactServerComponents?: boolean;
|
|
24
28
|
};
|
|
25
29
|
};
|
|
26
30
|
export interface TerserCompressOptions {
|
|
@@ -73,6 +73,7 @@ export * from './RslibPlugin';
|
|
|
73
73
|
export * from './RstestPlugin';
|
|
74
74
|
export * from './RuntimeChunkPlugin';
|
|
75
75
|
export * from './RuntimePlugin';
|
|
76
|
+
export { rsc } from './rsc';
|
|
76
77
|
export * from './SideEffectsFlagPlugin';
|
|
77
78
|
export * from './SizeLimitsPlugin';
|
|
78
79
|
export * from './SourceMapDevToolPlugin';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Compiler } from '../../Compiler';
|
|
2
|
+
export declare const GET_OR_INIT_BINDING: unique symbol;
|
|
3
|
+
export declare class Coordinator {
|
|
4
|
+
#private;
|
|
5
|
+
constructor();
|
|
6
|
+
applyServerCompiler(serverCompiler: Compiler): void;
|
|
7
|
+
applyClientCompiler(clientCompiler: Compiler): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type binding from '../../binding';
|
|
2
|
+
import type { Compiler } from '../..';
|
|
3
|
+
import { RspackBuiltinPlugin } from '../base';
|
|
4
|
+
import { type Coordinator } from './Coordinator';
|
|
5
|
+
export type RscClientPluginOptions = {
|
|
6
|
+
coordinator: Coordinator;
|
|
7
|
+
};
|
|
8
|
+
export declare class RscClientPlugin extends RspackBuiltinPlugin {
|
|
9
|
+
#private;
|
|
10
|
+
name: string;
|
|
11
|
+
constructor(options: RscClientPluginOptions);
|
|
12
|
+
raw(compiler: Compiler): binding.BuiltinPlugin;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type binding from '../../binding';
|
|
2
|
+
import type { Compiler } from '../..';
|
|
3
|
+
import { RspackBuiltinPlugin } from '../base';
|
|
4
|
+
import { type Coordinator } from './Coordinator';
|
|
5
|
+
export type RscServerPluginOptions = {
|
|
6
|
+
coordinator: Coordinator;
|
|
7
|
+
onServerComponentChanges?: () => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare class RscServerPlugin extends RspackBuiltinPlugin {
|
|
10
|
+
#private;
|
|
11
|
+
name: string;
|
|
12
|
+
constructor(options: RscServerPluginOptions);
|
|
13
|
+
raw(compiler: Compiler): binding.BuiltinPlugin;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RscClientPlugin, type RscClientPluginOptions } from './RscClientPlugin';
|
|
2
|
+
import { RscServerPlugin } from './RscServerPlugin';
|
|
3
|
+
declare class ServerPlugin extends RscServerPlugin {
|
|
4
|
+
constructor(options?: Omit<RscClientPluginOptions, 'coordinator'>);
|
|
5
|
+
}
|
|
6
|
+
declare class ClientPlugin extends RscClientPlugin {
|
|
7
|
+
}
|
|
8
|
+
export declare const rsc: {
|
|
9
|
+
createPlugins: () => {
|
|
10
|
+
ServerPlugin: new (options?: Omit<RscClientPluginOptions, "coordinator">) => ServerPlugin;
|
|
11
|
+
ClientPlugin: new () => ClientPlugin;
|
|
12
|
+
};
|
|
13
|
+
Layers: {
|
|
14
|
+
/**
|
|
15
|
+
* The layer for server-only runtime and picking up `react-server` export conditions.
|
|
16
|
+
*/
|
|
17
|
+
readonly rsc: "react-server-components";
|
|
18
|
+
/**
|
|
19
|
+
* Server Side Rendering layer for app.
|
|
20
|
+
*/
|
|
21
|
+
readonly ssr: "server-side-rendering";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -76,7 +76,6 @@ export interface ModuleOptionsNormalized {
|
|
|
76
76
|
parser: ParserOptionsByModuleType;
|
|
77
77
|
generator: GeneratorOptionsByModuleType;
|
|
78
78
|
noParse?: NoParseOption;
|
|
79
|
-
unsafeCache?: boolean | RegExp;
|
|
80
79
|
}
|
|
81
80
|
export type CacheNormalized = boolean | {
|
|
82
81
|
type: 'memory';
|
|
@@ -93,10 +92,10 @@ export type CacheNormalized = boolean | {
|
|
|
93
92
|
type: 'filesystem';
|
|
94
93
|
directory: string;
|
|
95
94
|
};
|
|
95
|
+
portable?: boolean;
|
|
96
96
|
};
|
|
97
97
|
export interface ExperimentsNormalized {
|
|
98
98
|
asyncWebAssembly?: boolean;
|
|
99
|
-
outputModule?: boolean;
|
|
100
99
|
css?: boolean;
|
|
101
100
|
futureDefaults?: boolean;
|
|
102
101
|
buildHttp?: HttpUriPluginOptions;
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1044,10 +1044,6 @@ export type ModuleOptions = {
|
|
|
1044
1044
|
generator?: GeneratorOptionsByModuleType;
|
|
1045
1045
|
/** Keep module mechanism of the matched modules as-is, such as module.exports, require, import. */
|
|
1046
1046
|
noParse?: NoParseOption;
|
|
1047
|
-
/**
|
|
1048
|
-
* Cache the resolving of module requests.
|
|
1049
|
-
*/
|
|
1050
|
-
unsafeCache?: boolean | RegExp;
|
|
1051
1047
|
};
|
|
1052
1048
|
type AllowTarget = 'web' | 'webworker' | 'es3' | 'es5' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'es2023' | 'es2024' | 'es2025' | 'node' | 'async-node' | `node${number}` | `async-node${number}` | `node${number}.${number}` | `async-node${number}.${number}` | 'electron-main' | `electron${number}-main` | `electron${number}.${number}-main` | 'electron-renderer' | `electron${number}-renderer` | `electron${number}.${number}-renderer` | 'electron-preload' | `electron${number}-preload` | `electron${number}.${number}-preload` | 'nwjs' | `nwjs${number}` | `nwjs${number}.${number}` | 'node-webkit' | `node-webkit${number}` | `node-webkit${number}.${number}` | 'browserslist' | `browserslist:${string}`;
|
|
1053
1049
|
/** Used to configure the target environment of Rspack output and the ECMAScript version of Rspack runtime code. */
|
|
@@ -1239,6 +1235,80 @@ export type NodeOptions = {
|
|
|
1239
1235
|
export type Node = false | NodeOptions;
|
|
1240
1236
|
export type Loader = Record<string, any>;
|
|
1241
1237
|
export type SnapshotOptions = {};
|
|
1238
|
+
/**
|
|
1239
|
+
* Snapshot options for determining which files have been modified.
|
|
1240
|
+
*/
|
|
1241
|
+
export type CacheSnapshotOptions = {
|
|
1242
|
+
/**
|
|
1243
|
+
* An array of paths to immutable files, changes to these paths will be ignored during hot restart.
|
|
1244
|
+
*/
|
|
1245
|
+
immutablePaths?: (string | RegExp)[];
|
|
1246
|
+
/**
|
|
1247
|
+
* An array of paths in managedPaths that are not managed by the package manager.
|
|
1248
|
+
*/
|
|
1249
|
+
unmanagedPaths?: (string | RegExp)[];
|
|
1250
|
+
/**
|
|
1251
|
+
* An array of paths managed by the package manager.
|
|
1252
|
+
* @default [/[\\/]node_modules[\\/][^.]/]
|
|
1253
|
+
*/
|
|
1254
|
+
managedPaths?: (string | RegExp)[];
|
|
1255
|
+
};
|
|
1256
|
+
/**
|
|
1257
|
+
* Storage options for persistent cache.
|
|
1258
|
+
*/
|
|
1259
|
+
export type CacheStorageOptions = {
|
|
1260
|
+
/**
|
|
1261
|
+
* Storage type, currently only supports 'filesystem'.
|
|
1262
|
+
*/
|
|
1263
|
+
type: 'filesystem';
|
|
1264
|
+
/**
|
|
1265
|
+
* Cache directory path.
|
|
1266
|
+
* @default 'node_modules/.cache/rspack'
|
|
1267
|
+
*/
|
|
1268
|
+
directory?: string;
|
|
1269
|
+
};
|
|
1270
|
+
/**
|
|
1271
|
+
* Persistent cache options.
|
|
1272
|
+
*/
|
|
1273
|
+
export type PersistentCacheOptions = {
|
|
1274
|
+
/**
|
|
1275
|
+
* Cache type.
|
|
1276
|
+
*/
|
|
1277
|
+
type: 'persistent';
|
|
1278
|
+
/**
|
|
1279
|
+
* An array of files containing build dependencies, Rspack will use the hash of each of these files to invalidate the persistent cache.
|
|
1280
|
+
* @default []
|
|
1281
|
+
*/
|
|
1282
|
+
buildDependencies?: string[];
|
|
1283
|
+
/**
|
|
1284
|
+
* Cache version, different versions of caches are isolated from each other.
|
|
1285
|
+
* @default ""
|
|
1286
|
+
*/
|
|
1287
|
+
version?: string;
|
|
1288
|
+
/**
|
|
1289
|
+
* Snapshot options for determining which files have been modified.
|
|
1290
|
+
*/
|
|
1291
|
+
snapshot?: CacheSnapshotOptions;
|
|
1292
|
+
/**
|
|
1293
|
+
* Storage options for cache.
|
|
1294
|
+
*/
|
|
1295
|
+
storage?: CacheStorageOptions;
|
|
1296
|
+
/**
|
|
1297
|
+
* Enable portable cache mode. When enabled, the generated cache content can be shared across different platforms and paths within the same project.
|
|
1298
|
+
* @description Portable cache makes the cache platform-independent by converting platform-specific data (e.g., absolute paths to relative paths) during serialization and deserialization.
|
|
1299
|
+
* @default false
|
|
1300
|
+
*/
|
|
1301
|
+
portable?: boolean;
|
|
1302
|
+
};
|
|
1303
|
+
/**
|
|
1304
|
+
* Memory cache options.
|
|
1305
|
+
*/
|
|
1306
|
+
export type MemoryCacheOptions = {
|
|
1307
|
+
/**
|
|
1308
|
+
* Cache type.
|
|
1309
|
+
*/
|
|
1310
|
+
type: 'memory';
|
|
1311
|
+
};
|
|
1242
1312
|
/**
|
|
1243
1313
|
* Options for caching snapshots and intermediate products during the build process.
|
|
1244
1314
|
* @description Controls whether caching is enabled or disabled.
|
|
@@ -1250,22 +1320,7 @@ export type SnapshotOptions = {};
|
|
|
1250
1320
|
* // Disable caching
|
|
1251
1321
|
* cache: false
|
|
1252
1322
|
*/
|
|
1253
|
-
export type CacheOptions = boolean |
|
|
1254
|
-
type: 'memory';
|
|
1255
|
-
} | {
|
|
1256
|
-
type: 'persistent';
|
|
1257
|
-
buildDependencies?: string[];
|
|
1258
|
-
version?: string;
|
|
1259
|
-
snapshot?: {
|
|
1260
|
-
immutablePaths?: (string | RegExp)[];
|
|
1261
|
-
unmanagedPaths?: (string | RegExp)[];
|
|
1262
|
-
managedPaths?: (string | RegExp)[];
|
|
1263
|
-
};
|
|
1264
|
-
storage?: {
|
|
1265
|
-
type: 'filesystem';
|
|
1266
|
-
directory?: string;
|
|
1267
|
-
};
|
|
1268
|
-
};
|
|
1323
|
+
export type CacheOptions = boolean | MemoryCacheOptions | PersistentCacheOptions;
|
|
1269
1324
|
export type StatsPresets = 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings' | 'minimal' | 'detailed' | 'summary';
|
|
1270
1325
|
type ModuleFilterItemTypes = RegExp | string | ((name: string, module: any, type: any) => boolean);
|
|
1271
1326
|
type ModuleFilterTypes = boolean | ModuleFilterItemTypes | ModuleFilterItemTypes[];
|
|
@@ -1989,25 +2044,17 @@ export type Incremental = {
|
|
|
1989
2044
|
*/
|
|
1990
2045
|
silent?: boolean;
|
|
1991
2046
|
/**
|
|
1992
|
-
* Enable incremental
|
|
2047
|
+
* Enable incremental build module graph.
|
|
1993
2048
|
*/
|
|
1994
|
-
|
|
2049
|
+
buildModuleGraph?: boolean;
|
|
1995
2050
|
/**
|
|
1996
|
-
* Enable
|
|
2051
|
+
* Enable incremental finish modules.
|
|
1997
2052
|
*/
|
|
1998
|
-
|
|
2053
|
+
finishModules?: boolean;
|
|
1999
2054
|
/**
|
|
2000
|
-
* Enable incremental
|
|
2055
|
+
* Enable incremental optimize dependencies.
|
|
2001
2056
|
*/
|
|
2002
|
-
|
|
2003
|
-
/**
|
|
2004
|
-
* Enables diagnostics for dependencies.
|
|
2005
|
-
*/
|
|
2006
|
-
dependenciesDiagnostics?: boolean;
|
|
2007
|
-
/**
|
|
2008
|
-
* Enables incremental side effects optimization.
|
|
2009
|
-
*/
|
|
2010
|
-
sideEffects?: boolean;
|
|
2057
|
+
optimizeDependencies?: boolean;
|
|
2011
2058
|
/**
|
|
2012
2059
|
* Enable incremental build chunk graph.
|
|
2013
2060
|
*/
|
|
@@ -2041,11 +2088,11 @@ export type Incremental = {
|
|
|
2041
2088
|
*/
|
|
2042
2089
|
chunksHashes?: boolean;
|
|
2043
2090
|
/**
|
|
2044
|
-
* Enable incremental chunk
|
|
2091
|
+
* Enable incremental chunk asset.
|
|
2045
2092
|
*/
|
|
2046
|
-
|
|
2093
|
+
chunkAsset?: boolean;
|
|
2047
2094
|
/**
|
|
2048
|
-
* Enable incremental
|
|
2095
|
+
* Enable incremental emit assets.
|
|
2049
2096
|
*/
|
|
2050
2097
|
emitAssets?: boolean;
|
|
2051
2098
|
};
|
|
@@ -2071,11 +2118,6 @@ export type Experiments = {
|
|
|
2071
2118
|
* @default false
|
|
2072
2119
|
*/
|
|
2073
2120
|
asyncWebAssembly?: boolean;
|
|
2074
|
-
/**
|
|
2075
|
-
* Enable output as ES module.
|
|
2076
|
-
* @default false
|
|
2077
|
-
*/
|
|
2078
|
-
outputModule?: boolean;
|
|
2079
2121
|
/**
|
|
2080
2122
|
* Enable CSS support.
|
|
2081
2123
|
*
|
package/dist/exports.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export { EnvironmentPlugin } from './lib/EnvironmentPlugin';
|
|
|
55
55
|
export { LoaderOptionsPlugin } from './lib/LoaderOptionsPlugin';
|
|
56
56
|
export { LoaderTargetPlugin } from './lib/LoaderTargetPlugin';
|
|
57
57
|
export type { OutputFileSystem, WatchFileSystem } from './util/fs';
|
|
58
|
-
import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, SubresourceIntegrityPlugin } from './builtin-plugin';
|
|
58
|
+
import { FetchCompileAsyncWasmPlugin, lazyCompilationMiddleware, rsc, SubresourceIntegrityPlugin } from './builtin-plugin';
|
|
59
59
|
export { SubresourceIntegrityPlugin };
|
|
60
60
|
interface Web {
|
|
61
61
|
FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;
|
|
@@ -161,5 +161,6 @@ interface Experiments {
|
|
|
161
161
|
CssChunkingPlugin: typeof CssChunkingPlugin;
|
|
162
162
|
createNativePlugin: typeof createNativePlugin;
|
|
163
163
|
VirtualModulesPlugin: typeof VirtualModulesPlugin;
|
|
164
|
+
rsc: typeof rsc;
|
|
164
165
|
}
|
|
165
166
|
export declare const experiments: Experiments;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16681,92 +16681,6 @@ __webpack_require__.add({
|
|
|
16681
16681
|
return hasSymbols() && !!Symbol.toStringTag;
|
|
16682
16682
|
};
|
|
16683
16683
|
},
|
|
16684
|
-
"../../node_modules/.pnpm/hash-base@3.0.5/node_modules/hash-base/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
16685
|
-
var Buffer = __webpack_require__("../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js").Buffer;
|
|
16686
|
-
var Transform = __webpack_require__("../../node_modules/.pnpm/stream-browserify@3.0.0/node_modules/stream-browserify/index.js").Transform;
|
|
16687
|
-
var inherits = __webpack_require__("../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js");
|
|
16688
|
-
function HashBase(blockSize) {
|
|
16689
|
-
Transform.call(this);
|
|
16690
|
-
this._block = Buffer.allocUnsafe(blockSize);
|
|
16691
|
-
this._blockSize = blockSize;
|
|
16692
|
-
this._blockOffset = 0;
|
|
16693
|
-
this._length = [
|
|
16694
|
-
0,
|
|
16695
|
-
0,
|
|
16696
|
-
0,
|
|
16697
|
-
0
|
|
16698
|
-
];
|
|
16699
|
-
this._finalized = false;
|
|
16700
|
-
}
|
|
16701
|
-
inherits(HashBase, Transform);
|
|
16702
|
-
HashBase.prototype._transform = function(chunk, encoding, callback) {
|
|
16703
|
-
var error = null;
|
|
16704
|
-
try {
|
|
16705
|
-
this.update(chunk, encoding);
|
|
16706
|
-
} catch (err) {
|
|
16707
|
-
error = err;
|
|
16708
|
-
}
|
|
16709
|
-
callback(error);
|
|
16710
|
-
};
|
|
16711
|
-
HashBase.prototype._flush = function(callback) {
|
|
16712
|
-
var error = null;
|
|
16713
|
-
try {
|
|
16714
|
-
this.push(this.digest());
|
|
16715
|
-
} catch (err) {
|
|
16716
|
-
error = err;
|
|
16717
|
-
}
|
|
16718
|
-
callback(error);
|
|
16719
|
-
};
|
|
16720
|
-
var useUint8Array = "u" > typeof Uint8Array;
|
|
16721
|
-
var useArrayBuffer = "u" > typeof ArrayBuffer && "u" > typeof Uint8Array && ArrayBuffer.isView && (Buffer.prototype instanceof Uint8Array || Buffer.TYPED_ARRAY_SUPPORT);
|
|
16722
|
-
function toBuffer(data, encoding) {
|
|
16723
|
-
if (data instanceof Buffer) return data;
|
|
16724
|
-
if ('string' == typeof data) return Buffer.from(data, encoding);
|
|
16725
|
-
if (useArrayBuffer && ArrayBuffer.isView(data)) {
|
|
16726
|
-
if (0 === data.byteLength) return Buffer.alloc(0);
|
|
16727
|
-
var res = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
16728
|
-
if (res.byteLength === data.byteLength) return res;
|
|
16729
|
-
}
|
|
16730
|
-
if (useUint8Array && data instanceof Uint8Array) return Buffer.from(data);
|
|
16731
|
-
if (Buffer.isBuffer(data) && data.constructor && 'function' == typeof data.constructor.isBuffer && data.constructor.isBuffer(data)) return Buffer.from(data);
|
|
16732
|
-
throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.');
|
|
16733
|
-
}
|
|
16734
|
-
HashBase.prototype.update = function(data, encoding) {
|
|
16735
|
-
if (this._finalized) throw new Error('Digest already called');
|
|
16736
|
-
data = toBuffer(data, encoding);
|
|
16737
|
-
var block = this._block;
|
|
16738
|
-
var offset = 0;
|
|
16739
|
-
while(this._blockOffset + data.length - offset >= this._blockSize){
|
|
16740
|
-
for(var i = this._blockOffset; i < this._blockSize;)block[i++] = data[offset++];
|
|
16741
|
-
this._update();
|
|
16742
|
-
this._blockOffset = 0;
|
|
16743
|
-
}
|
|
16744
|
-
while(offset < data.length)block[this._blockOffset++] = data[offset++];
|
|
16745
|
-
for(var j = 0, carry = 8 * data.length; carry > 0; ++j){
|
|
16746
|
-
this._length[j] += carry;
|
|
16747
|
-
carry = this._length[j] / 0x0100000000 | 0;
|
|
16748
|
-
if (carry > 0) this._length[j] -= 0x0100000000 * carry;
|
|
16749
|
-
}
|
|
16750
|
-
return this;
|
|
16751
|
-
};
|
|
16752
|
-
HashBase.prototype._update = function() {
|
|
16753
|
-
throw new Error('_update is not implemented');
|
|
16754
|
-
};
|
|
16755
|
-
HashBase.prototype.digest = function(encoding) {
|
|
16756
|
-
if (this._finalized) throw new Error('Digest already called');
|
|
16757
|
-
this._finalized = true;
|
|
16758
|
-
var digest = this._digest();
|
|
16759
|
-
if (void 0 !== encoding) digest = digest.toString(encoding);
|
|
16760
|
-
this._block.fill(0);
|
|
16761
|
-
this._blockOffset = 0;
|
|
16762
|
-
for(var i = 0; i < 4; ++i)this._length[i] = 0;
|
|
16763
|
-
return digest;
|
|
16764
|
-
};
|
|
16765
|
-
HashBase.prototype._digest = function() {
|
|
16766
|
-
throw new Error('_digest is not implemented');
|
|
16767
|
-
};
|
|
16768
|
-
module.exports = HashBase;
|
|
16769
|
-
},
|
|
16770
16684
|
"../../node_modules/.pnpm/hash-base@3.1.2/node_modules/hash-base/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
16771
16685
|
var Buffer = __webpack_require__("../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js").Buffer;
|
|
16772
16686
|
var toBuffer = __webpack_require__("../../node_modules/.pnpm/hash-base@3.1.2/node_modules/hash-base/to-buffer.js");
|
|
@@ -18680,7 +18594,7 @@ __webpack_require__.add({
|
|
|
18680
18594
|
},
|
|
18681
18595
|
"../../node_modules/.pnpm/md5.js@1.3.5/node_modules/md5.js/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
18682
18596
|
var inherits = __webpack_require__("../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js");
|
|
18683
|
-
var HashBase = __webpack_require__("../../node_modules/.pnpm/hash-base@3.
|
|
18597
|
+
var HashBase = __webpack_require__("../../node_modules/.pnpm/hash-base@3.1.2/node_modules/hash-base/index.js");
|
|
18684
18598
|
var Buffer = __webpack_require__("../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js").Buffer;
|
|
18685
18599
|
var ARRAY16 = new Array(16);
|
|
18686
18600
|
function MD5() {
|
|
@@ -50754,6 +50668,17 @@ class Stats {
|
|
|
50754
50668
|
compilation: this.compilation,
|
|
50755
50669
|
getStatsCompilation: (compilation)=>{
|
|
50756
50670
|
if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
|
|
50671
|
+
if (this.compilation !== this.compilation.compiler._lastCompilation) return {
|
|
50672
|
+
assets: [],
|
|
50673
|
+
assetsByChunkName: [],
|
|
50674
|
+
chunks: [],
|
|
50675
|
+
entrypoints: [],
|
|
50676
|
+
errors: [],
|
|
50677
|
+
hash: 'XXXX',
|
|
50678
|
+
modules: [],
|
|
50679
|
+
namedChunkGroups: [],
|
|
50680
|
+
warnings: []
|
|
50681
|
+
};
|
|
50757
50682
|
const innerStats = this.#getInnerByCompilation(compilation);
|
|
50758
50683
|
options.warnings = false;
|
|
50759
50684
|
const innerStatsCompilation = innerStats.toJson(options);
|
|
@@ -50775,6 +50700,17 @@ class Stats {
|
|
|
50775
50700
|
compilation: this.compilation,
|
|
50776
50701
|
getStatsCompilation: (compilation)=>{
|
|
50777
50702
|
if (statsCompilationMap.has(compilation)) return statsCompilationMap.get(compilation);
|
|
50703
|
+
if (this.compilation !== this.compilation.compiler._lastCompilation) return {
|
|
50704
|
+
assets: [],
|
|
50705
|
+
assetsByChunkName: [],
|
|
50706
|
+
chunks: [],
|
|
50707
|
+
entrypoints: [],
|
|
50708
|
+
errors: [],
|
|
50709
|
+
hash: 'XXXX',
|
|
50710
|
+
modules: [],
|
|
50711
|
+
namedChunkGroups: [],
|
|
50712
|
+
warnings: []
|
|
50713
|
+
};
|
|
50778
50714
|
const innerStats = this.#getInnerByCompilation(compilation);
|
|
50779
50715
|
const innerStatsCompilation = innerStats.toJson(options);
|
|
50780
50716
|
statsCompilationMap.set(compilation, innerStatsCompilation);
|
|
@@ -51857,6 +51793,17 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
51857
51793
|
afterSeal: new AsyncSeriesHook([]),
|
|
51858
51794
|
needAdditionalPass: new SyncBailHook([])
|
|
51859
51795
|
};
|
|
51796
|
+
const availableHooks = Object.keys(this.hooks);
|
|
51797
|
+
this.hooks = new Proxy(this.hooks, {
|
|
51798
|
+
get (target, prop, receiver) {
|
|
51799
|
+
const value = Reflect.get(target, prop, receiver);
|
|
51800
|
+
if (void 0 === value && 'string' == typeof prop) {
|
|
51801
|
+
const hooksList = availableHooks.join(', ');
|
|
51802
|
+
throw new Error(`Compilation.hooks.${prop} is not supported in rspack. This typically happens when using webpack plugins that rely on webpack-specific hooks. Consider using an rspack-compatible alternative or removing the incompatible plugin.\n\nAvailable compilation hooks: ${hooksList}`);
|
|
51803
|
+
}
|
|
51804
|
+
return value;
|
|
51805
|
+
}
|
|
51806
|
+
});
|
|
51860
51807
|
this.compiler = compiler;
|
|
51861
51808
|
this.resolverFactory = compiler.resolverFactory;
|
|
51862
51809
|
this.inputFileSystem = compiler.inputFileSystem;
|
|
@@ -52803,7 +52750,6 @@ function applyLimits(options) {
|
|
|
52803
52750
|
options.optimization.concatenateModules = false;
|
|
52804
52751
|
options.optimization.removeEmptyChunks = false;
|
|
52805
52752
|
options.output.chunkFormat = false;
|
|
52806
|
-
options.output.module = true;
|
|
52807
52753
|
if (options.output.chunkLoading && 'import' !== options.output.chunkLoading) options.output.chunkLoading = 'import';
|
|
52808
52754
|
if (void 0 === options.output.chunkLoading) options.output.chunkLoading = 'import';
|
|
52809
52755
|
let { splitChunks } = options.optimization;
|
|
@@ -54893,8 +54839,7 @@ function getRawModule(module, options) {
|
|
|
54893
54839
|
rules,
|
|
54894
54840
|
parser: getRawParserOptionsMap(module.parser),
|
|
54895
54841
|
generator: getRawGeneratorOptionsMap(module.generator),
|
|
54896
|
-
noParse: module.noParse
|
|
54897
|
-
unsafeCache: module.unsafeCache
|
|
54842
|
+
noParse: module.noParse
|
|
54898
54843
|
};
|
|
54899
54844
|
}
|
|
54900
54845
|
function tryMatch(payload, condition) {
|
|
@@ -55882,6 +55827,110 @@ const createRuntimePluginHooksRegisters = (getCompiler, createTap)=>({
|
|
|
55882
55827
|
};
|
|
55883
55828
|
})
|
|
55884
55829
|
});
|
|
55830
|
+
const Coordinator_PLUGIN_NAME = 'RscPlugin';
|
|
55831
|
+
const GET_OR_INIT_BINDING = Symbol('GET_OR_INIT_BINDING');
|
|
55832
|
+
class Coordinator {
|
|
55833
|
+
#serverCompiler;
|
|
55834
|
+
#clientCompiler;
|
|
55835
|
+
#clientLastCompilation;
|
|
55836
|
+
#isProxyingClientWatching = false;
|
|
55837
|
+
#binding;
|
|
55838
|
+
constructor(){
|
|
55839
|
+
Object.defineProperty(this, GET_OR_INIT_BINDING, {
|
|
55840
|
+
enumerable: false,
|
|
55841
|
+
configurable: false,
|
|
55842
|
+
writable: false,
|
|
55843
|
+
value: ()=>{
|
|
55844
|
+
if (!this.#binding) this.#binding = new external_rspack_wasi_browser_js_.JsCoordinator(()=>{
|
|
55845
|
+
if (!this.#serverCompiler) throw new Error("[RscPlugin] Coordinator.getOrInitBinding() called before the server compiler was attached. Call coordinator.applyServerCompiler(serverCompiler) first.");
|
|
55846
|
+
return this.#serverCompiler[GET_COMPILER_ID]();
|
|
55847
|
+
});
|
|
55848
|
+
return this.#binding;
|
|
55849
|
+
}
|
|
55850
|
+
});
|
|
55851
|
+
}
|
|
55852
|
+
applyServerCompiler(serverCompiler) {
|
|
55853
|
+
this.#serverCompiler = serverCompiler;
|
|
55854
|
+
serverCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
|
|
55855
|
+
this.#isProxyingClientWatching = true;
|
|
55856
|
+
if (this.#clientLastCompilation) {
|
|
55857
|
+
stats.compilation.fileDependencies.addAll(this.#clientLastCompilation.fileDependencies);
|
|
55858
|
+
stats.compilation.contextDependencies.addAll(this.#clientLastCompilation.contextDependencies);
|
|
55859
|
+
stats.compilation.missingDependencies.addAll(this.#clientLastCompilation.missingDependencies);
|
|
55860
|
+
}
|
|
55861
|
+
});
|
|
55862
|
+
serverCompiler.hooks.watchRun.tap(Coordinator_PLUGIN_NAME, ()=>{
|
|
55863
|
+
if (!this.#isProxyingClientWatching) return;
|
|
55864
|
+
this.#clientCompiler.watching.invalidateWithChangesAndRemovals(new Set(this.#serverCompiler.modifiedFiles), new Set(this.#serverCompiler.removedFiles));
|
|
55865
|
+
});
|
|
55866
|
+
}
|
|
55867
|
+
applyClientCompiler(clientCompiler) {
|
|
55868
|
+
this.#clientCompiler = clientCompiler;
|
|
55869
|
+
const originalWatch = clientCompiler.watch;
|
|
55870
|
+
clientCompiler.watch = function(watchOptions, handler) {
|
|
55871
|
+
watchOptions.ignored = ()=>true;
|
|
55872
|
+
return originalWatch.call(this, watchOptions, handler);
|
|
55873
|
+
};
|
|
55874
|
+
clientCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
|
|
55875
|
+
this.#clientLastCompilation = stats.compilation;
|
|
55876
|
+
});
|
|
55877
|
+
}
|
|
55878
|
+
}
|
|
55879
|
+
class RscClientPlugin extends RspackBuiltinPlugin {
|
|
55880
|
+
name = 'RscClientPlugin';
|
|
55881
|
+
#options;
|
|
55882
|
+
constructor(options){
|
|
55883
|
+
super();
|
|
55884
|
+
this.#options = options;
|
|
55885
|
+
}
|
|
55886
|
+
raw(compiler) {
|
|
55887
|
+
this.#options.coordinator.applyClientCompiler(compiler);
|
|
55888
|
+
return createBuiltinPlugin(this.name, {
|
|
55889
|
+
coordinator: this.#options.coordinator[GET_OR_INIT_BINDING]()
|
|
55890
|
+
});
|
|
55891
|
+
}
|
|
55892
|
+
}
|
|
55893
|
+
class RscServerPlugin extends RspackBuiltinPlugin {
|
|
55894
|
+
name = 'RscServerPlugin';
|
|
55895
|
+
#options;
|
|
55896
|
+
constructor(options){
|
|
55897
|
+
super();
|
|
55898
|
+
this.#options = options;
|
|
55899
|
+
}
|
|
55900
|
+
raw(compiler) {
|
|
55901
|
+
this.#options.coordinator.applyServerCompiler(compiler);
|
|
55902
|
+
return createBuiltinPlugin(this.name, {
|
|
55903
|
+
coordinator: this.#options.coordinator[GET_OR_INIT_BINDING](),
|
|
55904
|
+
onServerComponentChanges: this.#options.onServerComponentChanges
|
|
55905
|
+
});
|
|
55906
|
+
}
|
|
55907
|
+
}
|
|
55908
|
+
const rsc = {
|
|
55909
|
+
createPlugins: ()=>{
|
|
55910
|
+
const coordinator = new Coordinator();
|
|
55911
|
+
return {
|
|
55912
|
+
ServerPlugin: class extends RscServerPlugin {
|
|
55913
|
+
constructor(options = {}){
|
|
55914
|
+
super({
|
|
55915
|
+
coordinator,
|
|
55916
|
+
...options
|
|
55917
|
+
});
|
|
55918
|
+
}
|
|
55919
|
+
},
|
|
55920
|
+
ClientPlugin: class extends RscClientPlugin {
|
|
55921
|
+
constructor(){
|
|
55922
|
+
super({
|
|
55923
|
+
coordinator
|
|
55924
|
+
});
|
|
55925
|
+
}
|
|
55926
|
+
}
|
|
55927
|
+
};
|
|
55928
|
+
},
|
|
55929
|
+
Layers: {
|
|
55930
|
+
rsc: 'react-server-components',
|
|
55931
|
+
ssr: 'server-side-rendering'
|
|
55932
|
+
}
|
|
55933
|
+
};
|
|
55885
55934
|
const SideEffectsFlagPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.SideEffectsFlagPlugin, ()=>{}, 'compilation');
|
|
55886
55935
|
const SizeLimitsPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.SizeLimitsPlugin, (options)=>{
|
|
55887
55936
|
const hints = false === options.hints ? void 0 : options.hints;
|
|
@@ -57550,7 +57599,6 @@ const applyRspackOptionsDefaults = (options)=>{
|
|
|
57550
57599
|
production
|
|
57551
57600
|
});
|
|
57552
57601
|
applyModuleDefaults(options.module, {
|
|
57553
|
-
cache: !!options.cache,
|
|
57554
57602
|
asyncWebAssembly: options.experiments.asyncWebAssembly,
|
|
57555
57603
|
targetProperties,
|
|
57556
57604
|
mode: options.mode,
|
|
@@ -57561,7 +57609,6 @@ const applyRspackOptionsDefaults = (options)=>{
|
|
|
57561
57609
|
context: options.context,
|
|
57562
57610
|
targetProperties,
|
|
57563
57611
|
isAffectedByBrowserslist: void 0 === target || 'string' == typeof target && target.startsWith('browserslist') || Array.isArray(target) && target.some((target)=>target.startsWith('browserslist')),
|
|
57564
|
-
outputModule: options.experiments.outputModule,
|
|
57565
57612
|
entry: options.entry
|
|
57566
57613
|
});
|
|
57567
57614
|
applyExternalsPresetsDefaults(options.externalsPresets, {
|
|
@@ -57625,12 +57672,10 @@ const applyIncrementalDefaults = (options)=>{
|
|
|
57625
57672
|
D(options, 'incremental', {});
|
|
57626
57673
|
if ('object' == typeof options.incremental) {
|
|
57627
57674
|
D(options.incremental, 'silent', true);
|
|
57628
|
-
D(options.incremental, '
|
|
57629
|
-
D(options.incremental, '
|
|
57630
|
-
D(options.incremental, '
|
|
57631
|
-
D(options.incremental, '
|
|
57632
|
-
D(options.incremental, 'sideEffects', true);
|
|
57633
|
-
D(options.incremental, 'buildChunkGraph', false);
|
|
57675
|
+
D(options.incremental, 'buildModuleGraph', true);
|
|
57676
|
+
D(options.incremental, 'finishModules', true);
|
|
57677
|
+
D(options.incremental, 'optimizeDependencies', true);
|
|
57678
|
+
D(options.incremental, 'buildChunkGraph', true);
|
|
57634
57679
|
D(options.incremental, 'moduleIds', true);
|
|
57635
57680
|
D(options.incremental, 'chunkIds', true);
|
|
57636
57681
|
D(options.incremental, 'modulesHashes', true);
|
|
@@ -57638,7 +57683,7 @@ const applyIncrementalDefaults = (options)=>{
|
|
|
57638
57683
|
D(options.incremental, 'modulesRuntimeRequirements', true);
|
|
57639
57684
|
D(options.incremental, 'chunksRuntimeRequirements', true);
|
|
57640
57685
|
D(options.incremental, 'chunksHashes', true);
|
|
57641
|
-
D(options.incremental, '
|
|
57686
|
+
D(options.incremental, 'chunkAsset', true);
|
|
57642
57687
|
D(options.incremental, 'emitAssets', true);
|
|
57643
57688
|
}
|
|
57644
57689
|
};
|
|
@@ -57674,10 +57719,9 @@ const applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties }
|
|
|
57674
57719
|
const applyJsonGeneratorOptionsDefaults = (generatorOptions)=>{
|
|
57675
57720
|
D(generatorOptions, 'JSONParse', true);
|
|
57676
57721
|
};
|
|
57677
|
-
const applyModuleDefaults = (module, {
|
|
57722
|
+
const applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
|
|
57678
57723
|
assertNotNill(module.parser);
|
|
57679
57724
|
assertNotNill(module.generator);
|
|
57680
|
-
cache ? D(module, 'unsafeCache', /[\\/]node_modules[\\/]/) : D(module, 'unsafeCache', false);
|
|
57681
57725
|
F(module.parser, "asset", ()=>({}));
|
|
57682
57726
|
assertNotNill(module.parser.asset);
|
|
57683
57727
|
F(module.parser.asset, 'dataUrlCondition', ()=>({}));
|
|
@@ -57837,7 +57881,7 @@ const applyModuleDefaults = (module, { cache, asyncWebAssembly, targetProperties
|
|
|
57837
57881
|
return rules;
|
|
57838
57882
|
});
|
|
57839
57883
|
};
|
|
57840
|
-
const applyOutputDefaults = (options, { context,
|
|
57884
|
+
const applyOutputDefaults = (options, { context, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
|
|
57841
57885
|
const { output } = options;
|
|
57842
57886
|
const getLibraryName = (library)=>{
|
|
57843
57887
|
const libraryName = 'object' == typeof library && library && !Array.isArray(library) ? library.name : library;
|
|
@@ -57866,7 +57910,24 @@ const applyOutputDefaults = (options, { context, outputModule, targetProperties:
|
|
|
57866
57910
|
}
|
|
57867
57911
|
});
|
|
57868
57912
|
F(output, 'devtoolNamespace', ()=>output.uniqueName);
|
|
57869
|
-
F(output, '
|
|
57913
|
+
if (output.library) F(output.library, 'type', ()=>output.module ? 'modern-module' : 'var');
|
|
57914
|
+
const forEachEntry = (fn)=>{
|
|
57915
|
+
if ('function' == typeof entry) return;
|
|
57916
|
+
for (const name of Object.keys(entry))fn(entry[name]);
|
|
57917
|
+
};
|
|
57918
|
+
A(output, 'enabledLibraryTypes', ()=>{
|
|
57919
|
+
const enabledLibraryTypes = [];
|
|
57920
|
+
if (output.library) enabledLibraryTypes.push(output.library.type);
|
|
57921
|
+
forEachEntry((desc)=>{
|
|
57922
|
+
if (desc.library) enabledLibraryTypes.push(desc.library.type);
|
|
57923
|
+
});
|
|
57924
|
+
if (enabledLibraryTypes.includes('modern-module')) applyLimits(options);
|
|
57925
|
+
return enabledLibraryTypes;
|
|
57926
|
+
});
|
|
57927
|
+
D(output, 'module', [
|
|
57928
|
+
'modern-module',
|
|
57929
|
+
'module'
|
|
57930
|
+
].some((ty)=>output.enabledLibraryTypes.includes(ty)));
|
|
57870
57931
|
const environment = output.environment;
|
|
57871
57932
|
const optimistic = (v)=>v || void 0 === v;
|
|
57872
57933
|
const conditionallyOptimistic = (v, c)=>void 0 === v && c || v;
|
|
@@ -57925,7 +57986,6 @@ const applyOutputDefaults = (options, { context, outputModule, targetProperties:
|
|
|
57925
57986
|
D(output, 'hashDigest', 'hex');
|
|
57926
57987
|
D(output, 'hashDigestLength', 16);
|
|
57927
57988
|
D(output, 'strictModuleErrorHandling', false);
|
|
57928
|
-
if (output.library) F(output.library, 'type', ()=>output.module ? 'module' : 'var');
|
|
57929
57989
|
F(output, 'chunkFormat', ()=>{
|
|
57930
57990
|
if (tp) {
|
|
57931
57991
|
const helpMessage = isAffectedByBrowserslist ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly.";
|
|
@@ -58009,19 +58069,6 @@ const applyOutputDefaults = (options, { context, outputModule, targetProperties:
|
|
|
58009
58069
|
F(trustedTypes, 'policyName', ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'rspack');
|
|
58010
58070
|
D(trustedTypes, 'onPolicyCreationFailure', 'stop');
|
|
58011
58071
|
}
|
|
58012
|
-
const forEachEntry = (fn)=>{
|
|
58013
|
-
if ('function' == typeof entry) return;
|
|
58014
|
-
for (const name of Object.keys(entry))fn(entry[name]);
|
|
58015
|
-
};
|
|
58016
|
-
A(output, 'enabledLibraryTypes', ()=>{
|
|
58017
|
-
const enabledLibraryTypes = [];
|
|
58018
|
-
if (output.library) enabledLibraryTypes.push(output.library.type);
|
|
58019
|
-
forEachEntry((desc)=>{
|
|
58020
|
-
if (desc.library) enabledLibraryTypes.push(desc.library.type);
|
|
58021
|
-
});
|
|
58022
|
-
if (enabledLibraryTypes.includes('modern-module')) applyLimits(options);
|
|
58023
|
-
return enabledLibraryTypes;
|
|
58024
|
-
});
|
|
58025
58072
|
A(output, 'enabledChunkLoadingTypes', ()=>{
|
|
58026
58073
|
const enabledChunkLoadingTypes = new Set();
|
|
58027
58074
|
if (output.chunkLoading) enabledChunkLoadingTypes.add(output.chunkLoading);
|
|
@@ -58042,7 +58089,7 @@ const applyOutputDefaults = (options, { context, outputModule, targetProperties:
|
|
|
58042
58089
|
});
|
|
58043
58090
|
D(output, 'bundlerInfo', {});
|
|
58044
58091
|
if ('object' == typeof output.bundlerInfo) {
|
|
58045
|
-
D(output.bundlerInfo, 'version', "2.0.0-
|
|
58092
|
+
D(output.bundlerInfo, 'version', "2.0.0-beta.0");
|
|
58046
58093
|
D(output.bundlerInfo, 'bundler', 'rspack');
|
|
58047
58094
|
D(output.bundlerInfo, 'force', !output.library);
|
|
58048
58095
|
}
|
|
@@ -58444,8 +58491,7 @@ const getNormalizedRspackOptions = (config)=>({
|
|
|
58444
58491
|
]),
|
|
58445
58492
|
rules: nestedArray(module.rules, (r)=>[
|
|
58446
58493
|
...r
|
|
58447
|
-
])
|
|
58448
|
-
unsafeCache: module.unsafeCache
|
|
58494
|
+
])
|
|
58449
58495
|
})),
|
|
58450
58496
|
target: config.target,
|
|
58451
58497
|
externals: config.externals,
|
|
@@ -58482,7 +58528,8 @@ const getNormalizedRspackOptions = (config)=>({
|
|
|
58482
58528
|
storage: {
|
|
58483
58529
|
type: 'filesystem',
|
|
58484
58530
|
directory: path_browserify_default().resolve(config.context || normalization_process.cwd(), cache.storage?.directory || 'node_modules/.cache/rspack')
|
|
58485
|
-
}
|
|
58531
|
+
},
|
|
58532
|
+
portable: cache.portable
|
|
58486
58533
|
};
|
|
58487
58534
|
}),
|
|
58488
58535
|
stats: nestedConfig(config.stats, (stats)=>{
|
|
@@ -58592,12 +58639,10 @@ const getNormalizedIncrementalOptions = (incremental)=>{
|
|
|
58592
58639
|
if (false === incremental || 'none' === incremental) return false;
|
|
58593
58640
|
if ('safe' === incremental) return {
|
|
58594
58641
|
silent: true,
|
|
58595
|
-
|
|
58596
|
-
|
|
58597
|
-
|
|
58598
|
-
|
|
58599
|
-
sideEffects: false,
|
|
58600
|
-
buildChunkGraph: false,
|
|
58642
|
+
buildModuleGraph: true,
|
|
58643
|
+
finishModules: false,
|
|
58644
|
+
optimizeDependencies: false,
|
|
58645
|
+
buildChunkGraph: true,
|
|
58601
58646
|
moduleIds: false,
|
|
58602
58647
|
chunkIds: false,
|
|
58603
58648
|
modulesHashes: false,
|
|
@@ -58605,7 +58650,7 @@ const getNormalizedIncrementalOptions = (incremental)=>{
|
|
|
58605
58650
|
modulesRuntimeRequirements: false,
|
|
58606
58651
|
chunksRuntimeRequirements: false,
|
|
58607
58652
|
chunksHashes: false,
|
|
58608
|
-
|
|
58653
|
+
chunkAsset: false,
|
|
58609
58654
|
emitAssets: true
|
|
58610
58655
|
};
|
|
58611
58656
|
if (true === incremental || 'advance-silent' === incremental) return {};
|
|
@@ -59704,7 +59749,7 @@ class MultiStats {
|
|
|
59704
59749
|
return obj;
|
|
59705
59750
|
});
|
|
59706
59751
|
if (childOptions.version) {
|
|
59707
|
-
obj.rspackVersion = "2.0.0-
|
|
59752
|
+
obj.rspackVersion = "2.0.0-beta.0";
|
|
59708
59753
|
obj.version = "5.75.0";
|
|
59709
59754
|
}
|
|
59710
59755
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
|
|
@@ -61258,17 +61303,25 @@ const SIMPLE_EXTRACTORS = {
|
|
|
61258
61303
|
if (!context.makePathsRelative) context.makePathsRelative = makePathsRelative.bindContextCache(compilation.compiler.context, compilation.compiler.root);
|
|
61259
61304
|
if (!context.cachedGetErrors) {
|
|
61260
61305
|
const map = new WeakMap();
|
|
61261
|
-
context.cachedGetErrors = (compilation)=>
|
|
61262
|
-
|
|
61263
|
-
|
|
61264
|
-
|
|
61306
|
+
context.cachedGetErrors = (compilation)=>{
|
|
61307
|
+
if (compilation.compiler._lastCompilation !== compilation) return [];
|
|
61308
|
+
const cache = map.get(compilation);
|
|
61309
|
+
if (cache) return cache;
|
|
61310
|
+
const errors = statsCompilation.errors;
|
|
61311
|
+
map.set(compilation, errors);
|
|
61312
|
+
return errors;
|
|
61313
|
+
};
|
|
61265
61314
|
}
|
|
61266
61315
|
if (!context.cachedGetWarnings) {
|
|
61267
61316
|
const map = new WeakMap();
|
|
61268
|
-
context.cachedGetWarnings = (compilation)=>
|
|
61269
|
-
|
|
61270
|
-
|
|
61271
|
-
|
|
61317
|
+
context.cachedGetWarnings = (compilation)=>{
|
|
61318
|
+
if (compilation.compiler._lastCompilation !== compilation) return [];
|
|
61319
|
+
const cache = map.get(compilation);
|
|
61320
|
+
if (cache) return cache;
|
|
61321
|
+
const warnings = compilation.__internal_getInner().createStatsWarnings(compilation.getWarnings(), !!options.colors);
|
|
61322
|
+
map.set(compilation, warnings);
|
|
61323
|
+
return warnings;
|
|
61324
|
+
};
|
|
61272
61325
|
}
|
|
61273
61326
|
if (compilation.name) object.name = compilation.name;
|
|
61274
61327
|
const logging = options.logging;
|
|
@@ -61382,7 +61435,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
61382
61435
|
},
|
|
61383
61436
|
version: (object)=>{
|
|
61384
61437
|
object.version = "5.75.0";
|
|
61385
|
-
object.rspackVersion = "2.0.0-
|
|
61438
|
+
object.rspackVersion = "2.0.0-beta.0";
|
|
61386
61439
|
},
|
|
61387
61440
|
env: (object, _compilation, _context, { _env })=>{
|
|
61388
61441
|
object.env = _env;
|
|
@@ -64039,26 +64092,28 @@ class Watching {
|
|
|
64039
64092
|
compilation.endTime = Date.now();
|
|
64040
64093
|
const cbs = this.callbacks;
|
|
64041
64094
|
this.callbacks = [];
|
|
64042
|
-
const fileDependencies = new Set([
|
|
64043
|
-
...compilation.fileDependencies
|
|
64044
|
-
]);
|
|
64045
|
-
fileDependencies.added = new Set(compilation.__internal__addedFileDependencies);
|
|
64046
|
-
fileDependencies.removed = new Set(compilation.__internal__removedFileDependencies);
|
|
64047
|
-
const contextDependencies = new Set([
|
|
64048
|
-
...compilation.contextDependencies
|
|
64049
|
-
]);
|
|
64050
|
-
contextDependencies.added = new Set(compilation.__internal__addedContextDependencies);
|
|
64051
|
-
contextDependencies.removed = new Set(compilation.__internal__removedContextDependencies);
|
|
64052
|
-
const missingDependencies = new Set([
|
|
64053
|
-
...compilation.missingDependencies
|
|
64054
|
-
]);
|
|
64055
|
-
missingDependencies.added = new Set(compilation.__internal__addedMissingDependencies);
|
|
64056
|
-
missingDependencies.removed = new Set(compilation.__internal__removedMissingDependencies);
|
|
64057
64095
|
this.compiler.hooks.done.callAsync(stats, (err)=>{
|
|
64058
64096
|
if (err) return handleError(err, cbs);
|
|
64059
64097
|
this.handler(null, stats);
|
|
64060
64098
|
Watching_process.nextTick(()=>{
|
|
64061
|
-
if (!this.#closed)
|
|
64099
|
+
if (!this.#closed) {
|
|
64100
|
+
const fileDependencies = new Set([
|
|
64101
|
+
...compilation.fileDependencies
|
|
64102
|
+
]);
|
|
64103
|
+
fileDependencies.added = new Set(compilation.__internal__addedFileDependencies);
|
|
64104
|
+
fileDependencies.removed = new Set(compilation.__internal__removedFileDependencies);
|
|
64105
|
+
const contextDependencies = new Set([
|
|
64106
|
+
...compilation.contextDependencies
|
|
64107
|
+
]);
|
|
64108
|
+
contextDependencies.added = new Set(compilation.__internal__addedContextDependencies);
|
|
64109
|
+
contextDependencies.removed = new Set(compilation.__internal__removedContextDependencies);
|
|
64110
|
+
const missingDependencies = new Set([
|
|
64111
|
+
...compilation.missingDependencies
|
|
64112
|
+
]);
|
|
64113
|
+
missingDependencies.added = new Set(compilation.__internal__addedMissingDependencies);
|
|
64114
|
+
missingDependencies.removed = new Set(compilation.__internal__removedMissingDependencies);
|
|
64115
|
+
this.watch(fileDependencies, contextDependencies, missingDependencies);
|
|
64116
|
+
}
|
|
64062
64117
|
});
|
|
64063
64118
|
for (const cb of cbs)cb(null);
|
|
64064
64119
|
this.compiler.hooks.afterDone.call(stats);
|
|
@@ -64089,6 +64144,7 @@ class Watching {
|
|
|
64089
64144
|
}
|
|
64090
64145
|
}
|
|
64091
64146
|
}
|
|
64147
|
+
const GET_COMPILER_ID = Symbol('getCompilerId');
|
|
64092
64148
|
class Compiler {
|
|
64093
64149
|
#instance;
|
|
64094
64150
|
#initial;
|
|
@@ -64224,6 +64280,17 @@ class Compiler {
|
|
|
64224
64280
|
]),
|
|
64225
64281
|
additionalPass: new AsyncSeriesHook([])
|
|
64226
64282
|
};
|
|
64283
|
+
const availableCompilerHooks = Object.keys(this.hooks);
|
|
64284
|
+
this.hooks = new Proxy(this.hooks, {
|
|
64285
|
+
get (target, prop, receiver) {
|
|
64286
|
+
const value = Reflect.get(target, prop, receiver);
|
|
64287
|
+
if (void 0 === value && 'string' == typeof prop) {
|
|
64288
|
+
const hooksList = availableCompilerHooks.join(', ');
|
|
64289
|
+
throw new Error(`Compiler.hooks.${prop} is not supported in rspack. This typically happens when using webpack plugins that rely on webpack-specific hooks. Consider using an rspack-compatible alternative or removing the incompatible plugin.\n\nAvailable compiler hooks: ${hooksList}`);
|
|
64290
|
+
}
|
|
64291
|
+
return value;
|
|
64292
|
+
}
|
|
64293
|
+
});
|
|
64227
64294
|
const compilerRuntimeGlobals = createCompilerRuntimeGlobals(options);
|
|
64228
64295
|
const compilerFn = function(...params) {
|
|
64229
64296
|
return rspack(...params);
|
|
@@ -64264,6 +64331,12 @@ class Compiler {
|
|
|
64264
64331
|
this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader);
|
|
64265
64332
|
new JsLoaderRspackPlugin(this).apply(this);
|
|
64266
64333
|
new ExecuteModulePlugin().apply(this);
|
|
64334
|
+
Object.defineProperty(this, GET_COMPILER_ID, {
|
|
64335
|
+
writable: false,
|
|
64336
|
+
configurable: false,
|
|
64337
|
+
enumerable: false,
|
|
64338
|
+
value: ()=>this.#instance.getCompilerId()
|
|
64339
|
+
});
|
|
64267
64340
|
}
|
|
64268
64341
|
get recordsInputPath() {
|
|
64269
64342
|
return unsupported('Compiler.recordsInputPath');
|
|
@@ -65600,7 +65673,7 @@ function transformSync(source, options) {
|
|
|
65600
65673
|
const _options = JSON.stringify(options || {});
|
|
65601
65674
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
65602
65675
|
}
|
|
65603
|
-
const exports_rspackVersion = "2.0.0-
|
|
65676
|
+
const exports_rspackVersion = "2.0.0-beta.0";
|
|
65604
65677
|
const exports_version = "5.75.0";
|
|
65605
65678
|
const exports_WebpackError = Error;
|
|
65606
65679
|
const exports_config = {
|
|
@@ -65684,7 +65757,8 @@ const exports_experiments = {
|
|
|
65684
65757
|
},
|
|
65685
65758
|
CssChunkingPlugin: CssChunkingPlugin,
|
|
65686
65759
|
createNativePlugin: createNativePlugin,
|
|
65687
|
-
VirtualModulesPlugin: VirtualModulesPlugin
|
|
65760
|
+
VirtualModulesPlugin: VirtualModulesPlugin,
|
|
65761
|
+
rsc: rsc
|
|
65688
65762
|
};
|
|
65689
65763
|
const src_fn = Object.assign(rspack, exports_namespaceObject);
|
|
65690
65764
|
src_fn.rspack = src_fn;
|
|
@@ -65859,4 +65933,4 @@ const builtinMemFs = {
|
|
|
65859
65933
|
volume: fs_0.volume,
|
|
65860
65934
|
memfs: fs_0.memfs
|
|
65861
65935
|
};
|
|
65862
|
-
export { AsyncDependenciesBlock, BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CaseSensitivePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ConcatenatedModule, ContextModule, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefaultRuntimeGlobals as RuntimeGlobals, DefinePlugin, Dependency, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryDependency, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalModule, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, Module, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, builtinMemFs, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, exports_library as library, exports_node as node, exports_rspackVersion as rspackVersion, exports_version as version, exports_wasm as wasm, javascript, lazyCompilationMiddleware, lib as sources, lib_EntryOptionPlugin as EntryOptionPlugin, optimize, sharing, src_rspack_0 as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };
|
|
65936
|
+
export { AsyncDependenciesBlock, BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CaseSensitivePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ConcatenatedModule, ContextModule, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefaultRuntimeGlobals as RuntimeGlobals, DefinePlugin, Dependency, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryDependency, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalModule, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, Module, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, builtinMemFs, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, exports_library as library, exports_node as node, exports_rspackVersion as rspackVersion, exports_version as version, exports_wasm as wasm, javascript, lazyCompilationMiddleware, lib as sources, lib_EntryOptionPlugin as EntryOptionPlugin, optimize, sharing, src_rspack_0 as "module.exports", src_rspack_0 as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };
|
package/dist/napi-binding.d.ts
CHANGED
|
@@ -95,6 +95,8 @@ export interface JsSource {
|
|
|
95
95
|
source: string | Buffer
|
|
96
96
|
map?: string
|
|
97
97
|
}
|
|
98
|
+
|
|
99
|
+
export type CompilerId = void;
|
|
98
100
|
/* -- banner.d.ts end -- */
|
|
99
101
|
|
|
100
102
|
/* -- napi-rs generated below -- */
|
|
@@ -213,6 +215,7 @@ export declare class Dependency {
|
|
|
213
215
|
get critical(): boolean
|
|
214
216
|
set critical(val: boolean)
|
|
215
217
|
get ids(): Array<string> | undefined
|
|
218
|
+
get loc(): DependencyLocation | null
|
|
216
219
|
}
|
|
217
220
|
|
|
218
221
|
export declare class Diagnostics {
|
|
@@ -334,6 +337,7 @@ export declare class JsCompiler {
|
|
|
334
337
|
rebuild(changed_files: string[], removed_files: string[], callback: (err: null | Error) => void): void
|
|
335
338
|
close(): Promise<void>
|
|
336
339
|
getVirtualFileStore(): VirtualFileStore | null
|
|
340
|
+
getCompilerId(): ExternalObject<CompilerId>
|
|
337
341
|
}
|
|
338
342
|
|
|
339
343
|
export declare class JsContextModuleFactoryAfterResolveData {
|
|
@@ -361,6 +365,10 @@ export declare class JsContextModuleFactoryBeforeResolveData {
|
|
|
361
365
|
set recursive(recursive: boolean)
|
|
362
366
|
}
|
|
363
367
|
|
|
368
|
+
export declare class JsCoordinator {
|
|
369
|
+
constructor(getServerCompilerIdJsFn: () => ExternalObject<CompilerId>)
|
|
370
|
+
}
|
|
371
|
+
|
|
364
372
|
export declare class JsDependencies {
|
|
365
373
|
get fileDependencies(): Array<string>
|
|
366
374
|
get addedFileDependencies(): Array<string>
|
|
@@ -602,7 +610,9 @@ export declare enum BuiltinPluginName {
|
|
|
602
610
|
LazyCompilationPlugin = 'LazyCompilationPlugin',
|
|
603
611
|
ModuleInfoHeaderPlugin = 'ModuleInfoHeaderPlugin',
|
|
604
612
|
HttpUriPlugin = 'HttpUriPlugin',
|
|
605
|
-
CssChunkingPlugin = 'CssChunkingPlugin'
|
|
613
|
+
CssChunkingPlugin = 'CssChunkingPlugin',
|
|
614
|
+
RscServerPlugin = 'RscServerPlugin',
|
|
615
|
+
RscClientPlugin = 'RscClientPlugin'
|
|
606
616
|
}
|
|
607
617
|
|
|
608
618
|
export declare function cleanupGlobalTrace(): void
|
|
@@ -1028,6 +1038,15 @@ export interface JsResourceData {
|
|
|
1028
1038
|
descriptionFilePath?: string
|
|
1029
1039
|
}
|
|
1030
1040
|
|
|
1041
|
+
export interface JsRscClientPluginOptions {
|
|
1042
|
+
coordinator: JsCoordinator
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
export interface JsRscServerPluginOptions {
|
|
1046
|
+
coordinator: JsCoordinator
|
|
1047
|
+
onServerComponentChanges?: (() => void) | undefined | null
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1031
1050
|
export interface JsRsdoctorAsset {
|
|
1032
1051
|
ukey: number
|
|
1033
1052
|
path: string
|
|
@@ -1832,6 +1851,7 @@ export interface RawCacheOptionsPersistent {
|
|
|
1832
1851
|
version?: string
|
|
1833
1852
|
snapshot?: RawSnapshotOptions
|
|
1834
1853
|
storage?: RawStorageOptions
|
|
1854
|
+
portable?: boolean
|
|
1835
1855
|
}
|
|
1836
1856
|
|
|
1837
1857
|
export interface RawCircularDependencyRspackPluginOptions {
|
|
@@ -2259,11 +2279,9 @@ export interface RawIgnorePluginOptions {
|
|
|
2259
2279
|
|
|
2260
2280
|
export interface RawIncremental {
|
|
2261
2281
|
silent: boolean
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
dependenciesDiagnostics: boolean
|
|
2266
|
-
sideEffects: boolean
|
|
2282
|
+
buildModuleGraph: boolean
|
|
2283
|
+
finishModules: boolean
|
|
2284
|
+
optimizeDependencies: boolean
|
|
2267
2285
|
buildChunkGraph: boolean
|
|
2268
2286
|
moduleIds: boolean
|
|
2269
2287
|
chunkIds: boolean
|
|
@@ -2272,7 +2290,7 @@ export interface RawIncremental {
|
|
|
2272
2290
|
modulesRuntimeRequirements: boolean
|
|
2273
2291
|
chunksRuntimeRequirements: boolean
|
|
2274
2292
|
chunksHashes: boolean
|
|
2275
|
-
|
|
2293
|
+
chunkAsset: boolean
|
|
2276
2294
|
emitAssets: boolean
|
|
2277
2295
|
}
|
|
2278
2296
|
|
|
@@ -2496,7 +2514,6 @@ export interface RawModuleOptions {
|
|
|
2496
2514
|
parser?: Record<string, RawParserOptions>
|
|
2497
2515
|
generator?: Record<string, RawGeneratorOptions>
|
|
2498
2516
|
noParse?: string | RegExp | ((request: string) => boolean) | (string | RegExp | ((request: string) => boolean))[]
|
|
2499
|
-
unsafeCache?: boolean | RegExp
|
|
2500
2517
|
}
|
|
2501
2518
|
|
|
2502
2519
|
export interface RawModuleRule {
|
|
@@ -2783,6 +2800,7 @@ export interface RawRstestPluginOptions {
|
|
|
2783
2800
|
hoistMockModule: boolean
|
|
2784
2801
|
manualMockRoot: string
|
|
2785
2802
|
preserveNewUrl?: Array<string>
|
|
2803
|
+
globals?: boolean
|
|
2786
2804
|
}
|
|
2787
2805
|
|
|
2788
2806
|
export interface RawRuleSetCondition {
|
|
@@ -85,6 +85,7 @@ export const JsCompilation = __napiModule.exports.JsCompilation
|
|
|
85
85
|
export const JsCompiler = __napiModule.exports.JsCompiler
|
|
86
86
|
export const JsContextModuleFactoryAfterResolveData = __napiModule.exports.JsContextModuleFactoryAfterResolveData
|
|
87
87
|
export const JsContextModuleFactoryBeforeResolveData = __napiModule.exports.JsContextModuleFactoryBeforeResolveData
|
|
88
|
+
export const JsCoordinator = __napiModule.exports.JsCoordinator
|
|
88
89
|
export const JsDependencies = __napiModule.exports.JsDependencies
|
|
89
90
|
export const JsEntries = __napiModule.exports.JsEntries
|
|
90
91
|
export const JsExportsInfo = __napiModule.exports.JsExportsInfo
|
|
Binary file
|
package/package.json
CHANGED