@rspack/core 1.7.1 → 1.7.3
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/Compilation.d.ts +2 -2
- package/dist/RuntimeModule.d.ts +3 -1
- package/dist/config/target.d.ts +2 -0
- package/dist/config/types.d.ts +7 -0
- package/dist/index.js +109 -40
- package/dist/worker.js +2 -2
- package/hot/lazy-compilation-node.js +90 -34
- package/hot/lazy-compilation-web.js +61 -35
- package/package.json +6 -6
package/dist/Compilation.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation
|
|
10
|
+
import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation } from '@rspack/binding';
|
|
11
11
|
import binding from '@rspack/binding';
|
|
12
12
|
export type { AssetInfo } from '@rspack/binding';
|
|
13
13
|
import * as liteTapable from '@rspack/lite-tapable';
|
|
@@ -185,7 +185,7 @@ export declare class Compilation {
|
|
|
185
185
|
Set<string>
|
|
186
186
|
]>;
|
|
187
187
|
runtimeRequirementInTree: liteTapable.HookMap<liteTapable.SyncBailHook<[Chunk, Set<string>], void>>;
|
|
188
|
-
runtimeModule: liteTapable.SyncHook<[
|
|
188
|
+
runtimeModule: liteTapable.SyncHook<[RuntimeModule, Chunk]>;
|
|
189
189
|
seal: liteTapable.SyncHook<[]>;
|
|
190
190
|
afterSeal: liteTapable.AsyncSeriesHook<[], void>;
|
|
191
191
|
needAdditionalPass: liteTapable.SyncBailHook<[], boolean>;
|
package/dist/RuntimeModule.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JsAddingRuntimeModule } from '@rspack/binding';
|
|
1
|
+
import type { JsAddingRuntimeModule, JsRuntimeModule, JsSource } from '@rspack/binding';
|
|
2
2
|
import type { Chunk } from './Chunk';
|
|
3
3
|
import type { ChunkGraph } from './ChunkGraph';
|
|
4
4
|
import type { Compilation } from './Compilation';
|
|
@@ -23,6 +23,7 @@ export declare class RuntimeModule {
|
|
|
23
23
|
protected chunkGraph: ChunkGraph | null;
|
|
24
24
|
constructor(name: string, stage?: RuntimeModuleStage);
|
|
25
25
|
attach(compilation: Compilation, chunk: Chunk, chunkGraph: ChunkGraph): void;
|
|
26
|
+
get source(): JsSource | undefined;
|
|
26
27
|
get name(): string;
|
|
27
28
|
get stage(): RuntimeModuleStage;
|
|
28
29
|
identifier(): string;
|
|
@@ -30,3 +31,4 @@ export declare class RuntimeModule {
|
|
|
30
31
|
shouldIsolate(): boolean;
|
|
31
32
|
generate(): string;
|
|
32
33
|
}
|
|
34
|
+
export declare function createRenderedRuntimeModule(module: JsRuntimeModule): RuntimeModule;
|
package/dist/config/target.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export type ApiTargetProperties = {
|
|
|
38
38
|
importScripts: boolean | null;
|
|
39
39
|
/** has importScripts available when creating a worker */
|
|
40
40
|
importScriptsInWorker: boolean | null;
|
|
41
|
+
/** node.js allows to use `import.meta.dirname` and `import.meta.filename` */
|
|
42
|
+
importMetaDirnameAndFilename: boolean | null;
|
|
41
43
|
/** has fetch function available for WebAssembly */
|
|
42
44
|
fetchWasm: boolean | null;
|
|
43
45
|
/** has global variable available */
|
package/dist/config/types.d.ts
CHANGED
|
@@ -272,6 +272,8 @@ export type Environment = {
|
|
|
272
272
|
dynamicImport?: boolean;
|
|
273
273
|
/** The environment supports an async import() when creating a worker, only for web targets at the moment. */
|
|
274
274
|
dynamicImportInWorker?: boolean;
|
|
275
|
+
/** The environment supports `import.meta.dirname` and `import.meta.filename`. */
|
|
276
|
+
importMetaDirnameAndFilename?: boolean;
|
|
275
277
|
/** The environment supports 'for of' iteration ('for (const x of array) { ... }'). */
|
|
276
278
|
forOf?: boolean;
|
|
277
279
|
/** The environment supports 'globalThis'. */
|
|
@@ -851,6 +853,11 @@ export type JavascriptParserOptions = {
|
|
|
851
853
|
worker?: string[] | boolean;
|
|
852
854
|
/** Override the module to strict or non-strict. */
|
|
853
855
|
overrideStrict?: 'strict' | 'non-strict';
|
|
856
|
+
/**
|
|
857
|
+
* Control whether renaming of the CommonJS `require` function will be parsed and transformed.
|
|
858
|
+
* @default true
|
|
859
|
+
*/
|
|
860
|
+
requireAlias?: boolean;
|
|
854
861
|
requireAsExpression?: boolean;
|
|
855
862
|
requireDynamic?: boolean;
|
|
856
863
|
requireResolve?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -667,6 +667,7 @@ for(var __rspack_i in (()=>{
|
|
|
667
667
|
attach(compilation, chunk, chunkGraph) {
|
|
668
668
|
this.compilation = compilation, this.chunk = chunk, this.chunkGraph = chunkGraph;
|
|
669
669
|
}
|
|
670
|
+
get source() {}
|
|
670
671
|
get name() {
|
|
671
672
|
return this._name;
|
|
672
673
|
}
|
|
@@ -3992,6 +3993,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
3992
3993
|
] : [] : parser.worker,
|
|
3993
3994
|
overrideStrict: parser.overrideStrict,
|
|
3994
3995
|
requireAsExpression: parser.requireAsExpression,
|
|
3996
|
+
requireAlias: parser.requireAlias,
|
|
3995
3997
|
requireDynamic: parser.requireDynamic,
|
|
3996
3998
|
requireResolve: parser.requireResolve,
|
|
3997
3999
|
commonjs: parser.commonjs,
|
|
@@ -4121,7 +4123,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4121
4123
|
if ('string' == typeof item || item instanceof RegExp) return item;
|
|
4122
4124
|
if ('function' == typeof item) {
|
|
4123
4125
|
let processResolveResult = this.#processResolveResult;
|
|
4124
|
-
return async (ctx)=>
|
|
4126
|
+
return async (ctx)=>new Promise((resolve, reject)=>{
|
|
4125
4127
|
let data = ctx.data(), promise = item({
|
|
4126
4128
|
request: data.request,
|
|
4127
4129
|
dependencyType: data.dependencyType,
|
|
@@ -4508,16 +4510,44 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4508
4510
|
}
|
|
4509
4511
|
let lazyCompilationMiddlewareInternal = (compiler, activeModules, lazyCompilationPrefix)=>{
|
|
4510
4512
|
let logger = compiler.getInfrastructureLogger('LazyCompilation');
|
|
4511
|
-
return (req, res, next)=>{
|
|
4512
|
-
if (!req.url?.startsWith(lazyCompilationPrefix)) return next?.();
|
|
4513
|
-
let modules =
|
|
4514
|
-
|
|
4513
|
+
return async (req, res, next)=>{
|
|
4514
|
+
if (!req.url?.startsWith(lazyCompilationPrefix) || 'POST' !== req.method) return next?.();
|
|
4515
|
+
let modules = [];
|
|
4516
|
+
try {
|
|
4517
|
+
modules = await function(req) {
|
|
4518
|
+
if (void 0 !== req.body) {
|
|
4519
|
+
if (Array.isArray(req.body)) return Promise.resolve(req.body);
|
|
4520
|
+
if ('string' == typeof req.body) return Promise.resolve(req.body.split('\n').filter(Boolean));
|
|
4521
|
+
throw Error('Invalid body type');
|
|
4522
|
+
}
|
|
4523
|
+
return new Promise((resolve, reject)=>{
|
|
4524
|
+
if (req.aborted || req.destroyed) return void reject(Error('Request was aborted before body could be read'));
|
|
4525
|
+
let cleanup = ()=>{
|
|
4526
|
+
req.removeListener('data', onData), req.removeListener('end', onEnd), req.removeListener('error', onError), req.removeListener('close', onClose), req.removeListener('aborted', onAborted);
|
|
4527
|
+
}, chunks = [], onData = (chunk)=>{
|
|
4528
|
+
chunks.push(chunk);
|
|
4529
|
+
}, onEnd = ()=>{
|
|
4530
|
+
cleanup(), resolve(Buffer.concat(chunks).toString('utf8').split('\n').filter(Boolean));
|
|
4531
|
+
}, onError = (err)=>{
|
|
4532
|
+
cleanup(), reject(err);
|
|
4533
|
+
}, onClose = ()=>{
|
|
4534
|
+
cleanup(), reject(Error('Request was closed before body could be read'));
|
|
4535
|
+
}, onAborted = ()=>{
|
|
4536
|
+
cleanup(), reject(Error('Request was aborted before body could be read'));
|
|
4537
|
+
};
|
|
4538
|
+
req.on('data', onData), req.on('end', onEnd), req.on('error', onError), req.on('close', onClose), req.on('aborted', onAborted);
|
|
4539
|
+
});
|
|
4540
|
+
}(req);
|
|
4541
|
+
} catch (err) {
|
|
4542
|
+
logger.error('Failed to parse request body: ' + err), res.writeHead(400), res.end('Bad Request');
|
|
4543
|
+
return;
|
|
4544
|
+
}
|
|
4515
4545
|
let moduleActivated = [];
|
|
4516
4546
|
for (let key of modules){
|
|
4517
4547
|
let activated = activeModules.has(key);
|
|
4518
4548
|
activeModules.add(key), activated || (logger.log(`${key} is now in use and will be compiled.`), moduleActivated.push(key));
|
|
4519
4549
|
}
|
|
4520
|
-
moduleActivated.length && compiler.watching && compiler.watching.invalidate();
|
|
4550
|
+
moduleActivated.length && compiler.watching && compiler.watching.invalidate(), res.writeHead(200), res.write('\n'), res.end();
|
|
4521
4551
|
};
|
|
4522
4552
|
};
|
|
4523
4553
|
class MangleExportsPlugin extends RspackBuiltinPlugin {
|
|
@@ -4805,10 +4835,10 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
4805
4835
|
'async-node'
|
|
4806
4836
|
].includes(compiler.options.output.chunkLoading)) return;
|
|
4807
4837
|
let hwpHooks = getHooks(compilation);
|
|
4808
|
-
hwpHooks.beforeAssetTagGeneration.tapPromise(SubresourceIntegrityPlugin_PLUGIN_NAME,
|
|
4838
|
+
hwpHooks.beforeAssetTagGeneration.tapPromise(SubresourceIntegrityPlugin_PLUGIN_NAME, (data)=>(self.handleHwpPluginArgs(data), Promise.resolve(data))), hwpHooks.alterAssetTagGroups.tapPromise({
|
|
4809
4839
|
name: SubresourceIntegrityPlugin_PLUGIN_NAME,
|
|
4810
4840
|
stage: 10000
|
|
4811
|
-
},
|
|
4841
|
+
}, (data)=>(self.handleHwpBodyTags(data, compiler.outputPath, compiler.options.output.crossOriginLoading), Promise.resolve(data)));
|
|
4812
4842
|
});
|
|
4813
4843
|
} catch (e) {
|
|
4814
4844
|
if (!((obj = e) instanceof Error && 'code' in obj && [
|
|
@@ -5554,6 +5584,12 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
|
|
|
5554
5584
|
18
|
|
5555
5585
|
]
|
|
5556
5586
|
}),
|
|
5587
|
+
importMetaDirnameAndFilename: nodeProperty && rawChecker({
|
|
5588
|
+
node: [
|
|
5589
|
+
22,
|
|
5590
|
+
16
|
|
5591
|
+
]
|
|
5592
|
+
}),
|
|
5557
5593
|
require: nodeProperty
|
|
5558
5594
|
};
|
|
5559
5595
|
}, getBrowserslistTargetHandler = memoize(()=>browserslistTargetHandler_namespaceObject), hasBrowserslistConfig = (context)=>{
|
|
@@ -5634,6 +5670,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5634
5670
|
require: !asyncFlag,
|
|
5635
5671
|
nodeBuiltins: !0,
|
|
5636
5672
|
nodePrefixForCoreModules: 15 > +major ? v(14, 18) : v(16),
|
|
5673
|
+
importMetaDirnameAndFilename: v(22, 16),
|
|
5637
5674
|
global: !0,
|
|
5638
5675
|
document: !1,
|
|
5639
5676
|
fetchWasm: !1,
|
|
@@ -5674,6 +5711,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5674
5711
|
global: !0,
|
|
5675
5712
|
nodeBuiltins: !0,
|
|
5676
5713
|
nodePrefixForCoreModules: v(15),
|
|
5714
|
+
importMetaDirnameAndFilename: v(37),
|
|
5677
5715
|
require: !0,
|
|
5678
5716
|
document: 'renderer' === context,
|
|
5679
5717
|
fetchWasm: 'renderer' === context,
|
|
@@ -5844,12 +5882,12 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
5844
5882
|
}, applyExperimentsDefaults = (experiments, { development })=>{
|
|
5845
5883
|
F(experiments, 'cache', ()=>development), D(experiments, 'futureDefaults', !1), D(experiments, 'lazyCompilation', !1), D(experiments, 'asyncWebAssembly', experiments.futureDefaults), D(experiments, 'css', !!experiments.futureDefaults || void 0), D(experiments, 'topLevelAwait', !0), D(experiments, 'deferImport', !1), D(experiments, 'buildHttp', void 0), experiments.buildHttp && 'object' == typeof experiments.buildHttp && D(experiments.buildHttp, 'upgrade', !1), D(experiments, 'incremental', {}), 'object' == typeof experiments.incremental && (D(experiments.incremental, 'silent', !0), D(experiments.incremental, 'make', !0), D(experiments.incremental, 'inferAsyncModules', !0), D(experiments.incremental, 'providedExports', !0), D(experiments.incremental, 'dependenciesDiagnostics', !0), D(experiments.incremental, 'sideEffects', !0), D(experiments.incremental, 'buildChunkGraph', !1), D(experiments.incremental, 'moduleIds', !0), D(experiments.incremental, 'chunkIds', !0), D(experiments.incremental, 'modulesHashes', !0), D(experiments.incremental, 'modulesCodegen', !0), D(experiments.incremental, 'modulesRuntimeRequirements', !0), D(experiments.incremental, 'chunksRuntimeRequirements', !0), D(experiments.incremental, 'chunksHashes', !0), D(experiments.incremental, 'chunksRender', !0), D(experiments.incremental, 'emitAssets', !0)), D(experiments, 'rspackFuture', {}), D(experiments, 'parallelLoader', !1), D(experiments, 'useInputFileSystem', !1), D(experiments, 'inlineConst', !0), D(experiments, 'inlineEnum', !1), D(experiments, 'typeReexportsPresence', !1), D(experiments, 'lazyBarrel', !0);
|
|
5846
5884
|
}, applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
5847
|
-
'object' == typeof rspackFuture && (D(rspackFuture, 'bundlerInfo', {}), 'object' == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, 'version', "1.7.
|
|
5885
|
+
'object' == typeof rspackFuture && (D(rspackFuture, 'bundlerInfo', {}), 'object' == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, 'version', "1.7.3"), D(rspackFuture.bundlerInfo, 'bundler', 'rspack'), D(rspackFuture.bundlerInfo, 'force', !library)));
|
|
5848
5886
|
}, applySnapshotDefaults = (_snapshot, _env)=>{}, applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties })=>{
|
|
5849
5887
|
D(generatorOptions, 'exportsOnly', !targetProperties || !1 === targetProperties.document), D(generatorOptions, 'esModule', !0);
|
|
5850
5888
|
}, applyModuleDefaults = (module1, { cache, asyncWebAssembly, css, targetProperties, mode, uniqueName, deferImport })=>{
|
|
5851
5889
|
if (assertNotNill(module1.parser), assertNotNill(module1.generator), cache ? D(module1, 'unsafeCache', /[\\/]node_modules[\\/]/) : D(module1, 'unsafeCache', !1), F(module1.parser, "asset", ()=>({})), assertNotNill(module1.parser.asset), F(module1.parser.asset, 'dataUrlCondition', ()=>({})), 'object' == typeof module1.parser.asset.dataUrlCondition && D(module1.parser.asset.dataUrlCondition, 'maxSize', 8096), F(module1.parser, "javascript", ()=>({})), assertNotNill(module1.parser.javascript), ((parserOptions, { deferImport })=>{
|
|
5852
|
-
D(parserOptions, 'dynamicImportMode', 'lazy'), D(parserOptions, 'dynamicImportPrefetch', !1), D(parserOptions, 'dynamicImportPreload', !1), D(parserOptions, 'url', !0), D(parserOptions, 'exprContextCritical', !0), D(parserOptions, 'unknownContextCritical', !0), D(parserOptions, 'wrappedContextCritical', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'strictExportPresence', !1), D(parserOptions, 'requireAsExpression', !0), D(parserOptions, 'requireDynamic', !0), D(parserOptions, 'requireResolve', !0), D(parserOptions, 'commonjs', !0), D(parserOptions, 'importDynamic', !0), D(parserOptions, 'worker', [
|
|
5890
|
+
D(parserOptions, 'dynamicImportMode', 'lazy'), D(parserOptions, 'dynamicImportPrefetch', !1), D(parserOptions, 'dynamicImportPreload', !1), D(parserOptions, 'url', !0), D(parserOptions, 'exprContextCritical', !0), D(parserOptions, 'unknownContextCritical', !0), D(parserOptions, 'wrappedContextCritical', !1), D(parserOptions, 'wrappedContextRegExp', /.*/), D(parserOptions, 'strictExportPresence', !1), D(parserOptions, 'requireAsExpression', !0), D(parserOptions, 'requireAlias', !0), D(parserOptions, 'requireDynamic', !0), D(parserOptions, 'requireResolve', !0), D(parserOptions, 'commonjs', !0), D(parserOptions, 'importDynamic', !0), D(parserOptions, 'worker', [
|
|
5853
5891
|
'...'
|
|
5854
5892
|
]), D(parserOptions, 'importMeta', !0), D(parserOptions, 'typeReexportsPresence', 'no-tolerant'), D(parserOptions, 'jsx', !1), D(parserOptions, 'deferImport', deferImport);
|
|
5855
5893
|
})(module1.parser.javascript, {
|
|
@@ -6038,7 +6076,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
6038
6076
|
}), F(environment, 'nodePrefixForCoreModules', ()=>{
|
|
6039
6077
|
let v;
|
|
6040
6078
|
return tp && ((v = tp.nodePrefixForCoreModules) || void 0 === v);
|
|
6041
|
-
}), F(environment, 'templateLiteral', ()=>{
|
|
6079
|
+
}), F(environment, 'importMetaDirnameAndFilename', ()=>tp?.importMetaDirnameAndFilename), F(environment, 'templateLiteral', ()=>{
|
|
6042
6080
|
let v;
|
|
6043
6081
|
return tp && ((v = tp.templateLiteral) || void 0 === v);
|
|
6044
6082
|
}), F(environment, 'dynamicImport', ()=>conditionallyOptimistic(tp?.dynamicImport, output.module)), F(environment, 'dynamicImportInWorker', ()=>conditionallyOptimistic(tp?.dynamicImportInWorker, output.module)), F(environment, 'module', ()=>conditionallyOptimistic(tp?.module, output.module)), F(environment, 'document', ()=>{
|
|
@@ -7003,24 +7041,22 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7003
7041
|
if (super(fs), !fs) return;
|
|
7004
7042
|
this.open = memoizeFn(()=>external_node_util_default().promisify(fs.open.bind(fs))), this.rename = memoizeFn(()=>external_node_util_default().promisify(fs.rename.bind(fs))), this.close = memoizeFn(()=>external_node_util_default().promisify(fs.close.bind(fs))), this.write = memoizeFn(()=>{
|
|
7005
7043
|
let writeFn = external_node_util_default().promisify(fs.write.bind(fs));
|
|
7006
|
-
return async (fd, content, position)=>
|
|
7044
|
+
return async (fd, content, position)=>writeFn(fd, content, {
|
|
7007
7045
|
position
|
|
7008
7046
|
});
|
|
7009
7047
|
}), this.writeAll = memoizeFn(()=>{
|
|
7010
7048
|
let writeFn = external_node_util_default().promisify(fs.writeFile.bind(fs));
|
|
7011
|
-
return async (fd, content)=>
|
|
7049
|
+
return async (fd, content)=>writeFn(fd, content);
|
|
7012
7050
|
}), this.read = memoizeFn(()=>{
|
|
7013
7051
|
let readFn = fs.read.bind(fs);
|
|
7014
|
-
return
|
|
7015
|
-
new Promise((resolve)=>{
|
|
7052
|
+
return (fd, length, position)=>new Promise((resolve, reject)=>{
|
|
7016
7053
|
readFn(fd, {
|
|
7017
7054
|
position,
|
|
7018
7055
|
length
|
|
7019
7056
|
}, (err, _bytesRead, buffer)=>{
|
|
7020
|
-
err ?
|
|
7057
|
+
err ? reject(err) : resolve(buffer);
|
|
7021
7058
|
});
|
|
7022
7059
|
});
|
|
7023
|
-
};
|
|
7024
7060
|
}), this.readUntil = memoizeFn(()=>async (fd, delim, position)=>{
|
|
7025
7061
|
let res = [], current_position = position;
|
|
7026
7062
|
for(;;){
|
|
@@ -7384,10 +7420,10 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7384
7420
|
hasWarnings() {
|
|
7385
7421
|
return this.stats.some((stat)=>stat.hasWarnings());
|
|
7386
7422
|
}
|
|
7387
|
-
#createChildOptions(options
|
|
7423
|
+
#createChildOptions(options, context) {
|
|
7388
7424
|
let { children: childrenOptions, ...baseOptions } = 'string' == typeof options || 'boolean' == typeof options ? {
|
|
7389
7425
|
preset: options
|
|
7390
|
-
} : options, children = this.stats.map((stat, idx)=>{
|
|
7426
|
+
} : options ?? {}, children = this.stats.map((stat, idx)=>{
|
|
7391
7427
|
let childOptions = Array.isArray(childrenOptions) ? childrenOptions[idx] : childrenOptions;
|
|
7392
7428
|
return stat.compilation.createStatsOptions({
|
|
7393
7429
|
...baseOptions,
|
|
@@ -7414,7 +7450,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
7414
7450
|
obj.children = this.stats.map((stat, idx)=>{
|
|
7415
7451
|
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
|
|
7416
7452
|
return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
|
|
7417
|
-
}), childOptions.version && (obj.rspackVersion = "1.7.
|
|
7453
|
+
}), childOptions.version && (obj.rspackVersion = "1.7.3", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(''));
|
|
7418
7454
|
let mapError = (j, obj)=>({
|
|
7419
7455
|
...obj,
|
|
7420
7456
|
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
|
@@ -8670,7 +8706,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
8670
8706
|
object.hash = context.getStatsCompilation(compilation).hash;
|
|
8671
8707
|
},
|
|
8672
8708
|
version: (object)=>{
|
|
8673
|
-
object.version = "5.75.0", object.rspackVersion = "1.7.
|
|
8709
|
+
object.version = "5.75.0", object.rspackVersion = "1.7.3";
|
|
8674
8710
|
},
|
|
8675
8711
|
env: (object, _compilation, _context, { _env })=>{
|
|
8676
8712
|
object.env = _env;
|
|
@@ -10395,7 +10431,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
|
|
|
10395
10431
|
});
|
|
10396
10432
|
}
|
|
10397
10433
|
}
|
|
10398
|
-
let CORE_VERSION = "1.7.
|
|
10434
|
+
let CORE_VERSION = "1.7.3", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
|
|
10399
10435
|
|
|
10400
10436
|
Help:
|
|
10401
10437
|
Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
|
|
@@ -10943,11 +10979,13 @@ Help:
|
|
|
10943
10979
|
destructuring: !!environment.destructuring,
|
|
10944
10980
|
document: !!environment.document,
|
|
10945
10981
|
dynamicImport: !!environment.dynamicImport,
|
|
10982
|
+
dynamicImportInWorker: !!environment.dynamicImportInWorker,
|
|
10946
10983
|
forOf: !!environment.forOf,
|
|
10947
10984
|
globalThis: !!environment.globalThis,
|
|
10948
10985
|
module: !!environment.module,
|
|
10949
10986
|
optionalChaining: !!environment.optionalChaining,
|
|
10950
|
-
templateLiteral: !!environment.templateLiteral
|
|
10987
|
+
templateLiteral: !!environment.templateLiteral,
|
|
10988
|
+
importMetaDirnameAndFilename: !!environment.importMetaDirnameAndFilename
|
|
10951
10989
|
};
|
|
10952
10990
|
}(output.environment)
|
|
10953
10991
|
},
|
|
@@ -11048,14 +11086,14 @@ Help:
|
|
|
11048
11086
|
return getCompiler1().hooks.make;
|
|
11049
11087
|
}, function(queried) {
|
|
11050
11088
|
return async function() {
|
|
11051
|
-
return
|
|
11089
|
+
return queried.promise(getCompiler1().__internal__get_compilation());
|
|
11052
11090
|
};
|
|
11053
11091
|
}),
|
|
11054
11092
|
registerCompilerFinishMakeTaps: createTap1(binding_default().RegisterJsTapKind.CompilerFinishMake, function() {
|
|
11055
11093
|
return getCompiler1().hooks.finishMake;
|
|
11056
11094
|
}, function(queried) {
|
|
11057
11095
|
return async function() {
|
|
11058
|
-
return
|
|
11096
|
+
return queried.promise(getCompiler1().__internal__get_compilation());
|
|
11059
11097
|
};
|
|
11060
11098
|
}),
|
|
11061
11099
|
registerCompilerShouldEmitTaps: createTap1(binding_default().RegisterJsTapKind.CompilerShouldEmit, function() {
|
|
@@ -11069,14 +11107,14 @@ Help:
|
|
|
11069
11107
|
return getCompiler1().hooks.emit;
|
|
11070
11108
|
}, function(queried) {
|
|
11071
11109
|
return async function() {
|
|
11072
|
-
return
|
|
11110
|
+
return queried.promise(getCompiler1().__internal__get_compilation());
|
|
11073
11111
|
};
|
|
11074
11112
|
}),
|
|
11075
11113
|
registerCompilerAfterEmitTaps: createTap1(binding_default().RegisterJsTapKind.CompilerAfterEmit, function() {
|
|
11076
11114
|
return getCompiler1().hooks.afterEmit;
|
|
11077
11115
|
}, function(queried) {
|
|
11078
11116
|
return async function() {
|
|
11079
|
-
return
|
|
11117
|
+
return queried.promise(getCompiler1().__internal__get_compilation());
|
|
11080
11118
|
};
|
|
11081
11119
|
}),
|
|
11082
11120
|
registerCompilerAssetEmittedTaps: createTap1(binding_default().RegisterJsTapKind.CompilerAssetEmitted, function() {
|
|
@@ -11129,8 +11167,39 @@ Help:
|
|
|
11129
11167
|
return getCompiler2().__internal__get_compilation().hooks.runtimeModule;
|
|
11130
11168
|
}, function(queried) {
|
|
11131
11169
|
return function({ module: module1, chunk }) {
|
|
11170
|
+
var module2;
|
|
11171
|
+
let runtimeModule = new ({
|
|
11172
|
+
[(module2 = module1).constructorName]: class extends RuntimeModule {
|
|
11173
|
+
_source;
|
|
11174
|
+
constructor(){
|
|
11175
|
+
super(module2.name, module2.stage), this._source = module2.source;
|
|
11176
|
+
}
|
|
11177
|
+
get constructorName() {
|
|
11178
|
+
return module2.constructorName;
|
|
11179
|
+
}
|
|
11180
|
+
get moduleIdentifier() {
|
|
11181
|
+
return module2.moduleIdentifier;
|
|
11182
|
+
}
|
|
11183
|
+
get source() {
|
|
11184
|
+
return this._source;
|
|
11185
|
+
}
|
|
11186
|
+
identifier() {
|
|
11187
|
+
return module2.moduleIdentifier;
|
|
11188
|
+
}
|
|
11189
|
+
readableIdentifier() {
|
|
11190
|
+
return module2.moduleIdentifier;
|
|
11191
|
+
}
|
|
11192
|
+
shouldIsolate() {
|
|
11193
|
+
return module2.isolate;
|
|
11194
|
+
}
|
|
11195
|
+
generate() {
|
|
11196
|
+
return this._source?.source.toString('utf-8') || '';
|
|
11197
|
+
}
|
|
11198
|
+
}
|
|
11199
|
+
})[module2.constructorName](), compilation = getCompiler2().__internal__get_compilation();
|
|
11200
|
+
runtimeModule.attach(compilation, chunk, compilation.chunkGraph);
|
|
11132
11201
|
let originSource = module1.source?.source;
|
|
11133
|
-
queried.call(
|
|
11202
|
+
queried.call(runtimeModule, chunk);
|
|
11134
11203
|
let newSource = module1.source?.source;
|
|
11135
11204
|
if (newSource && newSource !== originSource) return module1;
|
|
11136
11205
|
};
|
|
@@ -11205,7 +11274,7 @@ Help:
|
|
|
11205
11274
|
return getCompiler2().__internal__get_compilation().hooks.finishModules;
|
|
11206
11275
|
}, function(queried) {
|
|
11207
11276
|
return async function() {
|
|
11208
|
-
return
|
|
11277
|
+
return queried.promise(getCompiler2().__internal__get_compilation().modules);
|
|
11209
11278
|
};
|
|
11210
11279
|
}),
|
|
11211
11280
|
registerCompilationOptimizeModulesTaps: createTap2(binding_default().RegisterJsTapKind.CompilationOptimizeModules, function() {
|
|
@@ -11226,14 +11295,14 @@ Help:
|
|
|
11226
11295
|
return getCompiler2().__internal__get_compilation().hooks.optimizeTree;
|
|
11227
11296
|
}, function(queried) {
|
|
11228
11297
|
return async function() {
|
|
11229
|
-
return
|
|
11298
|
+
return queried.promise(getCompiler2().__internal__get_compilation().chunks, getCompiler2().__internal__get_compilation().modules);
|
|
11230
11299
|
};
|
|
11231
11300
|
}),
|
|
11232
11301
|
registerCompilationOptimizeChunkModulesTaps: createTap2(binding_default().RegisterJsTapKind.CompilationOptimizeChunkModules, function() {
|
|
11233
11302
|
return getCompiler2().__internal__get_compilation().hooks.optimizeChunkModules;
|
|
11234
11303
|
}, function(queried) {
|
|
11235
11304
|
return async function() {
|
|
11236
|
-
return
|
|
11305
|
+
return queried.promise(getCompiler2().__internal__get_compilation().chunks, getCompiler2().__internal__get_compilation().modules);
|
|
11237
11306
|
};
|
|
11238
11307
|
}),
|
|
11239
11308
|
registerCompilationChunkHashTaps: createTap2(binding_default().RegisterJsTapKind.CompilationChunkHash, function() {
|
|
@@ -11257,7 +11326,7 @@ Help:
|
|
|
11257
11326
|
return getCompiler2().__internal__get_compilation().hooks.processAssets;
|
|
11258
11327
|
}, function(queried) {
|
|
11259
11328
|
return async function() {
|
|
11260
|
-
return
|
|
11329
|
+
return queried.promise(getCompiler2().__internal__get_compilation().assets);
|
|
11261
11330
|
};
|
|
11262
11331
|
}),
|
|
11263
11332
|
registerCompilationAfterProcessAssetsTaps: createTap2(binding_default().RegisterJsTapKind.CompilationAfterProcessAssets, function() {
|
|
@@ -11278,7 +11347,7 @@ Help:
|
|
|
11278
11347
|
return getCompiler2().__internal__get_compilation().hooks.afterSeal;
|
|
11279
11348
|
}, function(queried) {
|
|
11280
11349
|
return async function() {
|
|
11281
|
-
return
|
|
11350
|
+
return queried.promise();
|
|
11282
11351
|
};
|
|
11283
11352
|
})
|
|
11284
11353
|
}),
|
|
@@ -11487,35 +11556,35 @@ Help:
|
|
|
11487
11556
|
return RsdoctorPluginImpl.getCompilationHooks(getCompiler7().__internal__get_compilation()).moduleGraph;
|
|
11488
11557
|
}, function(queried) {
|
|
11489
11558
|
return async function(data) {
|
|
11490
|
-
return
|
|
11559
|
+
return queried.promise(data);
|
|
11491
11560
|
};
|
|
11492
11561
|
}),
|
|
11493
11562
|
registerRsdoctorPluginChunkGraphTaps: createTap6(binding_.RegisterJsTapKind.RsdoctorPluginChunkGraph, function() {
|
|
11494
11563
|
return RsdoctorPluginImpl.getCompilationHooks(getCompiler7().__internal__get_compilation()).chunkGraph;
|
|
11495
11564
|
}, function(queried) {
|
|
11496
11565
|
return async function(data) {
|
|
11497
|
-
return
|
|
11566
|
+
return queried.promise(data);
|
|
11498
11567
|
};
|
|
11499
11568
|
}),
|
|
11500
11569
|
registerRsdoctorPluginModuleIdsTaps: createTap6(binding_.RegisterJsTapKind.RsdoctorPluginModuleIds, function() {
|
|
11501
11570
|
return RsdoctorPluginImpl.getCompilationHooks(getCompiler7().__internal__get_compilation()).moduleIds;
|
|
11502
11571
|
}, function(queried) {
|
|
11503
11572
|
return async function(data) {
|
|
11504
|
-
return
|
|
11573
|
+
return queried.promise(data);
|
|
11505
11574
|
};
|
|
11506
11575
|
}),
|
|
11507
11576
|
registerRsdoctorPluginModuleSourcesTaps: createTap6(binding_.RegisterJsTapKind.RsdoctorPluginModuleSources, function() {
|
|
11508
11577
|
return RsdoctorPluginImpl.getCompilationHooks(getCompiler7().__internal__get_compilation()).moduleSources;
|
|
11509
11578
|
}, function(queried) {
|
|
11510
11579
|
return async function(data) {
|
|
11511
|
-
return
|
|
11580
|
+
return queried.promise(data);
|
|
11512
11581
|
};
|
|
11513
11582
|
}),
|
|
11514
11583
|
registerRsdoctorPluginAssetsTaps: createTap6(binding_.RegisterJsTapKind.RsdoctorPluginAssets, function() {
|
|
11515
11584
|
return RsdoctorPluginImpl.getCompilationHooks(getCompiler7().__internal__get_compilation()).assets;
|
|
11516
11585
|
}, function(queried) {
|
|
11517
11586
|
return async function(data) {
|
|
11518
|
-
return
|
|
11587
|
+
return queried.promise(data);
|
|
11519
11588
|
};
|
|
11520
11589
|
})
|
|
11521
11590
|
})
|
|
@@ -12156,7 +12225,7 @@ Help:
|
|
|
12156
12225
|
let _options = JSON.stringify(options || {});
|
|
12157
12226
|
return binding_default().transform(source, _options);
|
|
12158
12227
|
}
|
|
12159
|
-
let exports_rspackVersion = "1.7.
|
|
12228
|
+
let exports_rspackVersion = "1.7.3", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
|
|
12160
12229
|
getNormalizedRspackOptions: getNormalizedRspackOptions,
|
|
12161
12230
|
applyRspackOptionsDefaults: applyRspackOptionsDefaults,
|
|
12162
12231
|
getNormalizedWebpackOptions: getNormalizedRspackOptions,
|
|
@@ -12356,7 +12425,7 @@ Help:
|
|
|
12356
12425
|
await JavaScriptTracer.initJavaScriptTrace(layer, output), (0, binding_.registerGlobalTrace)(filter, layer, output), JavaScriptTracer.initCpuProfiler();
|
|
12357
12426
|
},
|
|
12358
12427
|
async cleanup () {
|
|
12359
|
-
await JavaScriptTracer.cleanupJavaScriptTrace(),
|
|
12428
|
+
await JavaScriptTracer.cleanupJavaScriptTrace(), (0, binding_.syncTraceEvent)(JavaScriptTracer.events), (0, binding_.cleanupGlobalTrace)();
|
|
12360
12429
|
}
|
|
12361
12430
|
},
|
|
12362
12431
|
RemoveDuplicateModulesPlugin: RemoveDuplicateModulesPlugin,
|
package/dist/worker.js
CHANGED
|
@@ -956,12 +956,12 @@ for(var __rspack_i in (()=>{
|
|
|
956
956
|
}), sendRequest1), waitFor = (sendRequest = sendRequest2, (requests)=>sendRequest.sync("WaitForPendingRequest", (Array.isArray(requests) ? requests : [
|
|
957
957
|
requests
|
|
958
958
|
]).map((request)=>request.id)));
|
|
959
|
-
loaderImpl(workerOptions, sendRequest2, waitFor).then(
|
|
959
|
+
loaderImpl(workerOptions, sendRequest2, waitFor).then((data)=>{
|
|
960
960
|
workerData.workerPort.postMessage({
|
|
961
961
|
type: 'done',
|
|
962
962
|
data
|
|
963
963
|
});
|
|
964
|
-
}).catch(
|
|
964
|
+
}).catch((err)=>{
|
|
965
965
|
workerData.workerPort.postMessage({
|
|
966
966
|
type: 'done-error',
|
|
967
967
|
error: serializeError(err)
|
|
@@ -1,4 +1,79 @@
|
|
|
1
1
|
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
|
|
2
|
+
var compiling = new Set();
|
|
3
|
+
var errorHandlers = new Set();
|
|
4
|
+
|
|
5
|
+
/** @type {import("http").ClientRequest | undefined} */
|
|
6
|
+
var pendingRequest;
|
|
7
|
+
/** @type {boolean} */
|
|
8
|
+
var hasPendingUpdate = false;
|
|
9
|
+
|
|
10
|
+
function sendRequest() {
|
|
11
|
+
if (compiling.size === 0) {
|
|
12
|
+
hasPendingUpdate = false;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var modules = Array.from(compiling);
|
|
17
|
+
var data = modules.join('\n');
|
|
18
|
+
|
|
19
|
+
var httpModule = urlBase.startsWith('https')
|
|
20
|
+
? require('https')
|
|
21
|
+
: require('http');
|
|
22
|
+
|
|
23
|
+
var request = httpModule.request(
|
|
24
|
+
urlBase,
|
|
25
|
+
{
|
|
26
|
+
method: 'POST',
|
|
27
|
+
agent: false,
|
|
28
|
+
headers: {
|
|
29
|
+
'Content-Type': 'text/plain',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
function (res) {
|
|
33
|
+
pendingRequest = undefined;
|
|
34
|
+
if (res.statusCode < 200 || res.statusCode >= 300) {
|
|
35
|
+
var error = new Error(
|
|
36
|
+
'Problem communicating active modules to the server: HTTP ' +
|
|
37
|
+
res.statusCode,
|
|
38
|
+
);
|
|
39
|
+
errorHandlers.forEach(function (onError) {
|
|
40
|
+
onError(error);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// Consume response data to free up memory
|
|
44
|
+
res.resume();
|
|
45
|
+
if (hasPendingUpdate) {
|
|
46
|
+
hasPendingUpdate = false;
|
|
47
|
+
sendRequest();
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
pendingRequest = request;
|
|
53
|
+
|
|
54
|
+
request.on('error', function (err) {
|
|
55
|
+
pendingRequest = undefined;
|
|
56
|
+
var error = new Error(
|
|
57
|
+
'Problem communicating active modules to the server: ' + err.message,
|
|
58
|
+
);
|
|
59
|
+
errorHandlers.forEach(function (onError) {
|
|
60
|
+
onError(error);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
request.write(data);
|
|
65
|
+
request.end();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function sendActiveRequest() {
|
|
69
|
+
hasPendingUpdate = true;
|
|
70
|
+
|
|
71
|
+
// If no request is pending, start one
|
|
72
|
+
if (!pendingRequest) {
|
|
73
|
+
hasPendingUpdate = false;
|
|
74
|
+
sendRequest();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
2
77
|
|
|
3
78
|
/**
|
|
4
79
|
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
|
|
@@ -9,42 +84,23 @@ exports.activate = function (options) {
|
|
|
9
84
|
var onError = options.onError;
|
|
10
85
|
var active = options.active;
|
|
11
86
|
var module = options.module;
|
|
12
|
-
/** @type {import("http").IncomingMessage} */
|
|
13
|
-
var response;
|
|
14
|
-
var request = (
|
|
15
|
-
urlBase.startsWith('https') ? require('https') : require('http')
|
|
16
|
-
).request(
|
|
17
|
-
urlBase + encodeURIComponent(data),
|
|
18
|
-
{
|
|
19
|
-
agent: false,
|
|
20
|
-
headers: { accept: 'text/event-stream' },
|
|
21
|
-
},
|
|
22
|
-
function (res) {
|
|
23
|
-
response = res;
|
|
24
|
-
response.on('error', errorHandler);
|
|
25
|
-
if (!active && !module.hot) {
|
|
26
|
-
console.log(
|
|
27
|
-
'Hot Module Replacement is not enabled. Waiting for process restart...',
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
);
|
|
32
87
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'Problem communicating active modules to the server' +
|
|
39
|
-
(err.message ? ': ' + err.message : '') +
|
|
40
|
-
'\nRequest: ' +
|
|
41
|
-
urlBase +
|
|
42
|
-
data;
|
|
43
|
-
onError(err);
|
|
88
|
+
errorHandlers.add(onError);
|
|
89
|
+
|
|
90
|
+
if (!compiling.has(data)) {
|
|
91
|
+
compiling.add(data);
|
|
92
|
+
sendActiveRequest();
|
|
44
93
|
}
|
|
45
|
-
|
|
46
|
-
|
|
94
|
+
|
|
95
|
+
if (!active && !module.hot) {
|
|
96
|
+
console.log(
|
|
97
|
+
'Hot Module Replacement is not enabled. Waiting for process restart...',
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
47
101
|
return function () {
|
|
48
|
-
|
|
102
|
+
errorHandlers.delete(onError);
|
|
103
|
+
compiling.delete(data);
|
|
104
|
+
sendActiveRequest();
|
|
49
105
|
};
|
|
50
106
|
};
|
|
@@ -1,47 +1,73 @@
|
|
|
1
|
-
if (typeof
|
|
1
|
+
if (typeof XMLHttpRequest === 'undefined') {
|
|
2
2
|
throw new Error(
|
|
3
|
-
"Environment doesn't support lazy compilation (requires
|
|
3
|
+
"Environment doesn't support lazy compilation (requires XMLHttpRequest)",
|
|
4
4
|
);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
|
|
8
|
-
/** @type {EventSource | undefined} */
|
|
9
|
-
var activeEventSource;
|
|
10
8
|
var compiling = new Set();
|
|
11
9
|
var errorHandlers = new Set();
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @this {EventSource}
|
|
24
|
-
* @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
|
|
25
|
-
*/
|
|
26
|
-
activeEventSource.onerror = function (event) {
|
|
27
|
-
errorHandlers.forEach(function (onError) {
|
|
28
|
-
onError(
|
|
29
|
-
new Error(
|
|
30
|
-
'Problem communicating active modules to the server' +
|
|
31
|
-
(event.message ? `: ${event.message} ` : '') +
|
|
32
|
-
(event.filename ? `: ${event.filename} ` : '') +
|
|
33
|
-
(event.lineno ? `: ${event.lineno} ` : '') +
|
|
34
|
-
(event.colno ? `: ${event.colno} ` : '') +
|
|
35
|
-
(event.error ? `: ${event.error}` : ''),
|
|
36
|
-
),
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
} else {
|
|
41
|
-
activeEventSource = undefined;
|
|
11
|
+
/** @type {XMLHttpRequest | undefined} */
|
|
12
|
+
var pendingXhr;
|
|
13
|
+
/** @type {boolean} */
|
|
14
|
+
var hasPendingUpdate = false;
|
|
15
|
+
|
|
16
|
+
var sendRequest = function sendRequest() {
|
|
17
|
+
if (compiling.size === 0) {
|
|
18
|
+
hasPendingUpdate = false;
|
|
19
|
+
return;
|
|
42
20
|
}
|
|
21
|
+
|
|
22
|
+
var modules = Array.from(compiling);
|
|
23
|
+
var data = modules.join('\n');
|
|
24
|
+
|
|
25
|
+
var xhr = new XMLHttpRequest();
|
|
26
|
+
pendingXhr = xhr;
|
|
27
|
+
xhr.open('POST', urlBase, true);
|
|
28
|
+
// text/plain Content-Type is simple request header
|
|
29
|
+
xhr.setRequestHeader('Content-Type', 'text/plain');
|
|
30
|
+
|
|
31
|
+
xhr.onreadystatechange = function () {
|
|
32
|
+
if (xhr.readyState === 4) {
|
|
33
|
+
pendingXhr = undefined;
|
|
34
|
+
if (xhr.status < 200 || xhr.status >= 300) {
|
|
35
|
+
var error = new Error(
|
|
36
|
+
'Problem communicating active modules to the server: HTTP ' +
|
|
37
|
+
xhr.status,
|
|
38
|
+
);
|
|
39
|
+
errorHandlers.forEach(function (onError) {
|
|
40
|
+
onError(error);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
if (hasPendingUpdate) {
|
|
44
|
+
hasPendingUpdate = false;
|
|
45
|
+
sendRequest();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
xhr.onerror = function () {
|
|
51
|
+
pendingXhr = undefined;
|
|
52
|
+
var error = new Error('Problem communicating active modules to the server');
|
|
53
|
+
errorHandlers.forEach(function (onError) {
|
|
54
|
+
onError(error);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
xhr.send(data);
|
|
43
59
|
};
|
|
44
60
|
|
|
61
|
+
function sendActiveRequest() {
|
|
62
|
+
hasPendingUpdate = true;
|
|
63
|
+
|
|
64
|
+
// If no request is pending, start one
|
|
65
|
+
if (!pendingXhr) {
|
|
66
|
+
hasPendingUpdate = false;
|
|
67
|
+
sendRequest();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
45
71
|
/**
|
|
46
72
|
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
|
|
47
73
|
* @returns {() => void} function to destroy response
|
|
@@ -55,7 +81,7 @@ exports.activate = function (options) {
|
|
|
55
81
|
|
|
56
82
|
if (!compiling.has(data)) {
|
|
57
83
|
compiling.add(data);
|
|
58
|
-
|
|
84
|
+
sendActiveRequest();
|
|
59
85
|
}
|
|
60
86
|
|
|
61
87
|
if (!active && !module.hot) {
|
|
@@ -67,6 +93,6 @@ exports.activate = function (options) {
|
|
|
67
93
|
return function () {
|
|
68
94
|
errorHandlers.delete(onError);
|
|
69
95
|
compiling.delete(data);
|
|
70
|
-
|
|
96
|
+
sendActiveRequest();
|
|
71
97
|
};
|
|
72
98
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
@@ -37,17 +37,17 @@
|
|
|
37
37
|
"directory": "packages/rspack"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@ast-grep/napi": "^0.40.
|
|
40
|
+
"@ast-grep/napi": "^0.40.5",
|
|
41
41
|
"@napi-rs/wasm-runtime": "1.0.7",
|
|
42
42
|
"@rsbuild/plugin-node-polyfill": "^1.4.2",
|
|
43
|
-
"@rslib/core": "0.19.
|
|
43
|
+
"@rslib/core": "0.19.2",
|
|
44
44
|
"@swc/types": "0.1.25",
|
|
45
|
-
"@types/node": "^20.19.
|
|
45
|
+
"@types/node": "^20.19.29",
|
|
46
46
|
"@types/watchpack": "^2.4.5",
|
|
47
47
|
"browserslist-load-config": "^1.0.1",
|
|
48
48
|
"enhanced-resolve": "5.18.4",
|
|
49
49
|
"glob-to-regexp": "^0.4.1",
|
|
50
|
-
"memfs": "4.
|
|
50
|
+
"memfs": "4.53.0",
|
|
51
51
|
"prebundle": "^1.6.0",
|
|
52
52
|
"tinypool": "^1.1.1",
|
|
53
53
|
"tsx": "^4.21.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@module-federation/runtime-tools": "0.22.0",
|
|
60
60
|
"@rspack/lite-tapable": "1.1.0",
|
|
61
|
-
"@rspack/binding": "1.7.
|
|
61
|
+
"@rspack/binding": "1.7.3"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@swc/helpers": ">=0.5.1"
|