@rspack/core 1.0.10 → 1.0.11
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/builtin-plugin/css-extract/utils.d.ts +1 -0
- package/dist/config/types.d.ts +309 -0
- package/dist/config/zod.d.ts +22 -534
- package/dist/cssExtractHmr.js +224 -0
- package/dist/cssExtractLoader.js +277 -0
- package/dist/index.js +23347 -31
- package/dist/{builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts → runtime/cssExtractHmr.d.ts} +1 -0
- package/dist/runtime/moduleFederationDefaultRuntime.d.ts +2 -0
- package/dist/stats/statsFactoryUtils.d.ts +1 -0
- package/package.json +8 -5
- package/compiled/json-parse-even-better-errors/index.d.ts +0 -1
- package/compiled/json-parse-even-better-errors/index.js +0 -193
- package/compiled/json-parse-even-better-errors/package.json +0 -1
- package/compiled/neo-async/index.d.ts +0 -685
- package/compiled/neo-async/index.js +0 -9207
- package/compiled/neo-async/license +0 -22
- package/compiled/neo-async/package.json +0 -1
- package/compiled/zod-validation-error/index.d.ts +0 -41
- package/compiled/zod-validation-error/index.js +0 -335
- package/compiled/zod-validation-error/license +0 -9
- package/compiled/zod-validation-error/package.json +0 -1
- package/dist/Chunk.js +0 -118
- package/dist/ChunkGraph.js +0 -27
- package/dist/ChunkGroup.js +0 -76
- package/dist/Compilation.js +0 -854
- package/dist/Compiler.js +0 -925
- package/dist/ContextModuleFactory.js +0 -36
- package/dist/DependenciesBlock.js +0 -30
- package/dist/Dependency.js +0 -43
- package/dist/Entrypoint.js +0 -21
- package/dist/ErrorHelpers.js +0 -62
- package/dist/ExecuteModulePlugin.js +0 -46
- package/dist/FileSystem.js +0 -34
- package/dist/FileSystemInfo.js +0 -2
- package/dist/Module.js +0 -226
- package/dist/ModuleTypeConstants.js +0 -92
- package/dist/MultiCompiler.js +0 -440
- package/dist/MultiStats.js +0 -161
- package/dist/MultiWatching.js +0 -62
- package/dist/NormalModule.js +0 -97
- package/dist/NormalModuleFactory.js +0 -43
- package/dist/Resolver.js +0 -39
- package/dist/ResolverFactory.js +0 -61
- package/dist/RspackError.js +0 -21
- package/dist/RuleSetCompiler.js +0 -10
- package/dist/RuntimeGlobals.js +0 -357
- package/dist/RuntimeModule.js +0 -58
- package/dist/Stats.js +0 -161
- package/dist/Template.js +0 -206
- package/dist/Watching.js +0 -290
- package/dist/builtin-loader/index.js +0 -17
- package/dist/builtin-loader/lightningcss/index.js +0 -175
- package/dist/builtin-loader/swc/index.js +0 -5
- package/dist/builtin-loader/swc/pluginImport.js +0 -35
- package/dist/builtin-loader/swc/react.js +0 -7
- package/dist/builtin-loader/swc/types.js +0 -2
- package/dist/builtin-plugin/APIPlugin.js +0 -6
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.js +0 -6
- package/dist/builtin-plugin/AssetModulesPlugin.js +0 -6
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.js +0 -6
- package/dist/builtin-plugin/BannerPlugin.js +0 -22
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.js +0 -12
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.js +0 -6
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.js +0 -6
- package/dist/builtin-plugin/ContextReplacementPlugin.js +0 -43
- package/dist/builtin-plugin/CopyRspackPlugin.js +0 -21
- package/dist/builtin-plugin/CssModulesPlugin.js +0 -6
- package/dist/builtin-plugin/DataUriPlugin.js +0 -6
- package/dist/builtin-plugin/DefinePlugin.js +0 -44
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.js +0 -6
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.js +0 -6
- package/dist/builtin-plugin/DynamicEntryPlugin.js +0 -36
- package/dist/builtin-plugin/ElectronTargetPlugin.js +0 -6
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +0 -6
- package/dist/builtin-plugin/EnableLibraryPlugin.js +0 -39
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +0 -6
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.js +0 -6
- package/dist/builtin-plugin/EntryPlugin.js +0 -34
- package/dist/builtin-plugin/EvalDevToolModulePlugin.js +0 -6
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.js +0 -16
- package/dist/builtin-plugin/ExternalsPlugin.js +0 -51
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.js +0 -6
- package/dist/builtin-plugin/FileUriPlugin.js +0 -6
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.js +0 -6
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.js +0 -6
- package/dist/builtin-plugin/HotModuleReplacementPlugin.js +0 -18
- package/dist/builtin-plugin/HtmlRspackPlugin.js +0 -285
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.js +0 -11
- package/dist/builtin-plugin/IgnorePlugin.js +0 -20
- package/dist/builtin-plugin/InferAsyncModulesPlugin.js +0 -6
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +0 -55
- package/dist/builtin-plugin/JsLoaderRspackPlugin.js +0 -9
- package/dist/builtin-plugin/JsonModulesPlugin.js +0 -6
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +0 -30
- package/dist/builtin-plugin/LimitChunkCountPlugin.js +0 -8
- package/dist/builtin-plugin/MangleExportsPlugin.js +0 -6
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.js +0 -6
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.js +0 -6
- package/dist/builtin-plugin/ModuleConcatenationPlugin.js +0 -6
- package/dist/builtin-plugin/NamedChunkIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NamedModuleIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.js +0 -6
- package/dist/builtin-plugin/NoEmitOnErrorsPlugin.js +0 -6
- package/dist/builtin-plugin/NodeTargetPlugin.js +0 -6
- package/dist/builtin-plugin/ProgressPlugin.js +0 -15
- package/dist/builtin-plugin/ProvidePlugin.js +0 -14
- package/dist/builtin-plugin/RealContentHashPlugin.js +0 -6
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.js +0 -6
- package/dist/builtin-plugin/RuntimeChunkPlugin.js +0 -6
- package/dist/builtin-plugin/RuntimePlugin.js +0 -6
- package/dist/builtin-plugin/SideEffectsFlagPlugin.js +0 -6
- package/dist/builtin-plugin/SizeLimitsPlugin.js +0 -9
- package/dist/builtin-plugin/SourceMapDevToolPlugin.js +0 -14
- package/dist/builtin-plugin/SplitChunksPlugin.js +0 -92
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +0 -80
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.js +0 -6
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.js +0 -6
- package/dist/builtin-plugin/WorkerPlugin.js +0 -31
- package/dist/builtin-plugin/base.js +0 -58
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +0 -182
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +0 -2
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +0 -31
- package/dist/builtin-plugin/css-extract/index.js +0 -105
- package/dist/builtin-plugin/css-extract/loader.js +0 -204
- package/dist/builtin-plugin/css-extract/utils.js +0 -51
- package/dist/builtin-plugin/index.js +0 -84
- package/dist/builtin-plugin/lazy-compilation/backend.js +0 -139
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.js +0 -6
- package/dist/builtin-plugin/lazy-compilation/plugin.js +0 -60
- package/dist/config/adapter.js +0 -691
- package/dist/config/adapterRuleUse.js +0 -107
- package/dist/config/browserslistTargetHandler.js +0 -345
- package/dist/config/defaults.js +0 -876
- package/dist/config/index.js +0 -20
- package/dist/config/normalization.js +0 -299
- package/dist/config/target.js +0 -318
- package/dist/config/types.js +0 -3
- package/dist/config/zod.js +0 -1030
- package/dist/container/ContainerPlugin.js +0 -50
- package/dist/container/ContainerReferencePlugin.js +0 -49
- package/dist/container/ModuleFederationPlugin.js +0 -137
- package/dist/container/ModuleFederationPluginV1.js +0 -63
- package/dist/container/ModuleFederationRuntimePlugin.js +0 -6
- package/dist/container/options.js +0 -48
- package/dist/error/ConcurrentCompilationError.js +0 -20
- package/dist/exports.js +0 -183
- package/dist/lib/AbstractMethodError.js +0 -51
- package/dist/lib/Cache.js +0 -111
- package/dist/lib/CacheFacade.js +0 -321
- package/dist/lib/Dependency.js +0 -11
- package/dist/lib/EntryOptionPlugin.js +0 -89
- package/dist/lib/EnvironmentPlugin.js +0 -57
- package/dist/lib/HookWebpackError.js +0 -83
- package/dist/lib/IgnoreWarningsPlugin.js +0 -35
- package/dist/lib/LoaderOptionsPlugin.js +0 -74
- package/dist/lib/LoaderTargetPlugin.js +0 -37
- package/dist/lib/ModuleFilenameHelpers.js +0 -83
- package/dist/lib/NormalModuleReplacementPlugin.js +0 -85
- package/dist/lib/WebpackError.js +0 -20
- package/dist/lib/cache/MemoryCachePlugin.js +0 -40
- package/dist/lib/cache/getLazyHashedEtag.js +0 -73
- package/dist/lib/cache/mergeEtags.js +0 -74
- package/dist/lib/formatLocation.js +0 -64
- package/dist/loader-runner/LoaderLoadingError.js +0 -19
- package/dist/loader-runner/index.js +0 -735
- package/dist/loader-runner/loadLoader.js +0 -64
- package/dist/logging/Logger.js +0 -143
- package/dist/logging/createConsoleLogger.js +0 -176
- package/dist/logging/runtime.js +0 -37
- package/dist/logging/truncateArgs.js +0 -81
- package/dist/node/NodeEnvironmentPlugin.js +0 -50
- package/dist/node/NodeTemplatePlugin.js +0 -26
- package/dist/node/NodeWatchFileSystem.js +0 -144
- package/dist/node/nodeConsole.js +0 -146
- package/dist/rspack.js +0 -123
- package/dist/rspackOptionsApply.js +0 -274
- package/dist/sharing/ConsumeSharedPlugin.js +0 -69
- package/dist/sharing/ProvideSharedPlugin.js +0 -50
- package/dist/sharing/SharePlugin.js +0 -66
- package/dist/sharing/ShareRuntimePlugin.js +0 -26
- package/dist/sharing/utils.js +0 -8
- package/dist/stats/DefaultStatsFactoryPlugin.js +0 -1173
- package/dist/stats/DefaultStatsPresetPlugin.js +0 -305
- package/dist/stats/DefaultStatsPrinterPlugin.js +0 -1069
- package/dist/stats/StatsFactory.js +0 -167
- package/dist/stats/StatsPrinter.js +0 -142
- package/dist/stats/statsFactoryUtils.js +0 -341
- package/dist/util/ArrayQueue.js +0 -108
- package/dist/util/AssetInfo.js +0 -39
- package/dist/util/IterableHelpers.js +0 -35
- package/dist/util/MergeCaller.js +0 -24
- package/dist/util/SizeFormatHelpers.js +0 -24
- package/dist/util/SplitChunkSize.js +0 -18
- package/dist/util/assertNotNil.js +0 -9
- package/dist/util/assetCondition.js +0 -2
- package/dist/util/bindingVersionCheck.js +0 -124
- package/dist/util/cleverMerge.js +0 -504
- package/dist/util/comparators.js +0 -108
- package/dist/util/createHash.js +0 -161
- package/dist/util/createReadonlyMap.js +0 -29
- package/dist/util/fake.js +0 -28
- package/dist/util/fs.js +0 -120
- package/dist/util/hash/BatchedHash.js +0 -69
- package/dist/util/hash/index.js +0 -39
- package/dist/util/hash/md4.js +0 -27
- package/dist/util/hash/wasm-hash.js +0 -167
- package/dist/util/hash/xxhash64.js +0 -27
- package/dist/util/identifier.js +0 -330
- package/dist/util/index.js +0 -123
- package/dist/util/memoize.js +0 -61
- package/dist/util/scheme.js +0 -57
- package/dist/util/smartGrouping.js +0 -148
- package/dist/util/source.js +0 -42
- package/dist/util/validate.js +0 -77
- package/dist/util/webpack.js +0 -27
- /package/dist/{container/default.runtime.js → moduleFederationDefaultRuntime.js} +0 -0
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is from
|
|
4
|
-
* https://github.com/webpack/loader-runner
|
|
5
|
-
*
|
|
6
|
-
* MIT Licensed
|
|
7
|
-
* Author Tobias Koppers @sokra
|
|
8
|
-
* Copyright (c) JS Foundation and other contributors
|
|
9
|
-
* https://github.com/webpack/loader-runner/blob/main/LICENSE
|
|
10
|
-
*/
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const LoaderLoadingError_1 = __importDefault(require("./LoaderLoadingError"));
|
|
16
|
-
let url = undefined;
|
|
17
|
-
function loadLoader(loader, callback) {
|
|
18
|
-
if (loader.type === "module") {
|
|
19
|
-
try {
|
|
20
|
-
if (url === undefined)
|
|
21
|
-
url = require("node:url");
|
|
22
|
-
const loaderUrl = url.pathToFileURL(loader.path);
|
|
23
|
-
const modulePromise = import(loaderUrl.toString());
|
|
24
|
-
modulePromise.then((module) => {
|
|
25
|
-
handleResult(loader, module, callback);
|
|
26
|
-
}, callback);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
catch (e) {
|
|
30
|
-
callback(e);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
let module;
|
|
35
|
-
try {
|
|
36
|
-
module = require(loader.path);
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
// it is possible for node to choke on a require if the FD descriptor
|
|
40
|
-
// limit has been reached. give it a chance to recover.
|
|
41
|
-
if (e instanceof Error &&
|
|
42
|
-
e.code === "EMFILE") {
|
|
43
|
-
const retry = loadLoader.bind(null, loader, callback);
|
|
44
|
-
return void setImmediate(retry);
|
|
45
|
-
}
|
|
46
|
-
return callback(e);
|
|
47
|
-
}
|
|
48
|
-
return handleResult(loader, module, callback);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.default = loadLoader;
|
|
52
|
-
function handleResult(loader, module, callback) {
|
|
53
|
-
if (typeof module !== "function" && typeof module !== "object") {
|
|
54
|
-
return callback(new LoaderLoadingError_1.default(`Module '${loader.path}' is not a loader (export function or es6 module)`));
|
|
55
|
-
}
|
|
56
|
-
loader.normal = typeof module === "function" ? module : module.default;
|
|
57
|
-
loader.pitch = module.pitch;
|
|
58
|
-
loader.raw = module.raw;
|
|
59
|
-
if (typeof loader.normal !== "function" &&
|
|
60
|
-
typeof loader.pitch !== "function") {
|
|
61
|
-
return callback(new LoaderLoadingError_1.default(`Module '${loader.path}' is not a loader (must have normal or pitch function)`));
|
|
62
|
-
}
|
|
63
|
-
callback();
|
|
64
|
-
}
|
package/dist/logging/Logger.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/logging/Logger.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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Logger = exports.getLogTypesBitFlag = exports.getLogTypeBitFlag = exports.LogType = void 0;
|
|
13
|
-
exports.LogType = Object.freeze({
|
|
14
|
-
error: /** @type {"error"} */ "error",
|
|
15
|
-
warn: /** @type {"warn"} */ "warn",
|
|
16
|
-
info: /** @type {"info"} */ "info",
|
|
17
|
-
log: /** @type {"log"} */ "log",
|
|
18
|
-
debug: /** @type {"debug"} */ "debug",
|
|
19
|
-
trace: /** @type {"trace"} */ "trace",
|
|
20
|
-
group: /** @type {"group"} */ "group",
|
|
21
|
-
groupCollapsed: /** @type {"groupCollapsed"} */ "groupCollapsed",
|
|
22
|
-
groupEnd: /** @type {"groupEnd"} */ "groupEnd",
|
|
23
|
-
profile: /** @type {"profile"} */ "profile",
|
|
24
|
-
profileEnd: /** @type {"profileEnd"} */ "profileEnd",
|
|
25
|
-
time: /** @type {"time"} */ "time",
|
|
26
|
-
clear: /** @type {"clear"} */ "clear",
|
|
27
|
-
status: /** @type {"status"} */ "status",
|
|
28
|
-
cache: /** @type {"cache"} */ "cache" // [hit, total]
|
|
29
|
-
});
|
|
30
|
-
function getLogTypeBitFlag(type) {
|
|
31
|
-
return 1 << Object.values(exports.LogType).findIndex(i => i === type);
|
|
32
|
-
}
|
|
33
|
-
exports.getLogTypeBitFlag = getLogTypeBitFlag;
|
|
34
|
-
function getLogTypesBitFlag(types) {
|
|
35
|
-
return types.reduce((acc, cur) => acc | getLogTypeBitFlag(cur), 0);
|
|
36
|
-
}
|
|
37
|
-
exports.getLogTypesBitFlag = getLogTypesBitFlag;
|
|
38
|
-
const LOG_SYMBOL = Symbol("webpack logger raw log method");
|
|
39
|
-
const TIMERS_SYMBOL = Symbol("webpack logger times");
|
|
40
|
-
const TIMERS_AGGREGATES_SYMBOL = Symbol("webpack logger aggregated times");
|
|
41
|
-
class Logger {
|
|
42
|
-
constructor(log, getChildLogger) {
|
|
43
|
-
this[LOG_SYMBOL] = log;
|
|
44
|
-
this.getChildLogger = getChildLogger;
|
|
45
|
-
}
|
|
46
|
-
error(...args) {
|
|
47
|
-
this[LOG_SYMBOL](exports.LogType.error, args);
|
|
48
|
-
}
|
|
49
|
-
warn(...args) {
|
|
50
|
-
this[LOG_SYMBOL](exports.LogType.warn, args);
|
|
51
|
-
}
|
|
52
|
-
info(...args) {
|
|
53
|
-
this[LOG_SYMBOL](exports.LogType.info, args);
|
|
54
|
-
}
|
|
55
|
-
log(...args) {
|
|
56
|
-
this[LOG_SYMBOL](exports.LogType.log, args);
|
|
57
|
-
}
|
|
58
|
-
debug(...args) {
|
|
59
|
-
this[LOG_SYMBOL](exports.LogType.debug, args);
|
|
60
|
-
}
|
|
61
|
-
assert(assertion, ...args) {
|
|
62
|
-
if (!assertion) {
|
|
63
|
-
this[LOG_SYMBOL](exports.LogType.error, args);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
trace() {
|
|
67
|
-
this[LOG_SYMBOL](exports.LogType.trace, ["Trace"]);
|
|
68
|
-
}
|
|
69
|
-
clear() {
|
|
70
|
-
this[LOG_SYMBOL](exports.LogType.clear);
|
|
71
|
-
}
|
|
72
|
-
status(...args) {
|
|
73
|
-
this[LOG_SYMBOL](exports.LogType.status, args);
|
|
74
|
-
}
|
|
75
|
-
group(...args) {
|
|
76
|
-
this[LOG_SYMBOL](exports.LogType.group, args);
|
|
77
|
-
}
|
|
78
|
-
groupCollapsed(...args) {
|
|
79
|
-
this[LOG_SYMBOL](exports.LogType.groupCollapsed, args);
|
|
80
|
-
}
|
|
81
|
-
groupEnd(...args) {
|
|
82
|
-
this[LOG_SYMBOL](exports.LogType.groupEnd, args);
|
|
83
|
-
}
|
|
84
|
-
profile(label) {
|
|
85
|
-
this[LOG_SYMBOL](exports.LogType.profile, [label]);
|
|
86
|
-
}
|
|
87
|
-
profileEnd(label) {
|
|
88
|
-
this[LOG_SYMBOL](exports.LogType.profileEnd, [label]);
|
|
89
|
-
}
|
|
90
|
-
time(label) {
|
|
91
|
-
this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map();
|
|
92
|
-
this[TIMERS_SYMBOL].set(label, process.hrtime());
|
|
93
|
-
}
|
|
94
|
-
timeLog(label) {
|
|
95
|
-
const prev = this[TIMERS_SYMBOL]?.get(label);
|
|
96
|
-
if (!prev) {
|
|
97
|
-
throw new Error(`No such label '${label}' for WebpackLogger.timeLog()`);
|
|
98
|
-
}
|
|
99
|
-
const time = process.hrtime(prev);
|
|
100
|
-
this[LOG_SYMBOL](exports.LogType.time, [label, ...time]);
|
|
101
|
-
}
|
|
102
|
-
timeEnd(label) {
|
|
103
|
-
const prev = this[TIMERS_SYMBOL]?.get(label);
|
|
104
|
-
if (!prev) {
|
|
105
|
-
throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`);
|
|
106
|
-
}
|
|
107
|
-
const time = process.hrtime(prev);
|
|
108
|
-
this[TIMERS_SYMBOL].delete(label);
|
|
109
|
-
this[LOG_SYMBOL](exports.LogType.time, [label, ...time]);
|
|
110
|
-
}
|
|
111
|
-
timeAggregate(label) {
|
|
112
|
-
const prev = this[TIMERS_SYMBOL]?.get(label);
|
|
113
|
-
if (!prev) {
|
|
114
|
-
throw new Error(`No such label '${label}' for WebpackLogger.timeAggregate()`);
|
|
115
|
-
}
|
|
116
|
-
const time = process.hrtime(prev);
|
|
117
|
-
this[TIMERS_SYMBOL].delete(label);
|
|
118
|
-
this[TIMERS_AGGREGATES_SYMBOL] =
|
|
119
|
-
this[TIMERS_AGGREGATES_SYMBOL] || new Map();
|
|
120
|
-
const current = this[TIMERS_AGGREGATES_SYMBOL].get(label);
|
|
121
|
-
if (current !== undefined) {
|
|
122
|
-
if (time[1] + current[1] > 1e9) {
|
|
123
|
-
time[0] += current[0] + 1;
|
|
124
|
-
time[1] = time[1] - 1e9 + current[1];
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
time[0] += current[0];
|
|
128
|
-
time[1] += current[1];
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
this[TIMERS_AGGREGATES_SYMBOL].set(label, time);
|
|
132
|
-
}
|
|
133
|
-
timeAggregateEnd(label) {
|
|
134
|
-
if (this[TIMERS_AGGREGATES_SYMBOL] === undefined)
|
|
135
|
-
return;
|
|
136
|
-
const time = this[TIMERS_AGGREGATES_SYMBOL].get(label);
|
|
137
|
-
if (time === undefined)
|
|
138
|
-
return;
|
|
139
|
-
this[TIMERS_AGGREGATES_SYMBOL].delete(label);
|
|
140
|
-
this[LOG_SYMBOL](exports.LogType.time, [label, ...time]);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
exports.Logger = Logger;
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/logging/createConsoleLogger.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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createConsoleLogger = void 0;
|
|
13
|
-
const Logger_1 = require("./Logger");
|
|
14
|
-
const filterToFunction = (item) => {
|
|
15
|
-
if (typeof item === "string") {
|
|
16
|
-
const regExp = new RegExp(`[\\\\/]${item.replace(
|
|
17
|
-
// eslint-disable-next-line no-useless-escape
|
|
18
|
-
/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)`);
|
|
19
|
-
return ident => regExp.test(ident);
|
|
20
|
-
}
|
|
21
|
-
if (item && typeof item === "object" && typeof item.test === "function") {
|
|
22
|
-
return ident => item.test(ident);
|
|
23
|
-
}
|
|
24
|
-
if (typeof item === "function") {
|
|
25
|
-
return item;
|
|
26
|
-
}
|
|
27
|
-
if (typeof item === "boolean") {
|
|
28
|
-
return () => item;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const LogLevel = {
|
|
32
|
-
none: 6,
|
|
33
|
-
false: 6,
|
|
34
|
-
error: 5,
|
|
35
|
-
warn: 4,
|
|
36
|
-
info: 3,
|
|
37
|
-
log: 2,
|
|
38
|
-
true: 2,
|
|
39
|
-
verbose: 1
|
|
40
|
-
};
|
|
41
|
-
const createConsoleLogger = ({ level = "info", debug = false, console }) => {
|
|
42
|
-
const debugFilters = typeof debug === "boolean"
|
|
43
|
-
? [() => debug]
|
|
44
|
-
: [].concat(debug).map(filterToFunction);
|
|
45
|
-
const loglevel = LogLevel[`${level}`] || 0;
|
|
46
|
-
const logger = (name, type, args) => {
|
|
47
|
-
const labeledArgs = () => {
|
|
48
|
-
if (Array.isArray(args)) {
|
|
49
|
-
if (args.length > 0 && typeof args[0] === "string") {
|
|
50
|
-
return [`[${name}] ${args[0]}`, ...args.slice(1)];
|
|
51
|
-
}
|
|
52
|
-
return [`[${name}]`, ...args];
|
|
53
|
-
}
|
|
54
|
-
return [];
|
|
55
|
-
};
|
|
56
|
-
const debug = debugFilters.some(f => f(name));
|
|
57
|
-
switch (type) {
|
|
58
|
-
case Logger_1.LogType.debug:
|
|
59
|
-
if (!debug)
|
|
60
|
-
return;
|
|
61
|
-
if (typeof console.debug === "function") {
|
|
62
|
-
console.debug(...labeledArgs());
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
console.log(...labeledArgs());
|
|
66
|
-
}
|
|
67
|
-
break;
|
|
68
|
-
case Logger_1.LogType.log:
|
|
69
|
-
if (!debug && loglevel > LogLevel.log)
|
|
70
|
-
return;
|
|
71
|
-
console.log(...labeledArgs());
|
|
72
|
-
break;
|
|
73
|
-
case Logger_1.LogType.info:
|
|
74
|
-
if (!debug && loglevel > LogLevel.info)
|
|
75
|
-
return;
|
|
76
|
-
console.info(...labeledArgs());
|
|
77
|
-
break;
|
|
78
|
-
case Logger_1.LogType.warn:
|
|
79
|
-
if (!debug && loglevel > LogLevel.warn)
|
|
80
|
-
return;
|
|
81
|
-
console.warn(...labeledArgs());
|
|
82
|
-
break;
|
|
83
|
-
case Logger_1.LogType.error:
|
|
84
|
-
if (!debug && loglevel > LogLevel.error)
|
|
85
|
-
return;
|
|
86
|
-
console.error(...labeledArgs());
|
|
87
|
-
break;
|
|
88
|
-
case Logger_1.LogType.trace:
|
|
89
|
-
if (!debug)
|
|
90
|
-
return;
|
|
91
|
-
console.trace();
|
|
92
|
-
break;
|
|
93
|
-
case Logger_1.LogType.groupCollapsed:
|
|
94
|
-
if (!debug && loglevel > LogLevel.log)
|
|
95
|
-
return;
|
|
96
|
-
if (!debug && loglevel > LogLevel.verbose) {
|
|
97
|
-
if (typeof console.groupCollapsed === "function") {
|
|
98
|
-
console.groupCollapsed(...labeledArgs());
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
console.log(...labeledArgs());
|
|
102
|
-
}
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
// falls through
|
|
106
|
-
case Logger_1.LogType.group:
|
|
107
|
-
if (!debug && loglevel > LogLevel.log)
|
|
108
|
-
return;
|
|
109
|
-
if (typeof console.group === "function") {
|
|
110
|
-
console.group(...labeledArgs());
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
console.log(...labeledArgs());
|
|
114
|
-
}
|
|
115
|
-
break;
|
|
116
|
-
case Logger_1.LogType.groupEnd:
|
|
117
|
-
if (!debug && loglevel > LogLevel.log)
|
|
118
|
-
return;
|
|
119
|
-
if (typeof console.groupEnd === "function") {
|
|
120
|
-
console.groupEnd();
|
|
121
|
-
}
|
|
122
|
-
break;
|
|
123
|
-
case Logger_1.LogType.time: {
|
|
124
|
-
if (!debug && loglevel > LogLevel.log)
|
|
125
|
-
return;
|
|
126
|
-
const ms = args[1] * 1000 + args[2] / 1000000;
|
|
127
|
-
const msg = `[${name}] ${args[0]}: ${ms} ms`;
|
|
128
|
-
if (typeof console.logTime === "function") {
|
|
129
|
-
console.logTime(msg);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
console.log(msg);
|
|
133
|
-
}
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
case Logger_1.LogType.profile:
|
|
137
|
-
if (typeof console.profile === "function") {
|
|
138
|
-
console.profile(...labeledArgs());
|
|
139
|
-
}
|
|
140
|
-
break;
|
|
141
|
-
case Logger_1.LogType.profileEnd:
|
|
142
|
-
if (typeof console.profileEnd === "function") {
|
|
143
|
-
console.profileEnd(...labeledArgs());
|
|
144
|
-
}
|
|
145
|
-
break;
|
|
146
|
-
case Logger_1.LogType.clear:
|
|
147
|
-
if (!debug && loglevel > LogLevel.log)
|
|
148
|
-
return;
|
|
149
|
-
if (typeof console.clear === "function") {
|
|
150
|
-
console.clear();
|
|
151
|
-
}
|
|
152
|
-
break;
|
|
153
|
-
case Logger_1.LogType.status:
|
|
154
|
-
if (!debug && loglevel > LogLevel.info)
|
|
155
|
-
return;
|
|
156
|
-
if (typeof console.status === "function") {
|
|
157
|
-
if (args.length === 0) {
|
|
158
|
-
console.status();
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
console.status(...labeledArgs());
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
if (args.length !== 0) {
|
|
166
|
-
console.info(...labeledArgs());
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
break;
|
|
170
|
-
default:
|
|
171
|
-
throw new Error(`Unexpected LogType ${type}`);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
return logger;
|
|
175
|
-
};
|
|
176
|
-
exports.createConsoleLogger = createConsoleLogger;
|
package/dist/logging/runtime.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/logging/runtime.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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.hooks = exports.configureDefaultLogger = exports.getLogger = void 0;
|
|
13
|
-
const SyncBailHook = require("tapable/lib/SyncBailHook");
|
|
14
|
-
const Logger_1 = require("./Logger");
|
|
15
|
-
const createConsoleLogger_1 = require("./createConsoleLogger");
|
|
16
|
-
const currentDefaultLoggerOptions = {
|
|
17
|
-
level: "info",
|
|
18
|
-
debug: false,
|
|
19
|
-
console
|
|
20
|
-
};
|
|
21
|
-
let currentDefaultLogger = (0, createConsoleLogger_1.createConsoleLogger)(currentDefaultLoggerOptions);
|
|
22
|
-
const getLogger = (name) => {
|
|
23
|
-
return new Logger_1.Logger((type, args) => {
|
|
24
|
-
if (exports.hooks.log.call(name, type, args) === undefined) {
|
|
25
|
-
currentDefaultLogger(name, type, args);
|
|
26
|
-
}
|
|
27
|
-
}, childName => exports.getLogger(`${name}/${childName}`));
|
|
28
|
-
};
|
|
29
|
-
exports.getLogger = getLogger;
|
|
30
|
-
const configureDefaultLogger = (options) => {
|
|
31
|
-
Object.assign(currentDefaultLoggerOptions, options);
|
|
32
|
-
currentDefaultLogger = (0, createConsoleLogger_1.createConsoleLogger)(currentDefaultLoggerOptions);
|
|
33
|
-
};
|
|
34
|
-
exports.configureDefaultLogger = configureDefaultLogger;
|
|
35
|
-
exports.hooks = {
|
|
36
|
-
log: new SyncBailHook(["origin", "type", "args"])
|
|
37
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/logging/truncateArgs.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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.truncateArgs = void 0;
|
|
13
|
-
const arraySum = (array) => {
|
|
14
|
-
let sum = 0;
|
|
15
|
-
for (const item of array)
|
|
16
|
-
sum += item;
|
|
17
|
-
return sum;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* @param args items to be truncated
|
|
21
|
-
* @param maxLength maximum length of args including spaces between
|
|
22
|
-
* @returns truncated args
|
|
23
|
-
*/
|
|
24
|
-
const truncateArgs = (args, maxLength) => {
|
|
25
|
-
const lengths = args.map(a => `${a}`.length);
|
|
26
|
-
const availableLength = maxLength - lengths.length + 1;
|
|
27
|
-
if (availableLength > 0 && args.length === 1) {
|
|
28
|
-
if (availableLength >= args[0].length) {
|
|
29
|
-
return args;
|
|
30
|
-
}
|
|
31
|
-
if (availableLength > 3) {
|
|
32
|
-
return [`...${args[0].slice(-availableLength + 3)}`];
|
|
33
|
-
}
|
|
34
|
-
return [args[0].slice(-availableLength)];
|
|
35
|
-
}
|
|
36
|
-
// Check if there is space for at least 4 chars per arg
|
|
37
|
-
if (availableLength < arraySum(lengths.map(i => Math.min(i, 6)))) {
|
|
38
|
-
// remove args
|
|
39
|
-
if (args.length > 1)
|
|
40
|
-
return truncateArgs(args.slice(0, args.length - 1), maxLength);
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
let currentLength = arraySum(lengths);
|
|
44
|
-
// Check if all fits into maxLength
|
|
45
|
-
if (currentLength <= availableLength)
|
|
46
|
-
return args;
|
|
47
|
-
// Try to remove chars from the longest items until it fits
|
|
48
|
-
while (currentLength > availableLength) {
|
|
49
|
-
const maxLength = Math.max(...lengths);
|
|
50
|
-
const shorterItems = lengths.filter(l => l !== maxLength);
|
|
51
|
-
const nextToMaxLength = shorterItems.length > 0 ? Math.max(...shorterItems) : 0;
|
|
52
|
-
const maxReduce = maxLength - nextToMaxLength;
|
|
53
|
-
let maxItems = lengths.length - shorterItems.length;
|
|
54
|
-
let overrun = currentLength - availableLength;
|
|
55
|
-
for (let i = 0; i < lengths.length; i++) {
|
|
56
|
-
if (lengths[i] === maxLength) {
|
|
57
|
-
const reduce = Math.min(Math.floor(overrun / maxItems), maxReduce);
|
|
58
|
-
lengths[i] -= reduce;
|
|
59
|
-
currentLength -= reduce;
|
|
60
|
-
overrun -= reduce;
|
|
61
|
-
maxItems--;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Return args reduced to length in lengths
|
|
66
|
-
return args.map((a, i) => {
|
|
67
|
-
const str = `${a}`;
|
|
68
|
-
const length = lengths[i];
|
|
69
|
-
if (str.length === length) {
|
|
70
|
-
return str;
|
|
71
|
-
}
|
|
72
|
-
if (length > 5) {
|
|
73
|
-
return `...${str.slice(-length + 3)}`;
|
|
74
|
-
}
|
|
75
|
-
if (length > 0) {
|
|
76
|
-
return str.slice(-length);
|
|
77
|
-
}
|
|
78
|
-
return "";
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
exports.truncateArgs = truncateArgs;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
/**
|
|
7
|
-
* The following code is modified based on
|
|
8
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/node/NodeEnvironmentPlugin.js
|
|
9
|
-
*
|
|
10
|
-
* MIT Licensed
|
|
11
|
-
* Author Tobias Koppers @sokra
|
|
12
|
-
* Copyright (c) JS Foundation and other contributors
|
|
13
|
-
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
14
|
-
*/
|
|
15
|
-
// @ts-expect-error we directly import from enhanced-resolve inner js file to improve performance
|
|
16
|
-
const CachedInputFileSystem_1 = __importDefault(require("../../compiled/enhanced-resolve/CachedInputFileSystem"));
|
|
17
|
-
const graceful_fs_1 = __importDefault(require("../../compiled/graceful-fs"));
|
|
18
|
-
const createConsoleLogger_1 = require("../logging/createConsoleLogger");
|
|
19
|
-
const NodeWatchFileSystem_1 = __importDefault(require("./NodeWatchFileSystem"));
|
|
20
|
-
const nodeConsole_1 = __importDefault(require("./nodeConsole"));
|
|
21
|
-
class NodeEnvironmentPlugin {
|
|
22
|
-
constructor(options) {
|
|
23
|
-
this.options = options;
|
|
24
|
-
}
|
|
25
|
-
apply(compiler) {
|
|
26
|
-
const { infrastructureLogging } = this.options;
|
|
27
|
-
compiler.infrastructureLogger = (0, createConsoleLogger_1.createConsoleLogger)({
|
|
28
|
-
level: infrastructureLogging.level || "info",
|
|
29
|
-
debug: infrastructureLogging.debug || false,
|
|
30
|
-
console: infrastructureLogging.console ||
|
|
31
|
-
(0, nodeConsole_1.default)({
|
|
32
|
-
colors: infrastructureLogging.colors,
|
|
33
|
-
appendOnly: infrastructureLogging.appendOnly,
|
|
34
|
-
stream: infrastructureLogging.stream
|
|
35
|
-
})
|
|
36
|
-
});
|
|
37
|
-
const inputFileSystem = new CachedInputFileSystem_1.default(graceful_fs_1.default, 60000);
|
|
38
|
-
compiler.inputFileSystem = inputFileSystem;
|
|
39
|
-
compiler.outputFileSystem = graceful_fs_1.default;
|
|
40
|
-
compiler.intermediateFileSystem = graceful_fs_1.default;
|
|
41
|
-
compiler.watchFileSystem = new NodeWatchFileSystem_1.default(inputFileSystem);
|
|
42
|
-
compiler.hooks.beforeRun.tap("NodeEnvironmentPlugin", compiler => {
|
|
43
|
-
if (compiler.inputFileSystem === inputFileSystem) {
|
|
44
|
-
compiler.fsStartTime = Date.now();
|
|
45
|
-
inputFileSystem.purge?.();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.default = NodeEnvironmentPlugin;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* The following code is modified based on
|
|
4
|
-
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/node/NodeTemplatePlugin.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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const builtin_plugin_1 = require("../builtin-plugin");
|
|
13
|
-
class NodeTemplatePlugin {
|
|
14
|
-
constructor(_options = {}) {
|
|
15
|
-
this._options = _options;
|
|
16
|
-
}
|
|
17
|
-
apply(compiler) {
|
|
18
|
-
const chunkLoading = this._options.asyncChunkLoading
|
|
19
|
-
? "async-node"
|
|
20
|
-
: "require";
|
|
21
|
-
compiler.options.output.chunkLoading = chunkLoading;
|
|
22
|
-
new builtin_plugin_1.CommonJsChunkFormatPlugin().apply(compiler);
|
|
23
|
-
new builtin_plugin_1.EnableChunkLoadingPlugin(chunkLoading).apply(compiler);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
exports.default = NodeTemplatePlugin;
|