@rspack/core 1.0.0-beta.0 → 1.0.0-beta.2
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/ChunkGroup.d.ts +1 -0
- package/dist/ChunkGroup.js +3 -0
- package/dist/Compilation.d.ts +19 -1
- package/dist/Compiler.d.ts +11 -10
- package/dist/Compiler.js +16 -16
- package/dist/ExecuteModulePlugin.d.ts +0 -1
- package/dist/ExecuteModulePlugin.js +0 -1
- package/dist/Module.d.ts +2 -2
- package/dist/Module.js +1 -1
- package/dist/MultiCompiler.js +1 -1
- package/dist/NormalModule.d.ts +1 -0
- package/dist/NormalModule.js +1 -0
- package/dist/Resolver.d.ts +1 -2
- package/dist/RspackError.js +1 -1
- package/dist/Stats.js +22 -2
- package/dist/Template.js +2 -2
- package/dist/builtin-loader/lightningcss/index.js +1 -1
- 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 +31 -31
- 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/DefinePlugin.js +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/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.js +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.js +1 -6
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.js +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +3 -2
- package/dist/builtin-plugin/EntryPlugin.js +1 -0
- 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 +5 -5
- package/dist/builtin-plugin/ExternalsPlugin.js +1 -1
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -1
- 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 +9 -9
- 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 +0 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.js +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +4 -11
- 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/NaturalChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.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/SwcCssMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +2 -3
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
- package/dist/builtin-plugin/base.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +3 -5
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.js +7 -5
- package/dist/builtin-plugin/css-extract/loader.d.ts +8 -3
- package/dist/builtin-plugin/css-extract/loader.js +27 -22
- package/dist/builtin-plugin/lazy-compilation/backend.js +4 -4
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -1
- package/dist/config/adapter.js +16 -2
- package/dist/config/adapterRuleUse.d.ts +2 -6
- package/dist/config/adapterRuleUse.js +10 -9
- package/dist/config/defaults.js +28 -42
- package/dist/config/normalization.d.ts +7 -3
- package/dist/config/normalization.js +7 -2
- package/dist/config/zod.d.ts +1634 -1093
- package/dist/config/zod.js +31 -2
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/container/default.runtime.js +1 -1
- package/dist/exports.d.ts +1 -1
- package/dist/lib/AbstractMethodError.d.ts +12 -3
- package/dist/lib/AbstractMethodError.js +29 -22
- package/dist/lib/Cache.d.ts +40 -46
- package/dist/lib/Cache.js +43 -78
- package/dist/lib/CacheFacade.d.ts +119 -143
- package/dist/lib/CacheFacade.js +123 -124
- package/dist/lib/Dependency.d.ts +23 -0
- package/dist/lib/Dependency.js +11 -0
- package/dist/lib/EntryOptionPlugin.d.ts +19 -2
- package/dist/lib/EntryOptionPlugin.js +22 -6
- package/dist/lib/EnvironmentPlugin.d.ts +17 -10
- package/dist/lib/EnvironmentPlugin.js +16 -17
- package/dist/lib/HookWebpackError.d.ts +27 -33
- package/dist/lib/HookWebpackError.js +33 -34
- package/dist/lib/IgnoreWarningsPlugin.d.ts +25 -0
- package/dist/lib/{ignoreWarningsPlugin.js → IgnoreWarningsPlugin.js} +17 -0
- package/dist/lib/LoaderOptionsPlugin.d.ts +18 -9
- package/dist/lib/LoaderOptionsPlugin.js +38 -14
- package/dist/lib/LoaderTargetPlugin.d.ts +17 -8
- package/dist/lib/LoaderTargetPlugin.js +17 -15
- package/dist/lib/ModuleFilenameHelpers.d.ts +10 -1
- package/dist/lib/ModuleFilenameHelpers.js +10 -1
- package/dist/lib/NormalModuleReplacementPlugin.d.ts +15 -5
- package/dist/lib/NormalModuleReplacementPlugin.js +15 -5
- package/dist/lib/WebpackError.d.ts +23 -22
- package/dist/lib/WebpackError.js +15 -35
- package/dist/lib/cache/MemoryCachePlugin.d.ts +5 -0
- package/dist/lib/cache/MemoryCachePlugin.js +40 -0
- package/dist/lib/cache/getLazyHashedEtag.d.ts +24 -24
- package/dist/lib/cache/getLazyHashedEtag.js +20 -23
- package/dist/lib/cache/mergeEtags.d.ts +15 -9
- package/dist/lib/cache/mergeEtags.js +18 -11
- package/dist/lib/formatLocation.d.ts +14 -9
- package/dist/lib/formatLocation.js +17 -15
- package/dist/loader-runner/index.js +6 -7
- package/dist/loader-runner/loadLoader.js +8 -11
- package/dist/logging/Logger.js +3 -3
- package/dist/logging/createConsoleLogger.d.ts +26 -6
- package/dist/logging/createConsoleLogger.js +21 -58
- package/dist/logging/runtime.d.ts +4 -10
- package/dist/logging/runtime.js +8 -23
- package/dist/logging/truncateArgs.d.ts +4 -4
- package/dist/logging/truncateArgs.js +5 -10
- package/dist/node/NodeEnvironmentPlugin.js +2 -2
- package/dist/node/NodeWatchFileSystem.js +6 -6
- package/dist/node/nodeConsole.d.ts +7 -21
- package/dist/node/nodeConsole.js +29 -36
- package/dist/rspackOptionsApply.d.ts +0 -1
- package/dist/rspackOptionsApply.js +10 -9
- package/dist/sharing/ProvideSharedPlugin.d.ts +20 -19
- package/dist/sharing/ProvideSharedPlugin.js +26 -17
- package/dist/sharing/SharePlugin.d.ts +3 -0
- package/dist/sharing/SharePlugin.js +4 -1
- package/dist/stats/DefaultStatsFactoryPlugin.js +187 -96
- package/dist/stats/DefaultStatsPresetPlugin.js +1 -2
- package/dist/stats/DefaultStatsPrinterPlugin.js +18 -19
- package/dist/stats/StatsFactory.d.ts +2 -1
- package/dist/stats/StatsFactory.js +2 -6
- package/dist/stats/statsFactoryUtils.d.ts +63 -23
- package/dist/util/SizeFormatHelpers.js +1 -1
- package/dist/util/bindingVersionCheck.js +3 -3
- package/dist/util/cleverMerge.js +3 -2
- package/dist/util/comparators.d.ts +2 -2
- package/dist/util/comparators.js +5 -4
- package/dist/util/createHash.js +1 -1
- package/dist/util/fs.js +2 -2
- package/dist/util/identifier.js +2 -2
- package/dist/util/index.js +1 -1
- package/dist/util/memoize.js +1 -4
- package/dist/util/smartGrouping.js +4 -6
- package/dist/util/webpack.d.ts +1 -1
- package/dist/util/webpack.js +2 -1
- package/module.d.ts +1 -1
- package/package.json +3 -3
- package/compiled/enhanced-resolve/index.js +0 -5566
- package/dist/lib/ignoreWarningsPlugin.d.ts +0 -7
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Cache_1 = require("../Cache");
|
|
4
|
+
class MemoryCachePlugin {
|
|
5
|
+
apply(compiler) {
|
|
6
|
+
const cache = new Map();
|
|
7
|
+
compiler.cache.hooks.store.tap({ name: MemoryCachePlugin.PLUGIN_NAME, stage: Cache_1.Cache.STAGE_MEMORY }, (identifier, etag, data) => {
|
|
8
|
+
const dataEtag = typeof etag?.toString === "function"
|
|
9
|
+
? etag.toString()
|
|
10
|
+
: etag;
|
|
11
|
+
cache.set(identifier, { etag: dataEtag, data });
|
|
12
|
+
});
|
|
13
|
+
compiler.cache.hooks.get.tap({ name: MemoryCachePlugin.PLUGIN_NAME, stage: Cache_1.Cache.STAGE_MEMORY }, (identifier, etag, gotHandlers) => {
|
|
14
|
+
const cacheEntry = cache.get(identifier);
|
|
15
|
+
const dataEtag = typeof etag?.toString === "function"
|
|
16
|
+
? etag.toString()
|
|
17
|
+
: etag;
|
|
18
|
+
if (cacheEntry === null) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
if (cacheEntry !== undefined) {
|
|
22
|
+
return cacheEntry.etag === dataEtag ? cacheEntry.data : null;
|
|
23
|
+
}
|
|
24
|
+
gotHandlers.push((result, callback) => {
|
|
25
|
+
if (result === undefined) {
|
|
26
|
+
cache.set(identifier, null);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
cache.set(identifier, { etag: dataEtag, data: result });
|
|
30
|
+
}
|
|
31
|
+
return callback(null);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
compiler.cache.hooks.shutdown.tap({ name: MemoryCachePlugin.PLUGIN_NAME, stage: Cache_1.Cache.STAGE_MEMORY }, () => {
|
|
35
|
+
cache.clear();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
MemoryCachePlugin.PLUGIN_NAME = "MemoryCachePlugin";
|
|
40
|
+
exports.default = MemoryCachePlugin;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
export = getter;
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/getLazyHashedEtag.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
|
|
6
9
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
import type Hash from "../../util/hash";
|
|
11
|
+
export type HashConstructor = typeof Hash;
|
|
12
|
+
export interface HashableObject {
|
|
13
|
+
updateHash(hash: Hash): void;
|
|
10
14
|
}
|
|
11
|
-
type HashableObject = {
|
|
12
|
-
updateHash: (arg0: Hash) => void;
|
|
13
|
-
};
|
|
14
|
-
type HashConstructor = any;
|
|
15
|
-
/** @typedef {any} Hash */
|
|
16
|
-
/** @typedef {any} HashConstructor */
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {Object} HashableObject
|
|
19
|
-
* @property {function(Hash): void} updateHash
|
|
20
|
-
*/
|
|
21
15
|
declare class LazyHashedEtag {
|
|
16
|
+
_obj: HashableObject;
|
|
17
|
+
_hash?: string;
|
|
18
|
+
_hashFunction: string | HashConstructor;
|
|
22
19
|
/**
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
20
|
+
* @param obj object with updateHash method
|
|
21
|
+
* @param hashFunction the hash function to use
|
|
25
22
|
*/
|
|
26
23
|
constructor(obj: HashableObject, hashFunction?: string | HashConstructor);
|
|
27
|
-
_obj: HashableObject;
|
|
28
|
-
_hash: string | undefined;
|
|
29
|
-
_hashFunction: any;
|
|
30
24
|
/**
|
|
31
|
-
* @returns
|
|
25
|
+
* @returns hash of object
|
|
32
26
|
*/
|
|
33
27
|
toString(): string;
|
|
34
28
|
}
|
|
35
|
-
|
|
29
|
+
/**
|
|
30
|
+
* @param obj object with updateHash method
|
|
31
|
+
* @param ashFunction the hash function to use
|
|
32
|
+
* @returns etag
|
|
33
|
+
*/
|
|
34
|
+
export declare const getter: (obj: HashableObject, hashFunction?: string | HashConstructor) => LazyHashedEtag;
|
|
35
|
+
export default getter;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
1
|
"use strict";
|
|
6
|
-
const createHash = require("../../util/createHash");
|
|
7
|
-
// /** @typedef {import("../util/Hash")} Hash */
|
|
8
|
-
// /** @typedef {typeof import("../util/Hash")} HashConstructor */
|
|
9
|
-
/** @typedef {any} Hash */
|
|
10
|
-
/** @typedef {any} HashConstructor */
|
|
11
2
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
3
|
+
* The following code is modified based on
|
|
4
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/getLazyHashedEtag.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
|
|
14
10
|
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getter = void 0;
|
|
13
|
+
const createHash_1 = require("../../util/createHash");
|
|
15
14
|
class LazyHashedEtag {
|
|
16
15
|
/**
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
16
|
+
* @param obj object with updateHash method
|
|
17
|
+
* @param hashFunction the hash function to use
|
|
19
18
|
*/
|
|
20
19
|
constructor(obj, hashFunction = "md4") {
|
|
21
20
|
this._obj = obj;
|
|
@@ -23,26 +22,23 @@ class LazyHashedEtag {
|
|
|
23
22
|
this._hashFunction = hashFunction;
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
26
|
-
* @returns
|
|
25
|
+
* @returns hash of object
|
|
27
26
|
*/
|
|
28
27
|
toString() {
|
|
29
28
|
if (this._hash === undefined) {
|
|
30
|
-
|
|
31
|
-
const hash = createHash(this._hashFunction);
|
|
29
|
+
const hash = (0, createHash_1.createHash)(this._hashFunction);
|
|
32
30
|
this._obj.updateHash(hash);
|
|
33
|
-
this._hash =
|
|
31
|
+
this._hash = hash.digest("base64");
|
|
34
32
|
}
|
|
35
33
|
return this._hash;
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
|
-
/** @type {Map<string | HashConstructor, WeakMap<HashableObject, LazyHashedEtag>>} */
|
|
39
36
|
const mapStrings = new Map();
|
|
40
|
-
/** @type {WeakMap<HashConstructor, WeakMap<HashableObject, LazyHashedEtag>>} */
|
|
41
37
|
const mapObjects = new WeakMap();
|
|
42
38
|
/**
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @returns
|
|
39
|
+
* @param obj object with updateHash method
|
|
40
|
+
* @param ashFunction the hash function to use
|
|
41
|
+
* @returns etag
|
|
46
42
|
*/
|
|
47
43
|
const getter = (obj, hashFunction = "md4") => {
|
|
48
44
|
let innerMap;
|
|
@@ -73,4 +69,5 @@ const getter = (obj, hashFunction = "md4") => {
|
|
|
73
69
|
innerMap.set(obj, newHash);
|
|
74
70
|
return newHash;
|
|
75
71
|
};
|
|
76
|
-
|
|
72
|
+
exports.getter = getter;
|
|
73
|
+
exports.default = exports.getter;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
export = mergeEtags;
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/mergeEtags.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
|
|
6
9
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import type { Etag } from "../Cache";
|
|
11
|
+
/**
|
|
12
|
+
* @param a first
|
|
13
|
+
* @param b second
|
|
14
|
+
* @returns result
|
|
15
|
+
*/
|
|
16
|
+
export declare const mergeEtags: (a: Etag, b: Etag) => Etag;
|
|
17
|
+
export default mergeEtags;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
1
|
"use strict";
|
|
6
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The following code is modified based on
|
|
4
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/cache/mergeEtags.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.mergeEtags = void 0;
|
|
7
13
|
class MergedEtag {
|
|
8
14
|
/**
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
15
|
+
* @param a first
|
|
16
|
+
* @param b second
|
|
11
17
|
*/
|
|
12
18
|
constructor(a, b) {
|
|
13
19
|
this.a = a;
|
|
@@ -20,9 +26,9 @@ class MergedEtag {
|
|
|
20
26
|
const dualObjectMap = new WeakMap();
|
|
21
27
|
const objectStringMap = new WeakMap();
|
|
22
28
|
/**
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* @returns
|
|
29
|
+
* @param a first
|
|
30
|
+
* @param b second
|
|
31
|
+
* @returns result
|
|
26
32
|
*/
|
|
27
33
|
const mergeEtags = (a, b) => {
|
|
28
34
|
if (typeof a === "string") {
|
|
@@ -62,4 +68,5 @@ const mergeEtags = (a, b) => {
|
|
|
62
68
|
}
|
|
63
69
|
return mergedEtag;
|
|
64
70
|
};
|
|
65
|
-
|
|
71
|
+
exports.mergeEtags = mergeEtags;
|
|
72
|
+
exports.default = exports.mergeEtags;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
export = formatLocation;
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/formatLocation.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
|
|
5
9
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import type { DependencyLocation } from "./Dependency";
|
|
11
|
+
/**
|
|
12
|
+
* @param loc location
|
|
13
|
+
* @returns formatted location
|
|
14
|
+
*/
|
|
15
|
+
declare const formatLocation: (loc: DependencyLocation) => string;
|
|
16
|
+
export default formatLocation;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra
|
|
4
|
-
*/
|
|
5
1
|
"use strict";
|
|
6
|
-
// /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
|
|
7
|
-
// /** @typedef {import("./Dependency").SourcePosition} SourcePosition */
|
|
8
|
-
/** @typedef {any} DependencyLocation */
|
|
9
|
-
/** @typedef {any} SourcePosition */
|
|
10
2
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
3
|
+
* The following code is modified based on
|
|
4
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/formatLocation.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
|
|
13
10
|
*/
|
|
14
|
-
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
/**
|
|
13
|
+
* @param pos position
|
|
14
|
+
* @returns formatted position
|
|
15
|
+
*/
|
|
16
|
+
const formatPosition = (pos) => {
|
|
15
17
|
if (pos && typeof pos === "object") {
|
|
16
18
|
if ("line" in pos && "column" in pos) {
|
|
17
19
|
return `${pos.line}:${pos.column}`;
|
|
@@ -23,10 +25,10 @@ const formatPosition = pos => {
|
|
|
23
25
|
return "";
|
|
24
26
|
};
|
|
25
27
|
/**
|
|
26
|
-
* @param
|
|
27
|
-
* @returns
|
|
28
|
+
* @param loc location
|
|
29
|
+
* @returns formatted location
|
|
28
30
|
*/
|
|
29
|
-
const formatLocation = loc => {
|
|
31
|
+
const formatLocation = (loc) => {
|
|
30
32
|
if (loc && typeof loc === "object") {
|
|
31
33
|
if ("start" in loc && loc.start && "end" in loc && loc.end) {
|
|
32
34
|
if (typeof loc.start === "object" &&
|
|
@@ -59,4 +61,4 @@ const formatLocation = loc => {
|
|
|
59
61
|
}
|
|
60
62
|
return "";
|
|
61
63
|
};
|
|
62
|
-
|
|
64
|
+
exports.default = formatLocation;
|
|
@@ -40,7 +40,7 @@ const identifier_1 = require("../util/identifier");
|
|
|
40
40
|
const memoize_1 = require("../util/memoize");
|
|
41
41
|
const loadLoader_1 = __importDefault(require("./loadLoader"));
|
|
42
42
|
function createLoaderObject(loader, compiler) {
|
|
43
|
-
|
|
43
|
+
const obj = {
|
|
44
44
|
path: null,
|
|
45
45
|
query: null,
|
|
46
46
|
fragment: null,
|
|
@@ -88,13 +88,13 @@ function createLoaderObject(loader, compiler) {
|
|
|
88
88
|
else if (obj.options === undefined)
|
|
89
89
|
obj.query = "";
|
|
90
90
|
else if (typeof obj.options === "string")
|
|
91
|
-
obj.query =
|
|
91
|
+
obj.query = `?${obj.options}`;
|
|
92
92
|
else if (obj.ident)
|
|
93
|
-
obj.query =
|
|
93
|
+
obj.query = `??${obj.ident}`;
|
|
94
94
|
else if (typeof obj.options === "object" && obj.options.ident)
|
|
95
|
-
obj.query =
|
|
95
|
+
obj.query = `??${obj.options.ident}`;
|
|
96
96
|
else
|
|
97
|
-
obj.query =
|
|
97
|
+
obj.query = `?${JSON.stringify(obj.options)}`;
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
obj.request = loader;
|
|
@@ -268,8 +268,7 @@ function dirname(path) {
|
|
|
268
268
|
return path.slice(0, idx);
|
|
269
269
|
}
|
|
270
270
|
function getCurrentLoader(loaderContext, index = loaderContext.loaderIndex) {
|
|
271
|
-
if (loaderContext.loaders &&
|
|
272
|
-
loaderContext.loaders.length &&
|
|
271
|
+
if (loaderContext.loaders?.length &&
|
|
273
272
|
index < loaderContext.loaders.length &&
|
|
274
273
|
index >= 0 &&
|
|
275
274
|
loaderContext.loaders[index]) {
|
|
@@ -13,14 +13,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const LoaderLoadingError_1 = __importDefault(require("./LoaderLoadingError"));
|
|
16
|
-
|
|
16
|
+
let url = undefined;
|
|
17
17
|
function loadLoader(loader, callback) {
|
|
18
18
|
if (loader.type === "module") {
|
|
19
19
|
try {
|
|
20
20
|
if (url === undefined)
|
|
21
21
|
url = require("node:url");
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const loaderUrl = url.pathToFileURL(loader.path);
|
|
23
|
+
const modulePromise = eval(`import(${JSON.stringify(loaderUrl.toString())})`);
|
|
24
24
|
modulePromise.then((module) => {
|
|
25
25
|
handleResult(loader, module, callback);
|
|
26
26
|
}, callback);
|
|
@@ -31,15 +31,16 @@ function loadLoader(loader, callback) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
+
let module;
|
|
34
35
|
try {
|
|
35
|
-
|
|
36
|
+
module = require(loader.path);
|
|
36
37
|
}
|
|
37
38
|
catch (e) {
|
|
38
39
|
// it is possible for node to choke on a require if the FD descriptor
|
|
39
40
|
// limit has been reached. give it a chance to recover.
|
|
40
41
|
if (e instanceof Error &&
|
|
41
42
|
e.code === "EMFILE") {
|
|
42
|
-
|
|
43
|
+
const retry = loadLoader.bind(null, loader, callback);
|
|
43
44
|
if (typeof setImmediate === "function") {
|
|
44
45
|
// node >= 0.9.0
|
|
45
46
|
return void setImmediate(retry);
|
|
@@ -55,18 +56,14 @@ function loadLoader(loader, callback) {
|
|
|
55
56
|
exports.default = loadLoader;
|
|
56
57
|
function handleResult(loader, module, callback) {
|
|
57
58
|
if (typeof module !== "function" && typeof module !== "object") {
|
|
58
|
-
return callback(new LoaderLoadingError_1.default(
|
|
59
|
-
loader.path +
|
|
60
|
-
"' is not a loader (export function or es6 module)"));
|
|
59
|
+
return callback(new LoaderLoadingError_1.default(`Module '${loader.path}' is not a loader (export function or es6 module)`));
|
|
61
60
|
}
|
|
62
61
|
loader.normal = typeof module === "function" ? module : module.default;
|
|
63
62
|
loader.pitch = module.pitch;
|
|
64
63
|
loader.raw = module.raw;
|
|
65
64
|
if (typeof loader.normal !== "function" &&
|
|
66
65
|
typeof loader.pitch !== "function") {
|
|
67
|
-
return callback(new LoaderLoadingError_1.default(
|
|
68
|
-
loader.path +
|
|
69
|
-
"' is not a loader (must have normal or pitch function)"));
|
|
66
|
+
return callback(new LoaderLoadingError_1.default(`Module '${loader.path}' is not a loader (must have normal or pitch function)`));
|
|
70
67
|
}
|
|
71
68
|
callback();
|
|
72
69
|
}
|
package/dist/logging/Logger.js
CHANGED
|
@@ -92,7 +92,7 @@ class Logger {
|
|
|
92
92
|
this[TIMERS_SYMBOL].set(label, process.hrtime());
|
|
93
93
|
}
|
|
94
94
|
timeLog(label) {
|
|
95
|
-
const prev = this[TIMERS_SYMBOL]
|
|
95
|
+
const prev = this[TIMERS_SYMBOL]?.get(label);
|
|
96
96
|
if (!prev) {
|
|
97
97
|
throw new Error(`No such label '${label}' for WebpackLogger.timeLog()`);
|
|
98
98
|
}
|
|
@@ -100,7 +100,7 @@ class Logger {
|
|
|
100
100
|
this[LOG_SYMBOL](exports.LogType.time, [label, ...time]);
|
|
101
101
|
}
|
|
102
102
|
timeEnd(label) {
|
|
103
|
-
const prev = this[TIMERS_SYMBOL]
|
|
103
|
+
const prev = this[TIMERS_SYMBOL]?.get(label);
|
|
104
104
|
if (!prev) {
|
|
105
105
|
throw new Error(`No such label '${label}' for WebpackLogger.timeEnd()`);
|
|
106
106
|
}
|
|
@@ -109,7 +109,7 @@ class Logger {
|
|
|
109
109
|
this[LOG_SYMBOL](exports.LogType.time, [label, ...time]);
|
|
110
110
|
}
|
|
111
111
|
timeAggregate(label) {
|
|
112
|
-
const prev = this[TIMERS_SYMBOL]
|
|
112
|
+
const prev = this[TIMERS_SYMBOL]?.get(label);
|
|
113
113
|
if (!prev) {
|
|
114
114
|
throw new Error(`No such label '${label}' for WebpackLogger.timeAggregate()`);
|
|
115
115
|
}
|
|
@@ -7,9 +7,29 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
import type { FilterTypes } from "../config";
|
|
11
|
+
import { type LogTypeEnum } from "./Logger";
|
|
12
|
+
export type FilterFunction = (ident: string) => boolean;
|
|
13
|
+
export type LoggerConsole = {
|
|
14
|
+
clear: () => void;
|
|
15
|
+
trace: () => void;
|
|
16
|
+
info: (...args: any[]) => void;
|
|
17
|
+
log: (...args: any[]) => void;
|
|
18
|
+
warn: (...args: any[]) => void;
|
|
19
|
+
error: (...args: any[]) => void;
|
|
20
|
+
debug?: (...args: any[]) => void;
|
|
21
|
+
group?: (...args: any[]) => void;
|
|
22
|
+
groupCollapsed?: (...args: any[]) => void;
|
|
23
|
+
groupEnd?: (...args: any[]) => void;
|
|
24
|
+
status?: (...args: any[]) => void;
|
|
25
|
+
profile?: (...args: any[]) => void;
|
|
26
|
+
profileEnd?: (...args: any[]) => void;
|
|
27
|
+
logTime?: (...args: any[]) => void;
|
|
28
|
+
};
|
|
29
|
+
export type LoggerOptions = {
|
|
30
|
+
level: "none" | "error" | "warn" | "info" | "log" | "verbose" | boolean;
|
|
31
|
+
debug: FilterTypes | boolean;
|
|
32
|
+
console: LoggerConsole;
|
|
33
|
+
};
|
|
34
|
+
declare const createConsoleLogger: ({ level, debug, console }: LoggerOptions) => (name: string, type: LogTypeEnum, args: any[]) => void;
|
|
35
|
+
export { createConsoleLogger };
|