@rspack/core 1.0.0-alpha.1 → 1.0.0-alpha.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/compiled/zod-validation-error/index.d.ts +4 -170
- package/compiled/zod-validation-error/index.js +4 -4154
- package/dist/ChunkGraph.d.ts +1 -1
- package/dist/Compilation.d.ts +9 -9
- package/dist/Compilation.js +25 -21
- package/dist/Compiler.d.ts +6 -6
- package/dist/Compiler.js +5 -6
- package/dist/ContextModuleFactory.d.ts +1 -1
- package/dist/FileSystem.d.ts +2 -2
- package/dist/Module.d.ts +4 -3
- package/dist/Module.js +1 -0
- package/dist/MultiCompiler.d.ts +3 -3
- package/dist/MultiStats.d.ts +2 -2
- package/dist/MultiWatching.d.ts +2 -2
- package/dist/NormalModule.d.ts +1 -1
- package/dist/NormalModuleFactory.d.ts +1 -1
- package/dist/Resolver.d.ts +19 -0
- package/dist/Resolver.js +39 -0
- package/dist/ResolverFactory.d.ts +9 -47
- package/dist/ResolverFactory.js +49 -120
- package/dist/RspackError.d.ts +1 -1
- package/dist/RuntimeGlobals.d.ts +1 -1
- package/dist/Stats.d.ts +2 -2
- package/dist/Watching.d.ts +3 -3
- package/dist/builtin-loader/swc/index.d.ts +0 -4
- package/dist/builtin-loader/swc/index.js +1 -5
- package/dist/builtin-loader/swc/pluginImport.d.ts +17 -1
- package/dist/builtin-loader/swc/react.d.ts +11 -1
- package/dist/builtin-loader/swc/types.d.ts +0 -2
- package/dist/builtin-plugin/APIPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/BannerPlugin.d.ts +25 -4
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DataUriPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DefinePlugin.d.ts +10 -4
- package/dist/builtin-plugin/DefinePlugin.js +42 -8
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +5 -5
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EntryPlugin.d.ts +5 -5
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +4 -4
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +5 -5
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +22 -6
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FileUriPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +3 -3
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +19 -4
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/IgnorePlugin.d.ts +4 -4
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +2 -2
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +4 -4
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ProgressPlugin.d.ts +4 -4
- package/dist/builtin-plugin/ProvidePlugin.d.ts +3 -3
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +4 -4
- package/dist/builtin-plugin/RuntimePlugin.d.ts +3 -3
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +9 -4
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +4 -4
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +4 -4
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +3 -3
- package/dist/builtin-plugin/WorkerPlugin.d.ts +3 -3
- package/dist/builtin-plugin/base.d.ts +6 -6
- package/dist/builtin-plugin/base.js +3 -3
- package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/loader.js +13 -3
- package/dist/builtin-plugin/css-extract/utils.d.ts +1 -1
- package/dist/builtin-plugin/index.d.ts +1 -7
- package/dist/builtin-plugin/index.js +3 -17
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +11 -17
- package/dist/builtin-plugin/lazy-compilation/plugin.d.ts +2 -2
- package/dist/config/adapter.d.ts +5 -4
- package/dist/config/adapter.js +3 -2
- package/dist/config/adapterRuleUse.d.ts +7 -7
- package/dist/config/adapterRuleUse.js +0 -3
- package/dist/config/defaults.d.ts +1 -1
- package/dist/config/zod.d.ts +382 -382
- package/dist/config/zod.js +2 -3
- package/dist/container/ContainerPlugin.d.ts +3 -3
- package/dist/container/ContainerReferencePlugin.d.ts +4 -4
- package/dist/container/ModuleFederationPlugin.d.ts +2 -2
- package/dist/container/ModuleFederationPluginV1.d.ts +5 -5
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +3 -3
- package/dist/container/default.runtime.js +1 -1
- package/dist/lib/EntryOptionPlugin.d.ts +2 -2
- package/dist/lib/NormalModuleReplacementPlugin.d.ts +2 -2
- package/dist/loader-runner/index.d.ts +2 -2
- package/dist/loader-runner/index.js +33 -46
- package/dist/loader-runner/loadLoader.js +1 -1
- package/dist/node/NodeTemplatePlugin.d.ts +1 -1
- package/dist/node/NodeWatchFileSystem.d.ts +1 -1
- package/dist/node/nodeConsole.js +26 -3
- package/dist/rspack.d.ts +3 -3
- package/dist/rspackOptionsApply.d.ts +1 -1
- package/dist/rspackOptionsApply.js +1 -19
- package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
- package/dist/sharing/ProvideSharedPlugin.d.ts +2 -2
- package/dist/sharing/SharePlugin.d.ts +1 -1
- package/dist/sharing/ShareRuntimePlugin.d.ts +2 -2
- package/dist/stats/StatsFactory.d.ts +2 -2
- package/dist/stats/statsFactoryUtils.d.ts +1 -1
- package/dist/util/SplitChunkSize.d.ts +1 -1
- package/dist/util/bindingVersionCheck.js +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/fs.d.ts +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +4 -2
- package/dist/util/validate.d.ts +1 -1
- package/package.json +5 -35
- package/dist/builtin-loader/swc/preact.d.ts +0 -6
- package/dist/builtin-loader/swc/preact.js +0 -15
package/dist/ChunkGraph.d.ts
CHANGED
package/dist/Compilation.d.ts
CHANGED
|
@@ -10,23 +10,23 @@
|
|
|
10
10
|
import type * as binding from "@rspack/binding";
|
|
11
11
|
import { type ExternalObject, type JsCompilation, type JsModule, type JsPathData, type JsRuntimeModule } from "@rspack/binding";
|
|
12
12
|
import * as liteTapable from "@rspack/lite-tapable";
|
|
13
|
-
import { Source } from "../compiled/webpack-sources";
|
|
14
|
-
import { ContextModuleFactory } from "./ContextModuleFactory";
|
|
15
|
-
import { Filename, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, StatsOptions, StatsValue } from "./config";
|
|
16
|
-
import ResolverFactory = require("./ResolverFactory");
|
|
13
|
+
import type { Source } from "../compiled/webpack-sources";
|
|
17
14
|
import { Chunk } from "./Chunk";
|
|
18
15
|
import { ChunkGraph } from "./ChunkGraph";
|
|
19
|
-
import { Compiler } from "./Compiler";
|
|
16
|
+
import type { Compiler } from "./Compiler";
|
|
17
|
+
import type { ContextModuleFactory } from "./ContextModuleFactory";
|
|
20
18
|
import { Entrypoint } from "./Entrypoint";
|
|
21
|
-
import { CodeGenerationResult, Module } from "./Module";
|
|
22
|
-
import { NormalModuleFactory } from "./NormalModuleFactory";
|
|
23
|
-
import {
|
|
19
|
+
import { type CodeGenerationResult, Module } from "./Module";
|
|
20
|
+
import type { NormalModuleFactory } from "./NormalModuleFactory";
|
|
21
|
+
import type { ResolverFactory } from "./ResolverFactory";
|
|
22
|
+
import { Stats, type StatsAsset, type StatsError, type StatsModule } from "./Stats";
|
|
23
|
+
import type { Filename, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance, StatsOptions, StatsValue } from "./config";
|
|
24
24
|
import { Logger } from "./logging/Logger";
|
|
25
25
|
import { StatsFactory } from "./stats/StatsFactory";
|
|
26
26
|
import { StatsPrinter } from "./stats/StatsPrinter";
|
|
27
27
|
import { type AssetInfo } from "./util/AssetInfo";
|
|
28
28
|
import Hash = require("./util/hash");
|
|
29
|
-
import { RspackError } from "./RspackError";
|
|
29
|
+
import { type RspackError } from "./RspackError";
|
|
30
30
|
export { type AssetInfo } from "./util/AssetInfo";
|
|
31
31
|
export type Assets = Record<string, Source>;
|
|
32
32
|
export interface Asset {
|
package/dist/Compilation.js
CHANGED
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_customModules, _Compilation_createCachedAssets, _Compilation_rebuildModuleCaller;
|
|
39
|
+
var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_cachedEntrypoints, _Compilation_customModules, _Compilation_createCachedAssets, _Compilation_rebuildModuleCaller;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Compilation = void 0;
|
|
42
42
|
const binding_1 = require("@rspack/binding");
|
|
@@ -61,6 +61,7 @@ class Compilation {
|
|
|
61
61
|
_Compilation_instances.add(this);
|
|
62
62
|
_Compilation_inner.set(this, void 0);
|
|
63
63
|
_Compilation_cachedAssets.set(this, void 0);
|
|
64
|
+
_Compilation_cachedEntrypoints.set(this, void 0);
|
|
64
65
|
this.fileSystemInfo = {
|
|
65
66
|
createSnapshot() {
|
|
66
67
|
// fake implement to support html-webpack-plugin
|
|
@@ -76,23 +77,20 @@ class Compilation {
|
|
|
76
77
|
this.contextDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getContextDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addContextDependencies(d));
|
|
77
78
|
this.missingDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getMissingDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addMissingDependencies(d));
|
|
78
79
|
this.buildDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getBuildDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addBuildDependencies(d));
|
|
79
|
-
_Compilation_rebuildModuleCaller.set(this, (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
callback(err, Module_1.Module.__from_binding(m, compilation));
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
callback(err || new Error("module no found"), null);
|
|
89
|
-
}
|
|
80
|
+
_Compilation_rebuildModuleCaller.set(this, ((compilation) => new MergeCaller_1.default((args) => {
|
|
81
|
+
__classPrivateFieldGet(compilation, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), (err, modules) => {
|
|
82
|
+
for (const [id, callback] of args) {
|
|
83
|
+
const m = modules.find(item => item.moduleIdentifier === id);
|
|
84
|
+
if (m) {
|
|
85
|
+
callback(err, Module_1.Module.__from_binding(m, compilation));
|
|
90
86
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
else {
|
|
88
|
+
callback(err || new Error("module no found"), null);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}, 10))(this));
|
|
94
93
|
__classPrivateFieldSet(this, _Compilation_inner, inner, "f");
|
|
95
|
-
__classPrivateFieldSet(this, _Compilation_cachedAssets, __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this), "f");
|
|
96
94
|
__classPrivateFieldSet(this, _Compilation_customModules, {}, "f");
|
|
97
95
|
const processAssetsHook = new liteTapable.AsyncSeriesHook([
|
|
98
96
|
"assets"
|
|
@@ -182,16 +180,22 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
182
180
|
* Get a map of all assets.
|
|
183
181
|
*/
|
|
184
182
|
get assets() {
|
|
183
|
+
if (!__classPrivateFieldGet(this, _Compilation_cachedAssets, "f")) {
|
|
184
|
+
__classPrivateFieldSet(this, _Compilation_cachedAssets, __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this), "f");
|
|
185
|
+
}
|
|
185
186
|
return __classPrivateFieldGet(this, _Compilation_cachedAssets, "f");
|
|
186
187
|
}
|
|
187
188
|
/**
|
|
188
189
|
* Get a map of all entrypoints.
|
|
189
190
|
*/
|
|
190
191
|
get entrypoints() {
|
|
191
|
-
|
|
192
|
-
n,
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
if (!__classPrivateFieldGet(this, _Compilation_cachedEntrypoints, "f")) {
|
|
193
|
+
__classPrivateFieldSet(this, _Compilation_cachedEntrypoints, new Map(Object.entries(__classPrivateFieldGet(this, _Compilation_inner, "f").entrypoints).map(([n, e]) => [
|
|
194
|
+
n,
|
|
195
|
+
Entrypoint_1.Entrypoint.__from_binding(e, __classPrivateFieldGet(this, _Compilation_inner, "f"))
|
|
196
|
+
])), "f");
|
|
197
|
+
}
|
|
198
|
+
return __classPrivateFieldGet(this, _Compilation_cachedEntrypoints, "f");
|
|
195
199
|
}
|
|
196
200
|
get modules() {
|
|
197
201
|
return (0, memoize_1.memoizeValue)(() => new Set(this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this))));
|
|
@@ -684,7 +688,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
|
684
688
|
seal() { }
|
|
685
689
|
unseal() { }
|
|
686
690
|
}
|
|
687
|
-
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_rebuildModuleCaller = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
|
|
691
|
+
_Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_cachedEntrypoints = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_rebuildModuleCaller = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
|
|
688
692
|
return new Proxy({}, {
|
|
689
693
|
get: (_, property) => {
|
|
690
694
|
if (typeof property === "string") {
|
package/dist/Compiler.d.ts
CHANGED
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
import * as binding from "@rspack/binding";
|
|
12
12
|
import * as liteTapable from "@rspack/lite-tapable";
|
|
13
13
|
import type Watchpack from "../compiled/watchpack";
|
|
14
|
-
import { Compilation, CompilationParams } from "./Compilation";
|
|
14
|
+
import { Compilation, type CompilationParams } from "./Compilation";
|
|
15
15
|
import { ContextModuleFactory } from "./ContextModuleFactory";
|
|
16
16
|
import { RuleSetCompiler } from "./RuleSetCompiler";
|
|
17
17
|
import { Stats } from "./Stats";
|
|
18
|
-
import { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from "./config";
|
|
18
|
+
import { type EntryNormalized, type OutputNormalized, type RspackOptionsNormalized, type RspackPluginInstance } from "./config";
|
|
19
19
|
import { rspack } from "./index";
|
|
20
|
-
import ResolverFactory = require("./ResolverFactory");
|
|
21
20
|
import Cache = require("./lib/Cache");
|
|
22
21
|
import CacheFacade = require("./lib/CacheFacade");
|
|
23
|
-
import { Source } from "../compiled/webpack-sources";
|
|
22
|
+
import type { Source } from "../compiled/webpack-sources";
|
|
24
23
|
import { Chunk } from "./Chunk";
|
|
25
|
-
import { FileSystemInfoEntry } from "./FileSystemInfo";
|
|
24
|
+
import type { FileSystemInfoEntry } from "./FileSystemInfo";
|
|
26
25
|
import { NormalModuleFactory } from "./NormalModuleFactory";
|
|
26
|
+
import { ResolverFactory } from "./ResolverFactory";
|
|
27
27
|
import { Watching } from "./Watching";
|
|
28
28
|
import { Logger } from "./logging/Logger";
|
|
29
|
-
import { OutputFileSystem, WatchFileSystem } from "./util/fs";
|
|
29
|
+
import type { OutputFileSystem, WatchFileSystem } from "./util/fs";
|
|
30
30
|
export interface AssetEmittedInfo {
|
|
31
31
|
content: Buffer;
|
|
32
32
|
source: Source;
|
package/dist/Compiler.js
CHANGED
|
@@ -52,19 +52,19 @@ const binding = __importStar(require("@rspack/binding"));
|
|
|
52
52
|
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
53
53
|
const Compilation_1 = require("./Compilation");
|
|
54
54
|
const ContextModuleFactory_1 = require("./ContextModuleFactory");
|
|
55
|
+
const FileSystem_1 = require("./FileSystem");
|
|
55
56
|
const RuleSetCompiler_1 = require("./RuleSetCompiler");
|
|
56
57
|
const Stats_1 = require("./Stats");
|
|
57
58
|
const config_1 = require("./config");
|
|
58
|
-
const index_1 = require("./index");
|
|
59
|
-
const ResolverFactory = require("./ResolverFactory");
|
|
60
|
-
const FileSystem_1 = require("./FileSystem");
|
|
61
59
|
const ConcurrentCompilationError_1 = __importDefault(require("./error/ConcurrentCompilationError"));
|
|
60
|
+
const index_1 = require("./index");
|
|
62
61
|
const Cache = require("./lib/Cache");
|
|
63
62
|
const CacheFacade = require("./lib/CacheFacade");
|
|
64
63
|
const Chunk_1 = require("./Chunk");
|
|
65
64
|
const ExecuteModulePlugin_1 = __importDefault(require("./ExecuteModulePlugin"));
|
|
66
65
|
const Module_1 = require("./Module");
|
|
67
66
|
const NormalModuleFactory_1 = require("./NormalModuleFactory");
|
|
67
|
+
const ResolverFactory_1 = require("./ResolverFactory");
|
|
68
68
|
const RuntimeGlobals_1 = require("./RuntimeGlobals");
|
|
69
69
|
const Watching_1 = require("./Watching");
|
|
70
70
|
const builtin_plugin_1 = require("./builtin-plugin");
|
|
@@ -144,8 +144,8 @@ class Compiler {
|
|
|
144
144
|
this.outputFileSystem = null;
|
|
145
145
|
this.watchFileSystem = null;
|
|
146
146
|
this.records = {};
|
|
147
|
-
this.resolverFactory = new ResolverFactory();
|
|
148
147
|
this.options = options;
|
|
148
|
+
this.resolverFactory = new ResolverFactory_1.ResolverFactory();
|
|
149
149
|
this.context = context;
|
|
150
150
|
this.cache = new Cache();
|
|
151
151
|
this.compilerPath = "";
|
|
@@ -402,7 +402,6 @@ class Compiler {
|
|
|
402
402
|
childCompiler.outputPath = this.outputPath;
|
|
403
403
|
childCompiler.inputFileSystem = this.inputFileSystem;
|
|
404
404
|
childCompiler.outputFileSystem = null;
|
|
405
|
-
childCompiler.resolverFactory = this.resolverFactory;
|
|
406
405
|
childCompiler.modifiedFiles = this.modifiedFiles;
|
|
407
406
|
childCompiler.removedFiles = this.removedFiles;
|
|
408
407
|
childCompiler.fileTimestamps = this.fileTimestamps;
|
|
@@ -786,7 +785,7 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
786
785
|
return Buffer.from(digestResult);
|
|
787
786
|
})
|
|
788
787
|
}, "f");
|
|
789
|
-
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, __classPrivateFieldGet(this, _Compiler_builtinPlugins, "f"), __classPrivateFieldGet(this, _Compiler_registers, "f"), FileSystem_1.ThreadsafeWritableNodeFS.__to_binding(this.outputFileSystem)), "f");
|
|
788
|
+
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, __classPrivateFieldGet(this, _Compiler_builtinPlugins, "f"), __classPrivateFieldGet(this, _Compiler_registers, "f"), FileSystem_1.ThreadsafeWritableNodeFS.__to_binding(this.outputFileSystem), ResolverFactory_1.ResolverFactory.__to_binding(this.resolverFactory)), "f");
|
|
790
789
|
callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
|
|
791
790
|
}, _Compiler_updateNonSkippableRegisters = function _Compiler_updateNonSkippableRegisters() {
|
|
792
791
|
const kinds = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as liteTapable from "@rspack/lite-tapable";
|
|
2
|
-
import { ContextModuleFactoryAfterResolveResult, ContextModuleFactoryBeforeResolveResult } from "./Module";
|
|
2
|
+
import type { ContextModuleFactoryAfterResolveResult, ContextModuleFactoryBeforeResolveResult } from "./Module";
|
|
3
3
|
export declare class ContextModuleFactory {
|
|
4
4
|
hooks: {
|
|
5
5
|
beforeResolve: liteTapable.AsyncSeriesWaterfallHook<[
|
package/dist/FileSystem.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { ThreadsafeNodeFS } from "@rspack/binding";
|
|
3
|
-
import { OutputFileSystem } from "./util/fs";
|
|
2
|
+
import type { ThreadsafeNodeFS } from "@rspack/binding";
|
|
3
|
+
import { type OutputFileSystem } from "./util/fs";
|
|
4
4
|
declare class ThreadsafeWritableNodeFS implements ThreadsafeNodeFS {
|
|
5
5
|
writeFile: (name: string, content: Buffer) => Promise<void> | void;
|
|
6
6
|
removeFile: (name: string) => Promise<void> | void;
|
package/dist/Module.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { JsCodegenerationResult, JsCodegenerationResults, JsCreateData, JsFactoryMeta, JsModule } from "@rspack/binding";
|
|
2
|
-
import { Source } from "../compiled/webpack-sources";
|
|
3
|
-
import { Compilation } from "./Compilation";
|
|
1
|
+
import type { JsCodegenerationResult, JsCodegenerationResults, JsCreateData, JsFactoryMeta, JsModule } from "@rspack/binding";
|
|
2
|
+
import type { Source } from "../compiled/webpack-sources";
|
|
3
|
+
import type { Compilation } from "./Compilation";
|
|
4
4
|
export type ResourceData = {
|
|
5
5
|
resource: string;
|
|
6
6
|
path: string;
|
|
@@ -41,6 +41,7 @@ export declare class Module {
|
|
|
41
41
|
request?: Readonly<string>;
|
|
42
42
|
userRequest?: Readonly<string>;
|
|
43
43
|
rawRequest?: Readonly<string>;
|
|
44
|
+
type: string;
|
|
44
45
|
factoryMeta?: Readonly<JsFactoryMeta>;
|
|
45
46
|
/**
|
|
46
47
|
* Records the dynamically added fields for Module on the JavaScript side.
|
package/dist/Module.js
CHANGED
|
@@ -22,6 +22,7 @@ class Module {
|
|
|
22
22
|
_Module_inner.set(this, void 0);
|
|
23
23
|
_Module_originalSource.set(this, void 0);
|
|
24
24
|
__classPrivateFieldSet(this, _Module_inner, module, "f");
|
|
25
|
+
this.type = module.type;
|
|
25
26
|
this.context = module.context;
|
|
26
27
|
this.resource = module.resource;
|
|
27
28
|
this.request = module.request;
|
package/dist/MultiCompiler.d.ts
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import * as liteTapable from "@rspack/lite-tapable";
|
|
11
|
-
import { Compiler, RspackOptions } from ".";
|
|
11
|
+
import type { Compiler, RspackOptions } from ".";
|
|
12
12
|
import MultiStats from "./MultiStats";
|
|
13
13
|
import MultiWatching from "./MultiWatching";
|
|
14
|
-
import { WatchOptions } from "./config";
|
|
15
|
-
import { WatchFileSystem } from "./util/fs";
|
|
14
|
+
import type { WatchOptions } from "./config";
|
|
15
|
+
import type { WatchFileSystem } from "./util/fs";
|
|
16
16
|
export interface MultiCompilerOptions {
|
|
17
17
|
/**
|
|
18
18
|
* how many Compilers are allows to run at the same time in parallel
|
package/dist/MultiStats.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { Stats } from "./Stats";
|
|
11
|
-
import { StatsCompilation } from "./stats/statsFactoryUtils";
|
|
10
|
+
import type { Stats } from "./Stats";
|
|
11
|
+
import type { StatsCompilation } from "./stats/statsFactoryUtils";
|
|
12
12
|
export default class MultiStats {
|
|
13
13
|
#private;
|
|
14
14
|
stats: Stats[];
|
package/dist/MultiWatching.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { MultiCompiler } from "./MultiCompiler";
|
|
11
|
-
import { Watching } from "./Watching";
|
|
10
|
+
import type { MultiCompiler } from "./MultiCompiler";
|
|
11
|
+
import type { Watching } from "./Watching";
|
|
12
12
|
declare class MultiWatching {
|
|
13
13
|
watchings: Watching[];
|
|
14
14
|
compiler: MultiCompiler;
|
package/dist/NormalModule.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as liteTapable from "@rspack/lite-tapable";
|
|
3
3
|
import { Compilation } from "./Compilation";
|
|
4
|
-
import { LoaderContext } from "./config";
|
|
4
|
+
import type { LoaderContext } from "./config";
|
|
5
5
|
export declare class NormalModule {
|
|
6
6
|
static getCompilationHooks(compilation: Compilation): {
|
|
7
7
|
loader: liteTapable.SyncHook<[LoaderContext<{}>], void, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as binding from "@rspack/binding";
|
|
2
2
|
import * as liteTapable from "@rspack/lite-tapable";
|
|
3
|
-
import { ResolveData, ResourceDataWithData } from "./Module";
|
|
3
|
+
import type { ResolveData, ResourceDataWithData } from "./Module";
|
|
4
4
|
export type NormalModuleCreateData = binding.JsNormalModuleFactoryCreateModuleArgs & {
|
|
5
5
|
settings: {};
|
|
6
6
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as binding from "@rspack/binding";
|
|
2
|
+
import { type Resolve } from "./config";
|
|
3
|
+
interface ResolveContext {
|
|
4
|
+
}
|
|
5
|
+
type ErrorWithDetail = Error & {
|
|
6
|
+
details?: string;
|
|
7
|
+
};
|
|
8
|
+
type ResolveOptionsWithDependencyType = Resolve & {
|
|
9
|
+
dependencyCategory?: string;
|
|
10
|
+
resolveToContext?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare class Resolver {
|
|
13
|
+
binding: binding.JsResolver;
|
|
14
|
+
constructor(binding: binding.JsResolver);
|
|
15
|
+
resolveSync(context: object, path: string, request: string): string | false;
|
|
16
|
+
resolve(context: object, path: string, request: string, resolveContext: ResolveContext, callback: (err: null | ErrorWithDetail, res?: string | false) => void): void;
|
|
17
|
+
withOptions({ dependencyCategory, resolveToContext, ...resolve }: ResolveOptionsWithDependencyType): Resolver;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
package/dist/Resolver.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Resolver = void 0;
|
|
4
|
+
const config_1 = require("./config");
|
|
5
|
+
function isString(value) {
|
|
6
|
+
return typeof value === "string";
|
|
7
|
+
}
|
|
8
|
+
class Resolver {
|
|
9
|
+
constructor(binding) {
|
|
10
|
+
this.binding = binding;
|
|
11
|
+
}
|
|
12
|
+
resolveSync(context, path, request) {
|
|
13
|
+
return this.binding.resolveSync(path, request);
|
|
14
|
+
}
|
|
15
|
+
resolve(context, path, request, resolveContext, callback) {
|
|
16
|
+
try {
|
|
17
|
+
const res = this.binding.resolveSync(path, request);
|
|
18
|
+
callback(null, res);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
callback(err);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
withOptions({ dependencyCategory, resolveToContext, ...resolve }) {
|
|
25
|
+
const rawResolve = (0, config_1.getRawResolve)(resolve);
|
|
26
|
+
// TODO: rspack_resolver is unimplemented regex
|
|
27
|
+
if (Array.isArray(rawResolve.restrictions)) {
|
|
28
|
+
rawResolve.restrictions =
|
|
29
|
+
rawResolve.restrictions.filter(isString);
|
|
30
|
+
}
|
|
31
|
+
const binding = this.binding.withOptions({
|
|
32
|
+
dependencyCategory,
|
|
33
|
+
resolveToContext,
|
|
34
|
+
...rawResolve
|
|
35
|
+
});
|
|
36
|
+
return new Resolver(binding);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Resolver = Resolver;
|
|
@@ -1,48 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/** @type {Map<string, ResolverCache>} */
|
|
10
|
-
cache: Map<string, ResolverCache>;
|
|
11
|
-
/**
|
|
12
|
-
* @param {string} type type of resolver
|
|
13
|
-
* @param {ResolveOptionsWithDependencyType=} resolveOptions options
|
|
14
|
-
* @returns {ResolverWithOptions} the resolver
|
|
15
|
-
*/
|
|
16
|
-
get(type: string, resolveOptions?: ResolveOptionsWithDependencyType | undefined): ResolverWithOptions;
|
|
17
|
-
/**
|
|
18
|
-
* @param {string} type type of resolver
|
|
19
|
-
* @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType options
|
|
20
|
-
* @returns {ResolverWithOptions} the resolver
|
|
21
|
-
*/
|
|
22
|
-
_create(type: string, resolveOptionsWithDepType: ResolveOptionsWithDependencyType): ResolverWithOptions;
|
|
1
|
+
import * as binding from "@rspack/binding";
|
|
2
|
+
import { Resolver } from "./Resolver";
|
|
3
|
+
type ResolveOptionsWithDependencyType = binding.RawResolveOptionsWithDependencyType;
|
|
4
|
+
export declare class ResolverFactory {
|
|
5
|
+
#private;
|
|
6
|
+
static __to_binding(resolver_factory: ResolverFactory): binding.JsResolverFactory;
|
|
7
|
+
constructor();
|
|
8
|
+
get(type: string, resolveOptions?: ResolveOptionsWithDependencyType): Resolver;
|
|
23
9
|
}
|
|
24
|
-
|
|
25
|
-
export { ResolveOptions, Resolver, WebpackResolveOptions, ResolvePluginInstance, ResolveOptionsWithDependencyType, WithOptions, ResolverWithOptions, ResolverCache };
|
|
26
|
-
}
|
|
27
|
-
import { HookMap } from "@rspack/lite-tapable";
|
|
28
|
-
import { SyncWaterfallHook } from "@rspack/lite-tapable";
|
|
29
|
-
type ResolveOptionsWithDependencyType = WebpackResolveOptions & {
|
|
30
|
-
dependencyType?: string;
|
|
31
|
-
resolveToContext?: boolean;
|
|
32
|
-
};
|
|
33
|
-
import { SyncHook } from "@rspack/lite-tapable";
|
|
34
|
-
type Resolver = import("../compiled/enhanced-resolve").Resolver;
|
|
35
|
-
type ResolveOptions = import("../compiled/enhanced-resolve").ResolveOptions;
|
|
36
|
-
type ResolverCache = {
|
|
37
|
-
direct: WeakMap<Object, ResolverWithOptions>;
|
|
38
|
-
stringified: Map<string, ResolverWithOptions>;
|
|
39
|
-
};
|
|
40
|
-
type ResolverWithOptions = Resolver & WithOptions;
|
|
41
|
-
type WebpackResolveOptions = any;
|
|
42
|
-
type ResolvePluginInstance = any;
|
|
43
|
-
type WithOptions = {
|
|
44
|
-
/**
|
|
45
|
-
* create a resolver with additional/different options
|
|
46
|
-
*/
|
|
47
|
-
withOptions: (arg0: Partial<ResolveOptionsWithDependencyType>) => ResolverWithOptions;
|
|
48
|
-
};
|
|
10
|
+
export {};
|
package/dist/ResolverFactory.js
CHANGED
|
@@ -1,126 +1,55 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The following code is modified based on
|
|
3
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/ResolverFactory.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
1
|
"use strict";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// /** @typedef {import("../declarations/WebpackOptions").ResolveOptions} WebpackResolveOptions */
|
|
17
|
-
// /** @typedef {import("../declarations/WebpackOptions").ResolvePluginInstance} ResolvePluginInstance */
|
|
18
|
-
/** @typedef {any} WebpackResolveOptions */
|
|
19
|
-
/** @typedef {any} ResolvePluginInstance */
|
|
20
|
-
/** @typedef {WebpackResolveOptions & {dependencyType?: string, resolveToContext?: boolean }} ResolveOptionsWithDependencyType */
|
|
21
|
-
/**
|
|
22
|
-
* @typedef {Object} WithOptions
|
|
23
|
-
* @property {function(Partial<ResolveOptionsWithDependencyType>): ResolverWithOptions} withOptions create a resolver with additional/different options
|
|
24
|
-
*/
|
|
25
|
-
/** @typedef {Resolver & WithOptions} ResolverWithOptions */
|
|
26
|
-
// need to be hoisted on module level for caching identity
|
|
27
|
-
const EMPTY_RESOLVE_OPTIONS = {};
|
|
28
|
-
/**
|
|
29
|
-
* @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType enhanced options
|
|
30
|
-
* @returns {ResolveOptions} merged options
|
|
31
|
-
*/
|
|
32
|
-
const convertToResolveOptions = resolveOptionsWithDepType => {
|
|
33
|
-
const { dependencyType, plugins, ...remaining } = resolveOptionsWithDepType;
|
|
34
|
-
// check type compat
|
|
35
|
-
/** @type {Partial<ResolveOptions>} */
|
|
36
|
-
const partialOptions = {
|
|
37
|
-
...remaining,
|
|
38
|
-
plugins: plugins &&
|
|
39
|
-
/** @type {ResolvePluginInstance[]} */ (
|
|
40
|
-
// @ts-expect-error
|
|
41
|
-
plugins.filter(item => item !== "..."))
|
|
42
|
-
};
|
|
43
|
-
if (!partialOptions.fileSystem) {
|
|
44
|
-
throw new Error("fileSystem is missing in resolveOptions, but it's required for enhanced-resolve");
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
45
7
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
51
24
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
25
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
26
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
27
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
28
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
29
|
+
};
|
|
30
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
31
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
32
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
33
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
34
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
35
|
+
};
|
|
36
|
+
var _ResolverFactory_binding;
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.ResolverFactory = void 0;
|
|
39
|
+
const binding = __importStar(require("@rspack/binding"));
|
|
40
|
+
const Resolver_1 = require("./Resolver");
|
|
41
|
+
class ResolverFactory {
|
|
42
|
+
static __to_binding(resolver_factory) {
|
|
43
|
+
return __classPrivateFieldGet(resolver_factory, _ResolverFactory_binding, "f");
|
|
67
44
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* @returns {ResolverWithOptions} the resolver
|
|
72
|
-
*/
|
|
73
|
-
get(type, resolveOptions = EMPTY_RESOLVE_OPTIONS) {
|
|
74
|
-
let typedCaches = this.cache.get(type);
|
|
75
|
-
if (!typedCaches) {
|
|
76
|
-
typedCaches = {
|
|
77
|
-
direct: new WeakMap(),
|
|
78
|
-
stringified: new Map()
|
|
79
|
-
};
|
|
80
|
-
this.cache.set(type, typedCaches);
|
|
81
|
-
}
|
|
82
|
-
const cachedResolver = typedCaches.direct.get(resolveOptions);
|
|
83
|
-
if (cachedResolver) {
|
|
84
|
-
return cachedResolver;
|
|
85
|
-
}
|
|
86
|
-
const ident = JSON.stringify(resolveOptions);
|
|
87
|
-
const resolver = typedCaches.stringified.get(ident);
|
|
88
|
-
if (resolver) {
|
|
89
|
-
typedCaches.direct.set(resolveOptions, resolver);
|
|
90
|
-
return resolver;
|
|
91
|
-
}
|
|
92
|
-
const newResolver = this._create(type, resolveOptions);
|
|
93
|
-
typedCaches.direct.set(resolveOptions, newResolver);
|
|
94
|
-
typedCaches.stringified.set(ident, newResolver);
|
|
95
|
-
return newResolver;
|
|
45
|
+
constructor() {
|
|
46
|
+
_ResolverFactory_binding.set(this, void 0);
|
|
47
|
+
__classPrivateFieldSet(this, _ResolverFactory_binding, new binding.JsResolverFactory(), "f");
|
|
96
48
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
* @returns {ResolverWithOptions} the resolver
|
|
101
|
-
*/
|
|
102
|
-
_create(type, resolveOptionsWithDepType) {
|
|
103
|
-
/** @type {ResolveOptionsWithDependencyType} */
|
|
104
|
-
const originalResolveOptions = { ...resolveOptionsWithDepType };
|
|
105
|
-
const resolveOptions = convertToResolveOptions(this.hooks.resolveOptions.for(type).call(resolveOptionsWithDepType));
|
|
106
|
-
const resolver = /** @type {ResolverWithOptions} */ (Factory.createResolver(resolveOptions));
|
|
107
|
-
if (!resolver) {
|
|
108
|
-
throw new Error("No resolver created");
|
|
109
|
-
}
|
|
110
|
-
/** @type {WeakMap<Partial<ResolveOptionsWithDependencyType>, ResolverWithOptions>} */
|
|
111
|
-
const childCache = new WeakMap();
|
|
112
|
-
resolver.withOptions = options => {
|
|
113
|
-
const cacheEntry = childCache.get(options);
|
|
114
|
-
if (cacheEntry !== undefined)
|
|
115
|
-
return cacheEntry;
|
|
116
|
-
const mergedOptions = cachedCleverMerge(originalResolveOptions, options);
|
|
117
|
-
const resolver = this.get(type, mergedOptions);
|
|
118
|
-
childCache.set(options, resolver);
|
|
119
|
-
return resolver;
|
|
120
|
-
};
|
|
121
|
-
this.hooks.resolver
|
|
122
|
-
.for(type)
|
|
123
|
-
.call(resolver, resolveOptions, originalResolveOptions);
|
|
124
|
-
return resolver;
|
|
49
|
+
get(type, resolveOptions) {
|
|
50
|
+
const binding = __classPrivateFieldGet(this, _ResolverFactory_binding, "f").get(type, resolveOptions);
|
|
51
|
+
return new Resolver_1.Resolver(binding);
|
|
125
52
|
}
|
|
126
|
-
}
|
|
53
|
+
}
|
|
54
|
+
exports.ResolverFactory = ResolverFactory;
|
|
55
|
+
_ResolverFactory_binding = new WeakMap();
|
package/dist/RspackError.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as binding from "@rspack/binding";
|
|
1
|
+
import type * as binding from "@rspack/binding";
|
|
2
2
|
export type RspackError = binding.JsRspackError;
|
|
3
3
|
export declare class JsDiagnostic {
|
|
4
4
|
static __to_binding(error: Error | RspackError, severity: binding.JsRspackSeverity): binding.JsDiagnostic;
|
package/dist/RuntimeGlobals.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 { JsRuntimeGlobals } from "@rspack/binding";
|
|
10
|
+
import type { JsRuntimeGlobals } from "@rspack/binding";
|
|
11
11
|
export declare function __from_binding_runtime_globals(runtimeRequirements: JsRuntimeGlobals): Set<string>;
|
|
12
12
|
export declare function __to_binding_runtime_globals(runtimeRequirements: Set<string>): JsRuntimeGlobals;
|
|
13
13
|
export declare const RuntimeGlobals: {
|