@rspack/core 0.6.5-canary-dc02c55-20240516004313 → 0.6.5-canary-b7b5c75-20240821125908
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/Chunk.d.ts +1 -1
- package/dist/Chunk.js +1 -1
- package/dist/ChunkGroup.d.ts +1 -1
- package/dist/ChunkGroup.js +3 -3
- package/dist/Compilation.d.ts +65 -46
- package/dist/Compilation.js +222 -128
- package/dist/Compiler.d.ts +44 -75
- package/dist/Compiler.js +260 -301
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/Entrypoint.js +1 -1
- package/dist/ExecuteModulePlugin.js +1 -1
- package/dist/Module.js +2 -2
- package/dist/MultiCompiler.d.ts +25 -10
- package/dist/MultiCompiler.js +3 -3
- package/dist/MultiStats.d.ts +1 -1
- package/dist/NormalModuleFactory.d.ts +1 -1
- package/dist/Stats.d.ts +2 -2
- package/dist/Watching.d.ts +9 -0
- package/dist/Watching.js +2 -12
- package/dist/builtin-loader/swc/index.d.ts +6 -6
- package/dist/builtin-loader/swc/index.js +3 -3
- package/dist/builtin-loader/swc/types.d.ts +2 -2
- 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 +2 -2
- package/dist/builtin-plugin/BannerPlugin.js +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/CopyRspackPlugin.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/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DynamicEntryPlugin.js +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.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/EntryPlugin.js +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HtmlRspackPlugin.js +2 -2
- 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/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.js +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.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/ModuleConcatenationPlugin.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/NodeTargetPlugin.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/RemoveEmptyChunksPlugin.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/SplitChunksPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SplitChunksPlugin.js +4 -4
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.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/WebWorkerTemplatePlugin.d.ts +1 -1
- package/dist/builtin-plugin/WorkerPlugin.d.ts +2 -2
- package/dist/builtin-plugin/base.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/index.d.ts +4 -5
- package/dist/builtin-plugin/css-extract/loader.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/loader.js +2 -2
- package/dist/builtin-plugin/index.d.ts +43 -43
- package/dist/builtin-plugin/index.js +43 -43
- package/dist/config/adapter.d.ts +2 -2
- package/dist/config/adapter.js +5 -6
- package/dist/config/adapterRuleUse.d.ts +1 -2
- package/dist/config/adapterRuleUse.js +2 -2
- package/dist/config/defaults.js +4 -6
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +2 -2
- package/dist/config/normalization.d.ts +2 -1
- package/dist/config/zod.d.ts +184 -258
- package/dist/config/zod.js +28 -8
- package/dist/container/ContainerPlugin.d.ts +1 -1
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/container/ContainerReferencePlugin.js +1 -1
- package/dist/container/ModuleFederationPlugin.js +1 -1
- package/dist/container/ModuleFederationPluginV1.d.ts +1 -1
- package/dist/container/ModuleFederationPluginV1.js +1 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/exports.d.ts +30 -32
- package/dist/exports.js +17 -15
- package/dist/fileSystem.d.ts +8 -12
- package/dist/fileSystem.js +48 -25
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/loader-runner/index.js +13 -13
- package/dist/logging/Logger.d.ts +1 -1
- package/dist/logging/createConsoleLogger.js +14 -0
- package/dist/node/NodeEnvironmentPlugin.d.ts +1 -1
- package/dist/node/NodeEnvironmentPlugin.js +1 -1
- package/dist/node/nodeConsole.js +4 -0
- package/dist/rspack.d.ts +13 -4
- package/dist/rspack.js +8 -8
- package/dist/rspackOptionsApply.d.ts +10 -1
- package/dist/rspackOptionsApply.js +5 -14
- package/dist/sharing/ConsumeSharedPlugin.d.ts +1 -1
- package/dist/sharing/ConsumeSharedPlugin.js +1 -1
- package/dist/stats/DefaultStatsFactoryPlugin.js +2 -2
- package/dist/stats/StatsFactory.d.ts +2 -2
- package/dist/stats/StatsFactory.js +9 -0
- package/dist/stats/StatsPrinter.d.ts +1 -1
- package/dist/stats/statsFactoryUtils.d.ts +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/createSource.d.ts +5 -0
- package/dist/util/createSource.js +65 -0
- package/dist/util/fs.d.ts +0 -64
- package/dist/util/fs.js +0 -122
- package/dist/util/index.d.ts +1 -2
- package/dist/util/index.js +11 -16
- package/package.json +5 -5
- package/dist/util/source.d.ts +0 -18
- package/dist/util/source.js +0 -66
|
@@ -100,7 +100,9 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
|
100
100
|
case LogType.debug:
|
|
101
101
|
if (!debug)
|
|
102
102
|
return;
|
|
103
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
103
104
|
if (typeof console.debug === "function") {
|
|
105
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
104
106
|
console.debug(...labeledArgs());
|
|
105
107
|
}
|
|
106
108
|
else {
|
|
@@ -136,7 +138,9 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
|
136
138
|
if (!debug && loglevel > LogLevel.log)
|
|
137
139
|
return;
|
|
138
140
|
if (!debug && loglevel > LogLevel.verbose) {
|
|
141
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
139
142
|
if (typeof console.groupCollapsed === "function") {
|
|
143
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
140
144
|
console.groupCollapsed(...labeledArgs());
|
|
141
145
|
}
|
|
142
146
|
else {
|
|
@@ -148,7 +152,9 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
|
148
152
|
case LogType.group:
|
|
149
153
|
if (!debug && loglevel > LogLevel.log)
|
|
150
154
|
return;
|
|
155
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
151
156
|
if (typeof console.group === "function") {
|
|
157
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
152
158
|
console.group(...labeledArgs());
|
|
153
159
|
}
|
|
154
160
|
else {
|
|
@@ -158,7 +164,9 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
|
158
164
|
case LogType.groupEnd:
|
|
159
165
|
if (!debug && loglevel > LogLevel.log)
|
|
160
166
|
return;
|
|
167
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
161
168
|
if (typeof console.groupEnd === "function") {
|
|
169
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
162
170
|
console.groupEnd();
|
|
163
171
|
}
|
|
164
172
|
break;
|
|
@@ -176,19 +184,25 @@ module.exports = ({ level = "info", debug = false, console }) => {
|
|
|
176
184
|
break;
|
|
177
185
|
}
|
|
178
186
|
case LogType.profile:
|
|
187
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
179
188
|
if (typeof console.profile === "function") {
|
|
189
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
180
190
|
console.profile(...labeledArgs());
|
|
181
191
|
}
|
|
182
192
|
break;
|
|
183
193
|
case LogType.profileEnd:
|
|
194
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
184
195
|
if (typeof console.profileEnd === "function") {
|
|
196
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
185
197
|
console.profileEnd(...labeledArgs());
|
|
186
198
|
}
|
|
187
199
|
break;
|
|
188
200
|
case LogType.clear:
|
|
189
201
|
if (!debug && loglevel > LogLevel.log)
|
|
190
202
|
return;
|
|
203
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
191
204
|
if (typeof console.clear === "function") {
|
|
205
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
192
206
|
console.clear();
|
|
193
207
|
}
|
|
194
208
|
break;
|
|
@@ -16,8 +16,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
const CachedInputFileSystem_1 = __importDefault(require("enhanced-resolve/lib/CachedInputFileSystem"));
|
|
17
17
|
const graceful_fs_1 = __importDefault(require("../../compiled/graceful-fs"));
|
|
18
18
|
const createConsoleLogger_1 = __importDefault(require("../logging/createConsoleLogger"));
|
|
19
|
-
const nodeConsole_1 = __importDefault(require("./nodeConsole"));
|
|
20
19
|
const NodeWatchFileSystem_1 = __importDefault(require("./NodeWatchFileSystem"));
|
|
20
|
+
const nodeConsole_1 = __importDefault(require("./nodeConsole"));
|
|
21
21
|
class NodeEnvironmentPlugin {
|
|
22
22
|
constructor(options) {
|
|
23
23
|
this.options = options;
|
package/dist/node/nodeConsole.js
CHANGED
|
@@ -93,14 +93,18 @@ module.exports = ({ colors, appendOnly, stream }) => {
|
|
|
93
93
|
else if (currentIndent.length >= 2)
|
|
94
94
|
currentIndent = currentIndent.slice(0, currentIndent.length - 2);
|
|
95
95
|
},
|
|
96
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
96
97
|
// @ts-expect-error
|
|
97
98
|
profile: console.profile && (name => console.profile(name)),
|
|
99
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
98
100
|
// @ts-expect-error
|
|
99
101
|
profileEnd: console.profileEnd && (name => console.profileEnd(name)),
|
|
100
102
|
clear: !appendOnly &&
|
|
103
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
101
104
|
console.clear &&
|
|
102
105
|
(() => {
|
|
103
106
|
clearStatusMessage();
|
|
107
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
|
104
108
|
console.clear();
|
|
105
109
|
writeStatusMessage();
|
|
106
110
|
}),
|
package/dist/rspack.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib
|
|
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
|
+
*/
|
|
3
10
|
import { RspackOptions } from "./config";
|
|
11
|
+
import { Compiler } from "./Compiler";
|
|
12
|
+
import { Stats } from "./Stats";
|
|
4
13
|
import { MultiCompiler, MultiRspackOptions } from "./MultiCompiler";
|
|
14
|
+
import { Callback } from "tapable";
|
|
5
15
|
import MultiStats from "./MultiStats";
|
|
6
|
-
import { Stats } from "./Stats";
|
|
7
16
|
declare function createMultiCompiler(options: MultiRspackOptions): MultiCompiler;
|
|
8
17
|
declare function createCompiler(userOptions: RspackOptions): Compiler;
|
|
9
18
|
declare function rspack(options: MultiRspackOptions): MultiCompiler;
|
|
@@ -12,5 +21,5 @@ declare function rspack(options: MultiRspackOptions | RspackOptions): MultiCompi
|
|
|
12
21
|
declare function rspack(options: MultiRspackOptions, callback?: Callback<Error, MultiStats>): null | MultiCompiler;
|
|
13
22
|
declare function rspack(options: RspackOptions, callback?: Callback<Error, Stats>): null | Compiler;
|
|
14
23
|
declare function rspack(options: MultiRspackOptions | RspackOptions, callback?: Callback<Error, MultiStats | Stats>): null | MultiCompiler | Compiler;
|
|
15
|
-
export { createCompiler, createMultiCompiler,
|
|
24
|
+
export { rspack, createCompiler, createMultiCompiler, Stats, MultiStats };
|
|
16
25
|
export default rspack;
|
package/dist/rspack.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.MultiStats = exports.Stats = exports.createMultiCompiler = exports.createCompiler = exports.rspack = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* The following code is modified based on
|
|
9
9
|
* https://github.com/webpack/webpack/blob/4b4ca3b/lib
|
|
@@ -13,17 +13,17 @@ exports.Stats = exports.rspack = exports.MultiStats = exports.createMultiCompile
|
|
|
13
13
|
* Copyright (c) JS Foundation and other contributors
|
|
14
14
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
15
15
|
*/
|
|
16
|
-
const assert_1 = __importDefault(require("assert"));
|
|
17
|
-
const util_1 = __importDefault(require("util"));
|
|
18
|
-
const Compiler_1 = require("./Compiler");
|
|
19
16
|
const config_1 = require("./config");
|
|
17
|
+
const Compiler_1 = require("./Compiler");
|
|
18
|
+
const Stats_1 = require("./Stats");
|
|
19
|
+
Object.defineProperty(exports, "Stats", { enumerable: true, get: function () { return Stats_1.Stats; } });
|
|
20
|
+
const util_1 = __importDefault(require("util"));
|
|
21
|
+
const rspackOptionsApply_1 = require("./rspackOptionsApply");
|
|
22
|
+
const NodeEnvironmentPlugin_1 = __importDefault(require("./node/NodeEnvironmentPlugin"));
|
|
20
23
|
const MultiCompiler_1 = require("./MultiCompiler");
|
|
21
24
|
const MultiStats_1 = __importDefault(require("./MultiStats"));
|
|
22
25
|
exports.MultiStats = MultiStats_1.default;
|
|
23
|
-
const
|
|
24
|
-
const rspackOptionsApply_1 = require("./rspackOptionsApply");
|
|
25
|
-
const Stats_1 = require("./Stats");
|
|
26
|
-
Object.defineProperty(exports, "Stats", { enumerable: true, get: function () { return Stats_1.Stats; } });
|
|
26
|
+
const assert_1 = __importDefault(require("assert"));
|
|
27
27
|
const util_2 = require("./util");
|
|
28
28
|
const validate_1 = require("./util/validate");
|
|
29
29
|
function createMultiCompiler(options) {
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/OptionsApply.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 { RspackOptionsNormalized, Compiler } from ".";
|
|
2
11
|
export declare class RspackOptionsApply {
|
|
3
12
|
constructor();
|
|
4
13
|
process(options: RspackOptionsNormalized, compiler: Compiler): void;
|
|
@@ -4,24 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RspackOptionsApply = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* The following code is modified based on
|
|
9
|
-
* https://github.com/webpack/webpack/blob/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/OptionsApply.js
|
|
10
|
-
*
|
|
11
|
-
* MIT Licensed
|
|
12
|
-
* Author Tobias Koppers @sokra
|
|
13
|
-
* Copyright (c) JS Foundation and other contributors
|
|
14
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
15
|
-
*/
|
|
16
|
-
const assert_1 = __importDefault(require("assert"));
|
|
17
7
|
const graceful_fs_1 = __importDefault(require("../compiled/graceful-fs"));
|
|
18
|
-
const builtin_plugin_1 = require("./builtin-plugin");
|
|
19
|
-
const EntryOptionPlugin_1 = __importDefault(require("./lib/EntryOptionPlugin"));
|
|
20
|
-
const ignoreWarningsPlugin_1 = __importDefault(require("./lib/ignoreWarningsPlugin"));
|
|
21
8
|
const DefaultStatsFactoryPlugin_1 = require("./stats/DefaultStatsFactoryPlugin");
|
|
22
9
|
const DefaultStatsPrinterPlugin_1 = require("./stats/DefaultStatsPrinterPlugin");
|
|
23
|
-
const assertNotNil_1 = require("./util/assertNotNil");
|
|
24
10
|
const cleverMerge_1 = require("./util/cleverMerge");
|
|
11
|
+
const assert_1 = __importDefault(require("assert"));
|
|
12
|
+
const ignoreWarningsPlugin_1 = __importDefault(require("./lib/ignoreWarningsPlugin"));
|
|
13
|
+
const EntryOptionPlugin_1 = __importDefault(require("./lib/EntryOptionPlugin"));
|
|
14
|
+
const builtin_plugin_1 = require("./builtin-plugin");
|
|
15
|
+
const assertNotNil_1 = require("./util/assertNotNil");
|
|
25
16
|
class RspackOptionsApply {
|
|
26
17
|
constructor() { }
|
|
27
18
|
process(options, compiler) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
3
2
|
import { Compiler } from "../Compiler";
|
|
3
|
+
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
4
|
export type ConsumeSharedPluginOptions = {
|
|
5
5
|
consumes: Consumes;
|
|
6
6
|
shareScope?: string;
|
|
@@ -4,8 +4,8 @@ exports.ConsumeSharedPlugin = void 0;
|
|
|
4
4
|
const binding_1 = require("@rspack/binding");
|
|
5
5
|
const base_1 = require("../builtin-plugin/base");
|
|
6
6
|
const options_1 = require("../container/options");
|
|
7
|
-
const ShareRuntimePlugin_1 = require("./ShareRuntimePlugin");
|
|
8
7
|
const utils_1 = require("./utils");
|
|
8
|
+
const ShareRuntimePlugin_1 = require("./ShareRuntimePlugin");
|
|
9
9
|
class ConsumeSharedPlugin extends base_1.RspackBuiltinPlugin {
|
|
10
10
|
constructor(options) {
|
|
11
11
|
var _a;
|
|
@@ -33,11 +33,11 @@ exports.DefaultStatsFactoryPlugin = void 0;
|
|
|
33
33
|
* Copyright (c) JS Foundation and other contributors
|
|
34
34
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
35
35
|
*/
|
|
36
|
-
const util = __importStar(require("node:util"));
|
|
37
|
-
const Logger_1 = require("../logging/Logger");
|
|
38
36
|
const comparators_1 = require("../util/comparators");
|
|
39
37
|
const identifier_1 = require("../util/identifier");
|
|
38
|
+
const util = __importStar(require("node:util"));
|
|
40
39
|
const statsFactoryUtils_1 = require("./statsFactoryUtils");
|
|
40
|
+
const Logger_1 = require("../logging/Logger");
|
|
41
41
|
const compareIds = comparators_1.compareIds;
|
|
42
42
|
const GROUP_EXTENSION_REGEXP = /(\.[^.]+?)(?:\?|(?: \+ \d+ modules?)?$)/;
|
|
43
43
|
const GROUP_PATH_REGEXP = /(.+)[/\\][^/\\]+?(?:\?|(?: \+ \d+ modules?)?$)/;
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { JsStats, JsStatsError, JsStatsWarning } from "@rspack/binding";
|
|
11
10
|
import { HookMap, SyncBailHook, SyncWaterfallHook } from "tapable";
|
|
12
|
-
import type { Compilation } from "../Compilation";
|
|
13
11
|
import { GroupConfig } from "../util/smartGrouping";
|
|
12
|
+
import type { Compilation } from "../Compilation";
|
|
13
|
+
import { JsStats, JsStatsError, JsStatsWarning } from "@rspack/binding";
|
|
14
14
|
export type KnownStatsFactoryContext = {
|
|
15
15
|
type: string;
|
|
16
16
|
makePathsRelative?: ((arg0: string) => string) | undefined;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StatsFactory = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The following code is modified based on
|
|
6
|
+
* https://github.com/webpack/webpack/tree/4b4ca3bb53f36a5b8fc6bc1bd976ed7af161bd80/lib/stats
|
|
7
|
+
*
|
|
8
|
+
* MIT Licensed
|
|
9
|
+
* Author Tobias Koppers @sokra
|
|
10
|
+
* Copyright (c) JS Foundation and other contributors
|
|
11
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
12
|
+
*/
|
|
4
13
|
const tapable_1 = require("tapable");
|
|
5
14
|
const comparators_1 = require("../util/comparators");
|
|
6
15
|
const smartGrouping_1 = require("../util/smartGrouping");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HookMap, SyncBailHook, SyncWaterfallHook } from "tapable";
|
|
2
|
-
import type { StatsAsset, StatsChunk, StatsChunkGroup,
|
|
2
|
+
import type { StatsAsset, StatsChunk, StatsChunkGroup, StatsModule, StatsModuleReason, StatsCompilation } from "./statsFactoryUtils";
|
|
3
3
|
type PrintedElement = {
|
|
4
4
|
element: string;
|
|
5
5
|
content: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as binding from "@rspack/binding";
|
|
2
|
+
import { type Comparator } from "../util/comparators";
|
|
2
3
|
import type { Compilation } from "../Compilation";
|
|
3
4
|
import type { StatsOptions } from "../config";
|
|
4
|
-
import { type Comparator } from "../util/comparators";
|
|
5
5
|
import type { StatsFactory, StatsFactoryContext } from "./StatsFactory";
|
|
6
6
|
export type KnownStatsChunkGroup = binding.JsStatsChunkGroup;
|
|
7
7
|
export type KnownStatsChunk = binding.JsStatsChunk;
|
|
@@ -16,5 +16,5 @@ export declare const compareIds: (a: string | number, b: string | number) => -1
|
|
|
16
16
|
export declare const compareChunksById: (a: Chunk, b: Chunk) => -1 | 0 | 1;
|
|
17
17
|
export declare const compareChunkGroupsByIndex: (a: ChunkGroup, b: ChunkGroup) => -1 | 0 | 1;
|
|
18
18
|
export declare const compareSelect: <T, R>(getter: Selector<T, R>, comparator: Comparator) => Comparator;
|
|
19
|
-
export declare const compareNumbers: (a: number, b: number) =>
|
|
19
|
+
export declare const compareNumbers: (a: number, b: number) => 1 | -1 | 0;
|
|
20
20
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JsCompatSource } from "@rspack/binding";
|
|
2
|
+
import { Source } from "webpack-sources";
|
|
3
|
+
declare function createSourceFromRaw(source: JsCompatSource): Source;
|
|
4
|
+
declare function createRawFromSource(source: Source): JsCompatSource;
|
|
5
|
+
export { createSourceFromRaw, createRawFromSource };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRawFromSource = exports.createSourceFromRaw = void 0;
|
|
4
|
+
const webpack_sources_1 = require("webpack-sources");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
function createSourceFromRaw(source) {
|
|
7
|
+
if (source.isRaw) {
|
|
8
|
+
return new webpack_sources_1.RawSource(
|
|
9
|
+
// @ts-expect-error: webpack-sources can accept buffer as source, see: https://github.com/webpack/webpack-sources/blob/9f98066311d53a153fdc7c633422a1d086528027/lib/RawSource.js#L12
|
|
10
|
+
source.isBuffer ? source.source : source.source.toString("utf-8"));
|
|
11
|
+
}
|
|
12
|
+
if (!source.map) {
|
|
13
|
+
return new webpack_sources_1.RawSource(source.source.toString("utf-8"));
|
|
14
|
+
}
|
|
15
|
+
return new webpack_sources_1.CompatSource({
|
|
16
|
+
source() {
|
|
17
|
+
return source.source.toString("utf-8");
|
|
18
|
+
},
|
|
19
|
+
buffer() {
|
|
20
|
+
return source.source;
|
|
21
|
+
},
|
|
22
|
+
map(_) {
|
|
23
|
+
if (source.map) {
|
|
24
|
+
return JSON.parse(source.map.toString("utf-8"));
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.createSourceFromRaw = createSourceFromRaw;
|
|
31
|
+
function createRawFromSource(source) {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
const sourceSource = source.source();
|
|
34
|
+
const isBuffer = Buffer.isBuffer(sourceSource);
|
|
35
|
+
if (source instanceof webpack_sources_1.RawSource) {
|
|
36
|
+
return {
|
|
37
|
+
source: source.buffer(),
|
|
38
|
+
isRaw: true,
|
|
39
|
+
isBuffer
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const buffer = (_b = (_a = source.buffer) === null || _a === void 0 ? void 0 : _a.call(source)) !== null && _b !== void 0 ? _b : (isBuffer
|
|
43
|
+
? sourceSource
|
|
44
|
+
: sourceSource instanceof ArrayBuffer
|
|
45
|
+
? arrayBufferToBuffer(sourceSource)
|
|
46
|
+
: Buffer.from(sourceSource));
|
|
47
|
+
const map = JSON.stringify((_c = source.map) === null || _c === void 0 ? void 0 : _c.call(source, {
|
|
48
|
+
columns: true
|
|
49
|
+
}));
|
|
50
|
+
return {
|
|
51
|
+
source: buffer,
|
|
52
|
+
map: (0, index_1.isNil)(map) ? map : Buffer.from(map),
|
|
53
|
+
isRaw: false,
|
|
54
|
+
isBuffer
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exports.createRawFromSource = createRawFromSource;
|
|
58
|
+
function arrayBufferToBuffer(ab) {
|
|
59
|
+
const buf = Buffer.alloc(ab.byteLength);
|
|
60
|
+
const view = new Uint8Array(ab);
|
|
61
|
+
for (let i = 0; i < buf.length; ++i) {
|
|
62
|
+
buf[i] = view[i];
|
|
63
|
+
}
|
|
64
|
+
return buf;
|
|
65
|
+
}
|
package/dist/util/fs.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The following code is modified based on
|
|
3
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/util/fs.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
|
-
/// <reference types="node" />
|
|
11
|
-
/// <reference types="node" />
|
|
12
1
|
import { WatchOptions } from "../config";
|
|
13
2
|
export interface Watcher {
|
|
14
3
|
close(): void;
|
|
@@ -25,58 +14,6 @@ export interface WatcherInfo {
|
|
|
25
14
|
fileTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">;
|
|
26
15
|
contextTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">;
|
|
27
16
|
}
|
|
28
|
-
interface IDirent {
|
|
29
|
-
isFile: () => boolean;
|
|
30
|
-
isDirectory: () => boolean;
|
|
31
|
-
isBlockDevice: () => boolean;
|
|
32
|
-
isCharacterDevice: () => boolean;
|
|
33
|
-
isSymbolicLink: () => boolean;
|
|
34
|
-
isFIFO: () => boolean;
|
|
35
|
-
isSocket: () => boolean;
|
|
36
|
-
name: string | Buffer;
|
|
37
|
-
}
|
|
38
|
-
interface IStats {
|
|
39
|
-
isFile: () => boolean;
|
|
40
|
-
isDirectory: () => boolean;
|
|
41
|
-
isBlockDevice: () => boolean;
|
|
42
|
-
isCharacterDevice: () => boolean;
|
|
43
|
-
isSymbolicLink: () => boolean;
|
|
44
|
-
isFIFO: () => boolean;
|
|
45
|
-
isSocket: () => boolean;
|
|
46
|
-
dev: number | bigint;
|
|
47
|
-
ino: number | bigint;
|
|
48
|
-
mode: number | bigint;
|
|
49
|
-
nlink: number | bigint;
|
|
50
|
-
uid: number | bigint;
|
|
51
|
-
gid: number | bigint;
|
|
52
|
-
rdev: number | bigint;
|
|
53
|
-
size: number | bigint;
|
|
54
|
-
blksize: number | bigint;
|
|
55
|
-
blocks: number | bigint;
|
|
56
|
-
atimeMs: number | bigint;
|
|
57
|
-
mtimeMs: number | bigint;
|
|
58
|
-
ctimeMs: number | bigint;
|
|
59
|
-
birthtimeMs: number | bigint;
|
|
60
|
-
atime: Date;
|
|
61
|
-
mtime: Date;
|
|
62
|
-
ctime: Date;
|
|
63
|
-
birthtime: Date;
|
|
64
|
-
}
|
|
65
|
-
export interface OutputFileSystem {
|
|
66
|
-
writeFile: (arg0: string, arg1: string | Buffer, arg2: (arg0?: null | NodeJS.ErrnoException) => void) => void;
|
|
67
|
-
mkdir: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException) => void) => void;
|
|
68
|
-
readdir: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: (string | Buffer)[] | IDirent[]) => void) => void;
|
|
69
|
-
rmdir: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException) => void) => void;
|
|
70
|
-
unlink: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException) => void) => void;
|
|
71
|
-
stat: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void) => void;
|
|
72
|
-
lstat?: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void) => void;
|
|
73
|
-
readFile: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: string | Buffer) => void) => void;
|
|
74
|
-
join?: (arg0: string, arg1: string) => string;
|
|
75
|
-
relative?: (arg0: string, arg1: string) => string;
|
|
76
|
-
dirname?: (arg0: string) => string;
|
|
77
|
-
}
|
|
78
|
-
export declare function rmrf(fs: OutputFileSystem, p: string, callback: (err?: Error | null) => void): void;
|
|
79
|
-
export declare const mkdirp: (fs: OutputFileSystem, p: string, callback: (error?: Error) => void) => void;
|
|
80
17
|
export interface FileSystemInfoEntry {
|
|
81
18
|
safeTime: number;
|
|
82
19
|
timestamp?: number;
|
|
@@ -84,4 +21,3 @@ export interface FileSystemInfoEntry {
|
|
|
84
21
|
export interface WatchFileSystem {
|
|
85
22
|
watch(files: Iterable<string>, directories: Iterable<string>, missing: Iterable<string>, startTime: number, options: WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
|
|
86
23
|
}
|
|
87
|
-
export {};
|
package/dist/util/fs.js
CHANGED
|
@@ -1,124 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/util/fs.js
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.mkdirp = exports.rmrf = void 0;
|
|
16
|
-
const assert_1 = __importDefault(require("assert"));
|
|
17
|
-
const path_1 = __importDefault(require("path"));
|
|
18
|
-
function rmrf(fs, p, callback) {
|
|
19
|
-
fs.stat(p, (err, stats) => {
|
|
20
|
-
if (err) {
|
|
21
|
-
if (err.code === "ENOENT") {
|
|
22
|
-
return callback();
|
|
23
|
-
}
|
|
24
|
-
return callback(err);
|
|
25
|
-
}
|
|
26
|
-
if (stats.isDirectory()) {
|
|
27
|
-
fs.readdir(p, (err, files) => {
|
|
28
|
-
if (err) {
|
|
29
|
-
return callback(err);
|
|
30
|
-
}
|
|
31
|
-
let count = files.length;
|
|
32
|
-
if (count === 0) {
|
|
33
|
-
fs.rmdir(p, callback);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
files.forEach(file => {
|
|
37
|
-
(0, assert_1.default)(typeof file === "string");
|
|
38
|
-
const fullPath = join(fs, p, file);
|
|
39
|
-
rmrf(fs, fullPath, err => {
|
|
40
|
-
if (err) {
|
|
41
|
-
return callback(err);
|
|
42
|
-
}
|
|
43
|
-
count--;
|
|
44
|
-
if (count === 0) {
|
|
45
|
-
fs.rmdir(p, callback);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
fs.unlink(p, callback);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
exports.rmrf = rmrf;
|
|
58
|
-
const join = (fs, rootPath, filename) => {
|
|
59
|
-
if (fs && fs.join) {
|
|
60
|
-
return fs.join(rootPath, filename);
|
|
61
|
-
}
|
|
62
|
-
else if (path_1.default.posix.isAbsolute(rootPath)) {
|
|
63
|
-
return path_1.default.posix.join(rootPath, filename);
|
|
64
|
-
}
|
|
65
|
-
else if (path_1.default.win32.isAbsolute(rootPath)) {
|
|
66
|
-
return path_1.default.win32.join(rootPath, filename);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
throw new Error(`${rootPath} is neither a posix nor a windows path, and there is no 'join' method defined in the file system`);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const dirname = (fs, absPath) => {
|
|
73
|
-
if (fs && fs.dirname) {
|
|
74
|
-
return fs.dirname(absPath);
|
|
75
|
-
}
|
|
76
|
-
else if (path_1.default.posix.isAbsolute(absPath)) {
|
|
77
|
-
return path_1.default.posix.dirname(absPath);
|
|
78
|
-
}
|
|
79
|
-
else if (path_1.default.win32.isAbsolute(absPath)) {
|
|
80
|
-
return path_1.default.win32.dirname(absPath);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
throw new Error(`${absPath} is neither a posix nor a windows path, and there is no 'dirname' method defined in the file system`);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const mkdirp = (fs, p, callback) => {
|
|
87
|
-
fs.mkdir(p, err => {
|
|
88
|
-
if (err) {
|
|
89
|
-
if (err.code === "ENOENT") {
|
|
90
|
-
const dir = dirname(fs, p);
|
|
91
|
-
if (dir === p) {
|
|
92
|
-
callback(err);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
(0, exports.mkdirp)(fs, dir, err => {
|
|
96
|
-
if (err) {
|
|
97
|
-
callback(err);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
fs.mkdir(p, err => {
|
|
101
|
-
if (err) {
|
|
102
|
-
if (err.code === "EEXIST") {
|
|
103
|
-
callback();
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
callback(err);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
callback();
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
else if (err.code === "EEXIST") {
|
|
115
|
-
callback();
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
callback(err);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
callback();
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
exports.mkdirp = mkdirp;
|
package/dist/util/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const toObject: (input: string | Buffer | object) => object;
|
|
|
11
11
|
export declare function serializeObject(map: string | object | undefined | null): Buffer | undefined;
|
|
12
12
|
export declare function isPromiseLike(value: unknown): value is Promise<any>;
|
|
13
13
|
export declare function isJsStatsError(err: any): err is JsStatsError;
|
|
14
|
-
export declare function concatErrorMsgAndStack(err: Error | JsStatsError
|
|
14
|
+
export declare function concatErrorMsgAndStack(err: Error | JsStatsError): string;
|
|
15
15
|
export declare function indent(str: string, prefix: string): string;
|
|
16
16
|
export declare function stringifyLoaderObject(o: LoaderObject): string;
|
|
17
17
|
export declare function asArray<T>(item: T[]): T[];
|
|
@@ -19,4 +19,3 @@ export declare function asArray<T>(item: readonly T[]): readonly T[];
|
|
|
19
19
|
export declare function asArray<T>(item: T): T[];
|
|
20
20
|
export declare function toJsAssetInfo(info?: AssetInfo): JsAssetInfo;
|
|
21
21
|
export declare const deprecatedWarn: (content: string, enable?: boolean) => void;
|
|
22
|
-
export declare const unsupported: (name: string, issue?: string) => never;
|
package/dist/util/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.deprecatedWarn = exports.toJsAssetInfo = exports.asArray = exports.stringifyLoaderObject = exports.indent = exports.concatErrorMsgAndStack = exports.isJsStatsError = exports.isPromiseLike = exports.serializeObject = exports.toObject = exports.toBuffer = exports.isNil = exports.mapValues = void 0;
|
|
4
4
|
function mapValues(record, fn) {
|
|
5
5
|
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, fn(value)]));
|
|
6
6
|
}
|
|
@@ -60,13 +60,16 @@ function isJsStatsError(err) {
|
|
|
60
60
|
}
|
|
61
61
|
exports.isJsStatsError = isJsStatsError;
|
|
62
62
|
function concatErrorMsgAndStack(err) {
|
|
63
|
-
if
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
// deduplicate the error if message is already shown in the stack
|
|
64
|
+
//@ts-ignore
|
|
65
|
+
const stackStartPrefix = err.name ? `${err.name}: ` : "Error: ";
|
|
66
|
+
return isJsStatsError(err)
|
|
67
|
+
? err.formatted
|
|
68
|
+
: err.stack
|
|
69
|
+
? err.stack.startsWith(`${stackStartPrefix}${err.message}`)
|
|
70
|
+
? `${err.stack}`
|
|
71
|
+
: `${err.message}\n${err.stack}`
|
|
72
|
+
: `${err.message}`;
|
|
70
73
|
}
|
|
71
74
|
exports.concatErrorMsgAndStack = concatErrorMsgAndStack;
|
|
72
75
|
function indent(str, prefix) {
|
|
@@ -113,11 +116,3 @@ const deprecatedWarn = (content, enable = getDeprecationStatus()) => {
|
|
|
113
116
|
}
|
|
114
117
|
};
|
|
115
118
|
exports.deprecatedWarn = deprecatedWarn;
|
|
116
|
-
const unsupported = (name, issue) => {
|
|
117
|
-
let s = `${name} is not supported by rspack.`;
|
|
118
|
-
if (issue) {
|
|
119
|
-
s += ` Please refer to issue ${issue} for more information.`;
|
|
120
|
-
}
|
|
121
|
-
throw new Error(s);
|
|
122
|
-
};
|
|
123
|
-
exports.unsupported = unsupported;
|