@rspack/core 1.4.11 → 1.5.0-beta.1
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/Compiler.d.ts +5 -0
- package/dist/Module.d.ts +3 -14
- package/dist/NativeWatchFileSystem.d.ts +3 -1
- package/dist/NormalModuleFactory.d.ts +2 -2
- package/dist/Resolver.d.ts +0 -6
- package/dist/ResolverFactory.d.ts +8 -5
- package/dist/VirtualModulesPlugin.d.ts +12 -0
- package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NormalModuleReplacementPlugin.d.ts +10 -0
- package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RsdoctorPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RslibPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RstestPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +2 -2
- package/dist/builtin-plugin/html-plugin/plugin.d.ts +1 -1
- package/dist/builtin-plugin/index.d.ts +1 -0
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
- package/dist/config/normalization.d.ts +7 -0
- package/dist/config/types.d.ts +20 -4
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/exports.d.ts +11 -3
- package/dist/index.js +298 -256
- package/dist/loader-runner/loadLoader.d.ts +2 -1
- package/dist/loader-runner/utils.d.ts +2 -1
- package/dist/schema/config.d.ts +60 -47
- package/dist/schema/loaders.d.ts +5 -5
- package/dist/schema/plugins.d.ts +10 -10
- package/dist/util/bindingVersionCheck.d.ts +1 -1
- package/dist/util/require.d.ts +3 -0
- package/dist/worker.js +93 -59
- package/module.d.ts +9 -10
- package/package.json +11 -9
- package/dist/lib/NormalModuleReplacementPlugin.d.ts +0 -29
package/dist/worker.js
CHANGED
@@ -1,8 +1,33 @@
|
|
1
1
|
"use strict";
|
2
2
|
var __webpack_modules__ = {
|
3
|
+
"./src/swc.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
4
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
5
|
+
minify: ()=>minify,
|
6
|
+
minifySync: ()=>minifySync,
|
7
|
+
transform: ()=>transform,
|
8
|
+
transformSync: ()=>transformSync
|
9
|
+
});
|
10
|
+
var _rspack_binding__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rspack/binding"), _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_rspack_binding__WEBPACK_IMPORTED_MODULE_0__);
|
11
|
+
async function minify(source, options) {
|
12
|
+
let _options = JSON.stringify(options || {});
|
13
|
+
return _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default().minify(source, _options);
|
14
|
+
}
|
15
|
+
function minifySync(source, options) {
|
16
|
+
let _options = JSON.stringify(options || {});
|
17
|
+
return _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default().minifySync(source, _options);
|
18
|
+
}
|
19
|
+
async function transform(source, options) {
|
20
|
+
let _options = JSON.stringify(options || {});
|
21
|
+
return _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default().transform(source, _options);
|
22
|
+
}
|
23
|
+
function transformSync(source, options) {
|
24
|
+
let _options = JSON.stringify(options || {});
|
25
|
+
return _rspack_binding__WEBPACK_IMPORTED_MODULE_0___default().transformSync(source, _options);
|
26
|
+
}
|
27
|
+
},
|
3
28
|
"./src/util/cleverMerge.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
4
29
|
__webpack_require__.d(__webpack_exports__, {
|
5
|
-
|
30
|
+
ks: ()=>cleverMerge
|
6
31
|
});
|
7
32
|
let DYNAMIC_INFO = Symbol("cleverMerge dynamic info"), mergeCache = new WeakMap(), DELETE = Symbol("DELETE"), cachedCleverMerge = (first, second)=>{
|
8
33
|
if (void 0 === second) return first;
|
@@ -181,7 +206,7 @@ var __webpack_modules__ = {
|
|
181
206
|
"./src/util/createHash.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
182
207
|
let createMd4, createXxhash64;
|
183
208
|
__webpack_require__.d(__webpack_exports__, {
|
184
|
-
|
209
|
+
n: ()=>createHash
|
185
210
|
});
|
186
211
|
let external_node_crypto_namespaceObject = require("node:crypto");
|
187
212
|
var external_node_crypto_default = __webpack_require__.n(external_node_crypto_namespaceObject), external_node_util_ = __webpack_require__("node:util");
|
@@ -386,6 +411,9 @@ var __webpack_modules__ = {
|
|
386
411
|
}
|
387
412
|
};
|
388
413
|
},
|
414
|
+
"@rspack/binding": function(module) {
|
415
|
+
module.exports = require("@rspack/binding");
|
416
|
+
},
|
389
417
|
"node:fs": function(module) {
|
390
418
|
module.exports = require("node:fs");
|
391
419
|
},
|
@@ -436,9 +464,9 @@ for(var __webpack_i__ in (()=>{
|
|
436
464
|
default: ()=>loader_runner_worker
|
437
465
|
});
|
438
466
|
let external_node_querystring_namespaceObject = require("node:querystring");
|
439
|
-
var
|
440
|
-
let external_node_worker_threads_namespaceObject = require("node:worker_threads")
|
441
|
-
var createHash = __webpack_require__("./src/util/createHash.ts");
|
467
|
+
var external_node_querystring_default = __webpack_require__.n(external_node_querystring_namespaceObject), external_node_util_ = __webpack_require__("node:util");
|
468
|
+
let external_node_worker_threads_namespaceObject = require("node:worker_threads");
|
469
|
+
var binding_ = __webpack_require__("@rspack/binding"), createHash = __webpack_require__("./src/util/createHash.ts");
|
442
470
|
let external_node_path_namespaceObject = require("node:path");
|
443
471
|
var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject);
|
444
472
|
let WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>"" === relativePath ? "./." : ".." === relativePath ? "../." : relativePath.startsWith("../") ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
|
@@ -531,12 +559,14 @@ for(var __webpack_i__ in (()=>{
|
|
531
559
|
let memoize = (fn)=>{
|
532
560
|
let result, cache = !1, callback = fn;
|
533
561
|
return ()=>(cache || (result = callback(), cache = !0, callback = void 0), result);
|
534
|
-
}
|
562
|
+
};
|
563
|
+
__webpack_require__("node:fs");
|
564
|
+
let LoaderLoadingError = class extends Error {
|
535
565
|
constructor(message){
|
536
566
|
super(message), this.name = "LoaderRunnerError", Error.captureStackTrace(this, this.constructor);
|
537
567
|
}
|
538
568
|
};
|
539
|
-
function loadLoader(loader, callback) {
|
569
|
+
function loadLoader(loader, compiler, callback) {
|
540
570
|
if ("module" === loader.type) try {
|
541
571
|
void 0 === url && (url = __webpack_require__("node:url")), import(url.pathToFileURL(loader.path).toString()).then((module)=>{
|
542
572
|
handleResult(loader, module, callback);
|
@@ -550,7 +580,7 @@ for(var __webpack_i__ in (()=>{
|
|
550
580
|
try {
|
551
581
|
module = require(loader.path);
|
552
582
|
} catch (e) {
|
553
|
-
if (e instanceof Error && "EMFILE" === e.code) return void setImmediate(loadLoader.bind(null, loader, callback));
|
583
|
+
if (e instanceof Error && "EMFILE" === e.code) return void setImmediate(loadLoader.bind(null, loader, compiler, callback));
|
554
584
|
return callback(e);
|
555
585
|
}
|
556
586
|
return handleResult(loader, module, callback);
|
@@ -562,7 +592,6 @@ for(var __webpack_i__ in (()=>{
|
|
562
592
|
function isWorkerResponseMessage(message) {
|
563
593
|
return "response" === message.type;
|
564
594
|
}
|
565
|
-
var service_RequestType = ((RequestType = {}).AddDependency = "AddDependency", RequestType.AddContextDependency = "AddContextDependency", RequestType.AddMissingDependency = "AddMissingDependency", RequestType.AddBuildDependency = "AddBuildDependency", RequestType.GetDependencies = "GetDependencies", RequestType.GetContextDependencies = "GetContextDependencies", RequestType.GetMissingDependencies = "GetMissingDependencies", RequestType.ClearDependencies = "ClearDependencies", RequestType.Resolve = "Resolve", RequestType.GetResolve = "GetResolve", RequestType.GetLogger = "GetLogger", RequestType.EmitError = "EmitError", RequestType.EmitWarning = "EmitWarning", RequestType.EmitFile = "EmitFile", RequestType.EmitDiagnostic = "EmitDiagnostic", RequestType.SetCacheable = "SetCacheable", RequestType.ImportModule = "ImportModule", RequestType.UpdateLoaderObjects = "UpdateLoaderObjects", RequestType.CompilationGetPath = "CompilationGetPath", RequestType.CompilationGetPathWithInfo = "CompilationGetPathWithInfo", RequestType.CompilationGetAssetPath = "CompilationGetAssetPath", RequestType.CompilationGetAssetPathWithInfo = "CompilationGetAssetPathWithInfo", RequestType), service_RequestSyncType = ((RequestSyncType = {}).WaitForPendingRequest = "WaitForPendingRequest", RequestSyncType);
|
566
595
|
function serializeError(error) {
|
567
596
|
if (error instanceof Error || error && "object" == typeof error && "message" in error) return {
|
568
597
|
...error,
|
@@ -627,21 +656,21 @@ for(var __webpack_i__ in (()=>{
|
|
627
656
|
return idx < 0 ? path : idx === idx2 ? path.slice(0, idx + 1) : path.slice(0, idx);
|
628
657
|
}(resourcePath) : null, pendingDependencyRequest = [];
|
629
658
|
loaderContext.parallel = !0, loaderContext.dependency = loaderContext.addDependency = function(file) {
|
630
|
-
pendingDependencyRequest.push(sendRequest(
|
659
|
+
pendingDependencyRequest.push(sendRequest("AddDependency", file));
|
631
660
|
}, loaderContext.addContextDependency = function(context) {
|
632
|
-
pendingDependencyRequest.push(sendRequest(
|
661
|
+
pendingDependencyRequest.push(sendRequest("AddContextDependency", context));
|
633
662
|
}, loaderContext.addBuildDependency = function(file) {
|
634
|
-
pendingDependencyRequest.push(sendRequest(
|
663
|
+
pendingDependencyRequest.push(sendRequest("AddBuildDependency", file));
|
635
664
|
}, loaderContext.getDependencies = function() {
|
636
|
-
return waitForPendingRequest(pendingDependencyRequest), sendRequest(
|
665
|
+
return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetDependencies").wait();
|
637
666
|
}, loaderContext.getContextDependencies = function() {
|
638
|
-
return waitForPendingRequest(pendingDependencyRequest), sendRequest(
|
667
|
+
return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetContextDependencies").wait();
|
639
668
|
}, loaderContext.getMissingDependencies = function() {
|
640
|
-
return waitForPendingRequest(pendingDependencyRequest), sendRequest(
|
669
|
+
return waitForPendingRequest(pendingDependencyRequest), sendRequest("GetMissingDependencies").wait();
|
641
670
|
}, loaderContext.clearDependencies = function() {
|
642
|
-
pendingDependencyRequest.push(sendRequest(
|
671
|
+
pendingDependencyRequest.push(sendRequest("ClearDependencies"));
|
643
672
|
}, loaderContext.resolve = function(context, request, callback) {
|
644
|
-
sendRequest(
|
673
|
+
sendRequest("Resolve", context, request).then((result)=>{
|
645
674
|
callback(null, result);
|
646
675
|
}, (err)=>{
|
647
676
|
callback(err);
|
@@ -649,13 +678,13 @@ for(var __webpack_i__ in (()=>{
|
|
649
678
|
}, loaderContext.getResolve = function(options) {
|
650
679
|
return (context, request, callback)=>{
|
651
680
|
if (!callback) return new Promise((resolve, reject)=>{
|
652
|
-
sendRequest(
|
681
|
+
sendRequest("GetResolve", options, context, request).then((result)=>{
|
653
682
|
resolve(result);
|
654
683
|
}, (err)=>{
|
655
684
|
reject(err);
|
656
685
|
});
|
657
686
|
});
|
658
|
-
sendRequest(
|
687
|
+
sendRequest("GetResolve", options, context, request).then((result)=>{
|
659
688
|
callback(null, result);
|
660
689
|
}, (err)=>{
|
661
690
|
callback(err);
|
@@ -664,110 +693,115 @@ for(var __webpack_i__ in (()=>{
|
|
664
693
|
}, loaderContext.getLogger = function(name) {
|
665
694
|
return {
|
666
695
|
error (...args) {
|
667
|
-
sendRequest(
|
696
|
+
sendRequest("GetLogger", "error", name, args);
|
668
697
|
},
|
669
698
|
warn (...args) {
|
670
|
-
sendRequest(
|
699
|
+
sendRequest("GetLogger", "warn", name, args);
|
671
700
|
},
|
672
701
|
info (...args) {
|
673
|
-
sendRequest(
|
702
|
+
sendRequest("GetLogger", "info", name, args);
|
674
703
|
},
|
675
704
|
log (...args) {
|
676
|
-
sendRequest(
|
705
|
+
sendRequest("GetLogger", "log", name, args);
|
677
706
|
},
|
678
707
|
debug (...args) {
|
679
|
-
sendRequest(
|
708
|
+
sendRequest("GetLogger", "debug", name, args);
|
680
709
|
},
|
681
710
|
assert (assertion, ...args) {
|
682
|
-
assertion || sendRequest(
|
711
|
+
assertion || sendRequest("GetLogger", "error", name, args);
|
683
712
|
},
|
684
713
|
trace () {
|
685
|
-
sendRequest(
|
714
|
+
sendRequest("GetLogger", "trace", name, [
|
686
715
|
"Trace"
|
687
716
|
]);
|
688
717
|
},
|
689
718
|
clear () {
|
690
|
-
sendRequest(
|
719
|
+
sendRequest("GetLogger", "clear", name);
|
691
720
|
},
|
692
721
|
status (...args) {
|
693
|
-
sendRequest(
|
722
|
+
sendRequest("GetLogger", "status", name, args);
|
694
723
|
},
|
695
724
|
group (...args) {
|
696
|
-
sendRequest(
|
725
|
+
sendRequest("GetLogger", "group", name, args);
|
697
726
|
},
|
698
727
|
groupCollapsed (...args) {
|
699
|
-
sendRequest(
|
728
|
+
sendRequest("GetLogger", "groupCollapsed", name, args);
|
700
729
|
},
|
701
730
|
groupEnd (...args) {
|
702
|
-
sendRequest(
|
731
|
+
sendRequest("GetLogger", "groupEnd", name, args);
|
703
732
|
},
|
704
733
|
profile (label) {
|
705
|
-
sendRequest(
|
734
|
+
sendRequest("GetLogger", "profile", name, [
|
706
735
|
label
|
707
736
|
]);
|
708
737
|
},
|
709
738
|
profileEnd (label) {
|
710
|
-
sendRequest(
|
739
|
+
sendRequest("GetLogger", "profileEnd", name, [
|
711
740
|
label
|
712
741
|
]);
|
713
742
|
},
|
714
743
|
time (label) {
|
715
|
-
sendRequest(
|
744
|
+
sendRequest("GetLogger", "time", name, [
|
716
745
|
label
|
717
746
|
]);
|
718
747
|
},
|
719
748
|
timeEnd (label) {
|
720
|
-
sendRequest(
|
749
|
+
sendRequest("GetLogger", "timeEnd", name, [
|
721
750
|
label
|
722
751
|
]);
|
723
752
|
},
|
724
753
|
timeLog (label, ...args) {
|
725
|
-
sendRequest(
|
754
|
+
sendRequest("GetLogger", "timeLog", name, [
|
726
755
|
label,
|
727
756
|
...args
|
728
757
|
]);
|
729
758
|
},
|
730
759
|
timeAggregate (label) {
|
731
|
-
sendRequest(
|
760
|
+
sendRequest("GetLogger", "timeAggregate", name, [
|
732
761
|
label
|
733
762
|
]);
|
734
763
|
},
|
735
764
|
timeAggregateEnd (label) {
|
736
|
-
sendRequest(
|
765
|
+
sendRequest("GetLogger", "timeAggregateEnd", name, [
|
737
766
|
label
|
738
767
|
]);
|
739
768
|
}
|
740
769
|
};
|
741
770
|
}, loaderContext.emitError = function(err) {
|
742
|
-
sendRequest(
|
771
|
+
sendRequest("EmitError", serializeError(err));
|
743
772
|
}, loaderContext.emitWarning = function(warning) {
|
744
|
-
sendRequest(
|
773
|
+
sendRequest("EmitWarning", serializeError(warning));
|
745
774
|
}, loaderContext.emitFile = function(name, content, sourceMap, assetInfo) {
|
746
|
-
sendRequest(
|
775
|
+
sendRequest("EmitFile", name, content, sourceMap, assetInfo);
|
747
776
|
}, loaderContext.experiments = {
|
748
777
|
emitDiagnostic (diagnostic) {
|
749
|
-
sendRequest(
|
778
|
+
sendRequest("EmitDiagnostic", diagnostic);
|
750
779
|
}
|
751
780
|
};
|
752
781
|
let getAbsolutify = memoize(()=>absolutify.bindCache({})), getAbsolutifyInContext = memoize(()=>absolutify.bindContextCache(contextDirectory, {})), getContextify = memoize(()=>contextify.bindCache({})), getContextifyInContext = memoize(()=>contextify.bindContextCache(contextDirectory, {}));
|
753
782
|
loaderContext.utils = {
|
754
783
|
absolutify: (context, request)=>context === contextDirectory ? getAbsolutifyInContext()(request) : getAbsolutify()(context, request),
|
755
784
|
contextify: (context, request)=>context === contextDirectory ? getContextifyInContext()(request) : getContextify()(context, request),
|
756
|
-
createHash: (type)=>(0, createHash.
|
785
|
+
createHash: (type)=>(0, createHash.n)(type || loaderContext._compilation.outputOptions.hashFunction)
|
757
786
|
}, loaderContext._compiler = {
|
758
787
|
...loaderContext._compiler,
|
788
|
+
rspack: {
|
789
|
+
experiments: {
|
790
|
+
swc: __webpack_require__("./src/swc.ts")
|
791
|
+
}
|
792
|
+
},
|
759
793
|
webpack: {
|
760
794
|
util: {
|
761
|
-
createHash: __webpack_require__("./src/util/createHash.ts").
|
762
|
-
cleverMerge: __webpack_require__("./src/util/cleverMerge.ts").
|
795
|
+
createHash: __webpack_require__("./src/util/createHash.ts").n,
|
796
|
+
cleverMerge: __webpack_require__("./src/util/cleverMerge.ts").ks
|
763
797
|
}
|
764
798
|
}
|
765
799
|
}, loaderContext._compilation = {
|
766
800
|
...loaderContext._compilation,
|
767
|
-
getPath: (filename, data)=>sendRequest(
|
768
|
-
getPathWithInfo: (filename, data)=>sendRequest(
|
769
|
-
getAssetPath: (filename, data)=>sendRequest(
|
770
|
-
getAssetPathWithInfo: (filename, data)=>sendRequest(
|
801
|
+
getPath: (filename, data)=>sendRequest("CompilationGetPath", filename, data).wait(),
|
802
|
+
getPathWithInfo: (filename, data)=>sendRequest("CompilationGetPathWithInfo", filename, data).wait(),
|
803
|
+
getAssetPath: (filename, data)=>sendRequest("CompilationGetAssetPath", filename, data).wait(),
|
804
|
+
getAssetPathWithInfo: (filename, data)=>sendRequest("CompilationGetAssetPathWithInfo", filename, data).wait()
|
771
805
|
};
|
772
806
|
let _module = loaderContext._module;
|
773
807
|
loaderContext._module = {
|
@@ -779,13 +813,13 @@ for(var __webpack_i__ in (()=>{
|
|
779
813
|
rawRequest: _module.rawRequest
|
780
814
|
}, loaderContext.importModule = function(request, options, callback) {
|
781
815
|
if (!callback) return new Promise((resolve, reject)=>{
|
782
|
-
sendRequest(
|
816
|
+
sendRequest("ImportModule", request, options).then((result)=>{
|
783
817
|
resolve(result);
|
784
818
|
}, (err)=>{
|
785
819
|
reject(err);
|
786
820
|
});
|
787
821
|
});
|
788
|
-
sendRequest(
|
822
|
+
sendRequest("ImportModule", request, options).then((result)=>{
|
789
823
|
callback(null, result);
|
790
824
|
}, (err)=>{
|
791
825
|
callback(err);
|
@@ -820,7 +854,7 @@ for(var __webpack_i__ in (()=>{
|
|
820
854
|
else options = external_node_querystring_default().parse(options);
|
821
855
|
return null == options && (options = {}), options;
|
822
856
|
}, loaderContext.cacheable = function(flag) {
|
823
|
-
!1 === flag && sendRequest(
|
857
|
+
!1 === flag && sendRequest("SetCacheable", !1);
|
824
858
|
}, Object.defineProperty(loaderContext, "data", {
|
825
859
|
enumerable: !0,
|
826
860
|
get: ()=>loaderContext.loaders[loaderContext.loaderIndex].loaderItem.data,
|
@@ -830,7 +864,7 @@ for(var __webpack_i__ in (()=>{
|
|
830
864
|
});
|
831
865
|
let shouldYieldToMainThread = (currentLoaderObject)=>!!(!currentLoaderObject?.parallel || currentLoaderObject?.request.startsWith("builtin:"));
|
832
866
|
switch(loaderState){
|
833
|
-
case
|
867
|
+
case binding_.JsLoaderState.Pitching:
|
834
868
|
for(; loaderContext.loaderIndex < loaderContext.loaders.length;){
|
835
869
|
let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
|
836
870
|
if (shouldYieldToMainThread(currentLoaderObject)) break;
|
@@ -838,7 +872,7 @@ for(var __webpack_i__ in (()=>{
|
|
838
872
|
loaderContext.loaderIndex += 1;
|
839
873
|
continue;
|
840
874
|
}
|
841
|
-
await loadLoaderAsync(currentLoaderObject);
|
875
|
+
await loadLoaderAsync(currentLoaderObject, loaderContext._compiler);
|
842
876
|
let fn = currentLoaderObject.pitch;
|
843
877
|
if ((currentLoaderObject.pitchExecuted = !0, fn) && (args = await utils_runSyncOrAsync(fn, loaderContext, [
|
844
878
|
loaderContext.remainingRequest,
|
@@ -846,7 +880,7 @@ for(var __webpack_i__ in (()=>{
|
|
846
880
|
currentLoaderObject.loaderItem.data
|
847
881
|
]) || []).some((value)=>void 0 !== value)) break;
|
848
882
|
}
|
849
|
-
case
|
883
|
+
case binding_.JsLoaderState.Normal:
|
850
884
|
for(; loaderContext.loaderIndex >= 0;){
|
851
885
|
var args1, raw;
|
852
886
|
let currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
|
@@ -855,7 +889,7 @@ for(var __webpack_i__ in (()=>{
|
|
855
889
|
loaderContext.loaderIndex--;
|
856
890
|
continue;
|
857
891
|
}
|
858
|
-
await loadLoaderAsync(currentLoaderObject);
|
892
|
+
await loadLoaderAsync(currentLoaderObject, loaderContext._compiler);
|
859
893
|
let fn = currentLoaderObject.normal;
|
860
894
|
currentLoaderObject.normalExecuted = !0, fn && (args1 = args, !(raw = !!currentLoaderObject.raw) && args1[0] instanceof Uint8Array ? args1[0] = function(buf) {
|
861
895
|
let str = decoder.decode(buf.buffer instanceof SharedArrayBuffer ? Buffer.from(buf) : buf);
|
@@ -863,7 +897,7 @@ for(var __webpack_i__ in (()=>{
|
|
863
897
|
}(args1[0]) : raw && "string" == typeof args1[0] && (args1[0] = Buffer.from(args1[0], "utf-8")), raw && args1[0] instanceof Uint8Array && !Buffer.isBuffer(args1[0]) && (args1[0] = Buffer.from(args1[0].buffer)), args = await utils_runSyncOrAsync(fn, loaderContext, args) || []);
|
864
898
|
}
|
865
899
|
}
|
866
|
-
return sendRequest(
|
900
|
+
return sendRequest("UpdateLoaderObjects", loaderContext.loaders.map((item)=>({
|
867
901
|
data: item.loaderItem.data,
|
868
902
|
normalExecuted: item.normalExecuted,
|
869
903
|
pitchExecuted: item.pitchExecuted
|
@@ -901,7 +935,7 @@ for(var __webpack_i__ in (()=>{
|
|
901
935
|
resolve(data);
|
902
936
|
};
|
903
937
|
});
|
904
|
-
return result.wait = ()=>sendRequest.sync(
|
938
|
+
return result.wait = ()=>sendRequest.sync("WaitForPendingRequest", id), result.id = id, result;
|
905
939
|
};
|
906
940
|
return sendRequest.sync = (workerSyncPort1 = workerSyncPort, (requestType, ...args)=>{
|
907
941
|
let id = nextId++, sharedBuffer = new SharedArrayBuffer(8), sharedBufferView = new Int32Array(sharedBuffer);
|
@@ -919,7 +953,7 @@ for(var __webpack_i__ in (()=>{
|
|
919
953
|
if (isWorkerResponseMessage(message)) return message.data;
|
920
954
|
throw message.error;
|
921
955
|
}), sendRequest;
|
922
|
-
}(workerData.workerPort, workerData.workerSyncPort), waitFor = (sendRequest = sendRequest1, (requests)=>sendRequest.sync(
|
956
|
+
}(workerData.workerPort, workerData.workerSyncPort), waitFor = (sendRequest = sendRequest1, (requests)=>sendRequest.sync("WaitForPendingRequest", (Array.isArray(requests) ? requests : [
|
923
957
|
requests
|
924
958
|
]).map((request)=>request.id)));
|
925
959
|
loaderImpl(workerOptions, sendRequest1, waitFor).then(async (data)=>{
|
package/module.d.ts
CHANGED
@@ -111,16 +111,15 @@ declare namespace Rspack {
|
|
111
111
|
onErrored?: (event: ErroredEvent) => void;
|
112
112
|
}
|
113
113
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
}
|
114
|
+
type HotUpdateStatus =
|
115
|
+
| "idle"
|
116
|
+
| "check"
|
117
|
+
| "prepare"
|
118
|
+
| "ready"
|
119
|
+
| "dispose"
|
120
|
+
| "apply"
|
121
|
+
| "abort"
|
122
|
+
| "fail";
|
124
123
|
|
125
124
|
interface Hot {
|
126
125
|
accept: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@rspack/core",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.5.0-beta.1",
|
4
4
|
"webpackVersion": "5.75.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"module.d.ts"
|
28
28
|
],
|
29
29
|
"engines": {
|
30
|
-
"node": ">=
|
30
|
+
"node": ">=18.12.0"
|
31
31
|
},
|
32
32
|
"homepage": "https://rspack.rs",
|
33
33
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
@@ -38,28 +38,29 @@
|
|
38
38
|
},
|
39
39
|
"devDependencies": {
|
40
40
|
"@ast-grep/napi": "^0.39.1",
|
41
|
-
"@rsbuild/
|
42
|
-
"@rslib/core": "0.
|
41
|
+
"@rsbuild/plugin-node-polyfill": "^1.4.1",
|
42
|
+
"@rslib/core": "0.12.1",
|
43
43
|
"@swc/types": "0.1.23",
|
44
44
|
"@types/graceful-fs": "4.1.9",
|
45
45
|
"@types/watchpack": "^2.4.4",
|
46
46
|
"browserslist-load-config": "^1.0.0",
|
47
47
|
"enhanced-resolve": "5.18.2",
|
48
|
+
"glob-to-regexp": "^0.4.1",
|
48
49
|
"graceful-fs": "^4.2.11",
|
49
|
-
"
|
50
|
+
"memfs": "4.36.0",
|
51
|
+
"prebundle": "^1.4.1",
|
50
52
|
"tinypool": "^1.1.1",
|
51
53
|
"tsx": "^4.20.3",
|
52
|
-
"typescript": "^5.
|
54
|
+
"typescript": "^5.9.2",
|
53
55
|
"watchpack": "^2.4.4",
|
54
56
|
"webpack-sources": "3.3.3",
|
55
|
-
"glob-to-regexp": "^0.4.1",
|
56
57
|
"zod": "^3.25.76",
|
57
58
|
"zod-validation-error": "3.5.3"
|
58
59
|
},
|
59
60
|
"dependencies": {
|
60
|
-
"@module-federation/runtime-tools": "0.
|
61
|
+
"@module-federation/runtime-tools": "0.18.0",
|
61
62
|
"@rspack/lite-tapable": "1.0.1",
|
62
|
-
"@rspack/binding": "1.
|
63
|
+
"@rspack/binding": "1.5.0-beta.1"
|
63
64
|
},
|
64
65
|
"peerDependencies": {
|
65
66
|
"@swc/helpers": ">=0.5.1"
|
@@ -71,6 +72,7 @@
|
|
71
72
|
},
|
72
73
|
"scripts": {
|
73
74
|
"build": "rslib build",
|
75
|
+
"build:browser": "rslib build -c rslib.browser.config.ts",
|
74
76
|
"dev": "rslib build --watch",
|
75
77
|
"doc-coverage": "tsx ./scripts/check-documentation-coverage.ts",
|
76
78
|
"api-extractor": "api-extractor run --verbose",
|
@@ -1,29 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* The following code is modified based on
|
3
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/NormalModuleReplacementPlugin.js
|
4
|
-
*
|
5
|
-
* MIT Licensed
|
6
|
-
* Author Tobias Koppers @sokra
|
7
|
-
* Copyright (c) JS Foundation and other contributors
|
8
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
9
|
-
*/
|
10
|
-
import type { Compiler } from "../Compiler";
|
11
|
-
import type { ResolveData } from "../Module";
|
12
|
-
type ModuleReplacer = (createData: ResolveData) => void;
|
13
|
-
export declare class NormalModuleReplacementPlugin {
|
14
|
-
readonly resourceRegExp: RegExp;
|
15
|
-
readonly newResource: string | ModuleReplacer;
|
16
|
-
/**
|
17
|
-
* Create an instance of the plugin
|
18
|
-
* @param resourceRegExp the resource matcher
|
19
|
-
* @param newResource the resource replacement
|
20
|
-
*/
|
21
|
-
constructor(resourceRegExp: RegExp, newResource: string | ModuleReplacer);
|
22
|
-
/**
|
23
|
-
* Apply the plugin
|
24
|
-
* @param compiler the compiler instance
|
25
|
-
* @returns
|
26
|
-
*/
|
27
|
-
apply(compiler: Compiler): void;
|
28
|
-
}
|
29
|
-
export {};
|