@rspack/core 0.0.0-0074001a71-20230224065505
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/LICENSE +22 -0
- package/README.md +16 -0
- package/dist/ErrorHelpers.d.ts +8 -0
- package/dist/ErrorHelpers.d.ts.map +1 -0
- package/dist/ErrorHelpers.js +54 -0
- package/dist/ErrorHelpers.js.map +1 -0
- package/dist/ResolverFactory.d.ts +49 -0
- package/dist/ResolverFactory.d.ts.map +1 -0
- package/dist/ResolverFactory.js +122 -0
- package/dist/ResolverFactory.js.map +1 -0
- package/dist/chunk_group.d.ts +7 -0
- package/dist/chunk_group.d.ts.map +1 -0
- package/dist/chunk_group.js +33 -0
- package/dist/chunk_group.js.map +1 -0
- package/dist/compilation.d.ts +191 -0
- package/dist/compilation.d.ts.map +1 -0
- package/dist/compilation.js +472 -0
- package/dist/compilation.js.map +1 -0
- package/dist/compiler.d.ts +69 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +376 -0
- package/dist/compiler.js.map +1 -0
- package/dist/config/adapter-rule-use.d.ts +75 -0
- package/dist/config/adapter-rule-use.d.ts.map +1 -0
- package/dist/config/adapter-rule-use.js +463 -0
- package/dist/config/adapter-rule-use.js.map +1 -0
- package/dist/config/adapter.d.ts +5 -0
- package/dist/config/adapter.d.ts.map +1 -0
- package/dist/config/adapter.js +235 -0
- package/dist/config/adapter.js.map +1 -0
- package/dist/config/browserslistTargetHandler.d.ts +20 -0
- package/dist/config/browserslistTargetHandler.d.ts.map +1 -0
- package/dist/config/browserslistTargetHandler.js +325 -0
- package/dist/config/browserslistTargetHandler.js.map +1 -0
- package/dist/config/builtins.d.ts +51 -0
- package/dist/config/builtins.d.ts.map +1 -0
- package/dist/config/builtins.js +148 -0
- package/dist/config/builtins.js.map +1 -0
- package/dist/config/defaults.d.ts +13 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +326 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +20 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/normalization.d.ts +12 -0
- package/dist/config/normalization.d.ts.map +1 -0
- package/dist/config/normalization.js +181 -0
- package/dist/config/normalization.js.map +1 -0
- package/dist/config/target.d.ts +139 -0
- package/dist/config/target.d.ts.map +1 -0
- package/dist/config/target.js +320 -0
- package/dist/config/target.js.map +1 -0
- package/dist/config/types.d.ts +311 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +12 -0
- package/dist/config/types.js.map +1 -0
- package/dist/error/ConcurrentCompilationError.d.ts +15 -0
- package/dist/error/ConcurrentCompilationError.d.ts.map +1 -0
- package/dist/error/ConcurrentCompilationError.js +21 -0
- package/dist/error/ConcurrentCompilationError.js.map +1 -0
- package/dist/fileSystem.d.ts +8 -0
- package/dist/fileSystem.d.ts.map +1 -0
- package/dist/fileSystem.js +14 -0
- package/dist/fileSystem.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/Logger.d.ts +59 -0
- package/dist/logging/Logger.d.ts.map +1 -0
- package/dist/logging/Logger.js +135 -0
- package/dist/logging/Logger.js.map +1 -0
- package/dist/logging/createConsoleLogger.d.ts +16 -0
- package/dist/logging/createConsoleLogger.d.ts.map +1 -0
- package/dist/logging/createConsoleLogger.js +232 -0
- package/dist/logging/createConsoleLogger.js.map +1 -0
- package/dist/logging/runtime.d.ts +23 -0
- package/dist/logging/runtime.d.ts.map +1 -0
- package/dist/logging/runtime.js +53 -0
- package/dist/logging/runtime.js.map +1 -0
- package/dist/logging/truncateArgs.d.ts +17 -0
- package/dist/logging/truncateArgs.d.ts.map +1 -0
- package/dist/logging/truncateArgs.js +91 -0
- package/dist/logging/truncateArgs.js.map +1 -0
- package/dist/multiCompiler.d.ts +95 -0
- package/dist/multiCompiler.d.ts.map +1 -0
- package/dist/multiCompiler.js +455 -0
- package/dist/multiCompiler.js.map +1 -0
- package/dist/multiStats.d.ts +27 -0
- package/dist/multiStats.d.ts.map +1 -0
- package/dist/multiStats.js +133 -0
- package/dist/multiStats.js.map +1 -0
- package/dist/multiWatching.d.ts +36 -0
- package/dist/multiWatching.d.ts.map +1 -0
- package/dist/multiWatching.js +62 -0
- package/dist/multiWatching.js.map +1 -0
- package/dist/node/NodeEnvironmentPlugin.d.ts +11 -0
- package/dist/node/NodeEnvironmentPlugin.d.ts.map +1 -0
- package/dist/node/NodeEnvironmentPlugin.js +51 -0
- package/dist/node/NodeEnvironmentPlugin.js.map +1 -0
- package/dist/node/NodeTargetPlugin.d.ts +14 -0
- package/dist/node/NodeTargetPlugin.d.ts.map +1 -0
- package/dist/node/NodeTargetPlugin.js +82 -0
- package/dist/node/NodeTargetPlugin.js.map +1 -0
- package/dist/node/NodeWatchFileSystem.d.ts +19 -0
- package/dist/node/NodeWatchFileSystem.d.ts.map +1 -0
- package/dist/node/NodeWatchFileSystem.js +148 -0
- package/dist/node/NodeWatchFileSystem.js.map +1 -0
- package/dist/node/nodeConsole.d.ts +31 -0
- package/dist/node/nodeConsole.d.ts.map +1 -0
- package/dist/node/nodeConsole.js +138 -0
- package/dist/node/nodeConsole.js.map +1 -0
- package/dist/rspack.d.ts +12 -0
- package/dist/rspack.d.ts.map +1 -0
- package/dist/rspack.js +81 -0
- package/dist/rspack.js.map +1 -0
- package/dist/rspackOptionsApply.d.ts +6 -0
- package/dist/rspackOptionsApply.d.ts.map +1 -0
- package/dist/rspackOptionsApply.js +76 -0
- package/dist/rspackOptionsApply.js.map +1 -0
- package/dist/stats.d.ts +30 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +886 -0
- package/dist/stats.js.map +1 -0
- package/dist/util/ArrayQueue.d.ts +54 -0
- package/dist/util/ArrayQueue.d.ts.map +1 -0
- package/dist/util/ArrayQueue.js +109 -0
- package/dist/util/ArrayQueue.js.map +1 -0
- package/dist/util/cleverMerge.d.ts +79 -0
- package/dist/util/cleverMerge.d.ts.map +1 -0
- package/dist/util/cleverMerge.js +536 -0
- package/dist/util/cleverMerge.js.map +1 -0
- package/dist/util/createHash.d.ts +16 -0
- package/dist/util/createHash.d.ts.map +1 -0
- package/dist/util/createHash.js +171 -0
- package/dist/util/createHash.js.map +1 -0
- package/dist/util/createSource.d.ts +6 -0
- package/dist/util/createSource.d.ts.map +1 -0
- package/dist/util/createSource.js +63 -0
- package/dist/util/createSource.js.map +1 -0
- package/dist/util/fake.d.ts +30 -0
- package/dist/util/fake.d.ts.map +1 -0
- package/dist/util/fake.js +72 -0
- package/dist/util/fake.js.map +1 -0
- package/dist/util/fs.d.ts +24 -0
- package/dist/util/fs.d.ts.map +1 -0
- package/dist/util/fs.js +3 -0
- package/dist/util/fs.js.map +1 -0
- package/dist/util/hash/BatchedHash.d.ts +16 -0
- package/dist/util/hash/BatchedHash.d.ts.map +1 -0
- package/dist/util/hash/BatchedHash.js +66 -0
- package/dist/util/hash/BatchedHash.js.map +1 -0
- package/dist/util/hash/index.d.ts +19 -0
- package/dist/util/hash/index.d.ts.map +1 -0
- package/dist/util/hash/index.js +28 -0
- package/dist/util/hash/index.js.map +1 -0
- package/dist/util/hash/md4.d.ts +3 -0
- package/dist/util/hash/md4.d.ts.map +1 -0
- package/dist/util/hash/md4.js +18 -0
- package/dist/util/hash/md4.js.map +1 -0
- package/dist/util/hash/wasm-hash.d.ts +7 -0
- package/dist/util/hash/wasm-hash.d.ts.map +1 -0
- package/dist/util/hash/wasm-hash.js +167 -0
- package/dist/util/hash/wasm-hash.js.map +1 -0
- package/dist/util/hash/xxhash64.d.ts +3 -0
- package/dist/util/hash/xxhash64.d.ts.map +1 -0
- package/dist/util/hash/xxhash64.js +18 -0
- package/dist/util/hash/xxhash64.js.map +1 -0
- package/dist/util/identifier.d.ts +77 -0
- package/dist/util/identifier.d.ts.map +1 -0
- package/dist/util/identifier.js +345 -0
- package/dist/util/identifier.js.map +1 -0
- package/dist/util/index.d.ts +8 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +27 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/memoize.d.ts +2 -0
- package/dist/util/memoize.d.ts.map +1 -0
- package/dist/util/memoize.js +25 -0
- package/dist/util/memoize.js.map +1 -0
- package/dist/watching.d.ts +32 -0
- package/dist/watching.d.ts.map +1 -0
- package/dist/watching.js +273 -0
- package/dist/watching.js.map +1 -0
- package/dist/web/ResolveSwcPlugin.d.ts +5 -0
- package/dist/web/ResolveSwcPlugin.d.ts.map +1 -0
- package/dist/web/ResolveSwcPlugin.js +21 -0
- package/dist/web/ResolveSwcPlugin.js.map +1 -0
- package/package.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-present Bytedance, Inc. and its affiliates.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<picture>
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://lf3-static.bytednsdoc.com/obj/eden-cn/rjhwzy/ljhwZthlaukjlkulzlp/rspack-banner-1610-dark.png">
|
|
3
|
+
<img alt="Rspack Banner" src="https://lf3-static.bytednsdoc.com/obj/eden-cn/rjhwzy/ljhwZthlaukjlkulzlp/rspack-banner-1610.png">
|
|
4
|
+
</picture>
|
|
5
|
+
|
|
6
|
+
# @rspack/core
|
|
7
|
+
|
|
8
|
+
A Fast Rust-based Web Bundler.
|
|
9
|
+
|
|
10
|
+
## Documentation
|
|
11
|
+
|
|
12
|
+
See [https://rspack.org](https://rspack.org) for details.
|
|
13
|
+
|
|
14
|
+
## License
|
|
15
|
+
|
|
16
|
+
Rspack is [MIT licensed](https://github.com/modern-js-dev/rspack/blob/main/LICENSE).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function cutOffByFlag(stack: any, flag: any): any;
|
|
2
|
+
export function cutOffLoaderExecution(stack: any): any;
|
|
3
|
+
export function cutOffWebpackOptions(stack: any): any;
|
|
4
|
+
export function cutOffMultilineMessage(stack: any, message: any): string;
|
|
5
|
+
export function cutOffMessage(stack: any, message: any): any;
|
|
6
|
+
export function cleanUp(stack: any, message: any): any;
|
|
7
|
+
export function cleanUpWebpackOptions(stack: any, message: any): any;
|
|
8
|
+
//# sourceMappingURL=ErrorHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorHelpers.d.ts","sourceRoot":"","sources":["../src/ErrorHelpers.js"],"names":[],"mappings":"AAgBuB,yDAQtB;AAE+B,uDACQ;AAET,sDACiB;AAEf,yEAWhC;AAEuB,6DAQvB;AAEiB,uDAIjB;AAE+B,qEAI/B"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/ErrorHelpers.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
|
+
"use strict";
|
|
11
|
+
const loaderFlag = "LOADER_EXECUTION";
|
|
12
|
+
const webpackOptionsFlag = "WEBPACK_OPTIONS";
|
|
13
|
+
exports.cutOffByFlag = (stack, flag) => {
|
|
14
|
+
stack = stack.split("\n");
|
|
15
|
+
for (let i = 0; i < stack.length; i++) {
|
|
16
|
+
if (stack[i].includes(flag)) {
|
|
17
|
+
stack.length = i;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return stack.join("\n");
|
|
21
|
+
};
|
|
22
|
+
exports.cutOffLoaderExecution = stack => exports.cutOffByFlag(stack, loaderFlag);
|
|
23
|
+
exports.cutOffWebpackOptions = stack => exports.cutOffByFlag(stack, webpackOptionsFlag);
|
|
24
|
+
exports.cutOffMultilineMessage = (stack, message) => {
|
|
25
|
+
stack = stack.split("\n");
|
|
26
|
+
message = message.split("\n");
|
|
27
|
+
const result = [];
|
|
28
|
+
stack.forEach((line, idx) => {
|
|
29
|
+
if (!line.includes(message[idx]))
|
|
30
|
+
result.push(line);
|
|
31
|
+
});
|
|
32
|
+
return result.join("\n");
|
|
33
|
+
};
|
|
34
|
+
exports.cutOffMessage = (stack, message) => {
|
|
35
|
+
const nextLine = stack.indexOf("\n");
|
|
36
|
+
if (nextLine === -1) {
|
|
37
|
+
return stack === message ? "" : stack;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const firstLine = stack.slice(0, nextLine);
|
|
41
|
+
return firstLine === message ? stack.slice(nextLine + 1) : stack;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.cleanUp = (stack, message) => {
|
|
45
|
+
stack = exports.cutOffLoaderExecution(stack);
|
|
46
|
+
stack = exports.cutOffMessage(stack, message);
|
|
47
|
+
return stack;
|
|
48
|
+
};
|
|
49
|
+
exports.cleanUpWebpackOptions = (stack, message) => {
|
|
50
|
+
stack = exports.cutOffWebpackOptions(stack);
|
|
51
|
+
stack = exports.cutOffMultilineMessage(stack, message);
|
|
52
|
+
return stack;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=ErrorHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorHelpers.js","sourceRoot":"","sources":["../src/ErrorHelpers.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,CAAC;AAEb,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAE7C,OAAO,CAAC,YAAY,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACtC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAC5B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;SACjB;KACD;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC;AAEF,OAAO,CAAC,qBAAqB,GAAG,KAAK,CAAC,EAAE,CACvC,OAAO,CAAC,YAAY,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAEzC,OAAO,CAAC,oBAAoB,GAAG,KAAK,CAAC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AAG,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,OAAO,CAAC,qBAAqB,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IAClD,KAAK,GAAG,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC5C,KAAK,GAAG,OAAO,CAAC,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACvD,OAAO,KAAK,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export = ResolverFactory;
|
|
2
|
+
declare class ResolverFactory {
|
|
3
|
+
hooks: Readonly<{
|
|
4
|
+
/** @type {HookMap<SyncWaterfallHook<[ResolveOptionsWithDependencyType]>>} */
|
|
5
|
+
resolveOptions: HookMap<SyncWaterfallHook<[ResolveOptionsWithDependencyType]>>;
|
|
6
|
+
/** @type {HookMap<SyncHook<[Resolver, ResolveOptions, ResolveOptionsWithDependencyType]>>} */
|
|
7
|
+
resolver: HookMap<SyncHook<[Resolver, ResolveOptions, ResolveOptionsWithDependencyType]>>;
|
|
8
|
+
}>;
|
|
9
|
+
/** @type {Map<string, ResolverCache>} */
|
|
10
|
+
cache: Map<string, ResolverCache>;
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} type type of resolver
|
|
13
|
+
* @param {ResolveOptionsWithDependencyType=} resolveOptions options
|
|
14
|
+
* @returns {ResolverWithOptions} the resolver
|
|
15
|
+
*/
|
|
16
|
+
get(type: string, resolveOptions?: ResolveOptionsWithDependencyType | undefined): ResolverWithOptions;
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} type type of resolver
|
|
19
|
+
* @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType options
|
|
20
|
+
* @returns {ResolverWithOptions} the resolver
|
|
21
|
+
*/
|
|
22
|
+
_create(type: string, resolveOptionsWithDepType: ResolveOptionsWithDependencyType): ResolverWithOptions;
|
|
23
|
+
}
|
|
24
|
+
declare namespace ResolverFactory {
|
|
25
|
+
export { ResolveOptions, Resolver, WebpackResolveOptions, ResolvePluginInstance, ResolveOptionsWithDependencyType, WithOptions, ResolverWithOptions, ResolverCache };
|
|
26
|
+
}
|
|
27
|
+
import { HookMap } from "tapable";
|
|
28
|
+
import { SyncWaterfallHook } from "tapable";
|
|
29
|
+
type ResolveOptionsWithDependencyType = WebpackResolveOptions & {
|
|
30
|
+
dependencyType?: string;
|
|
31
|
+
resolveToContext?: boolean;
|
|
32
|
+
};
|
|
33
|
+
import { SyncHook } from "tapable";
|
|
34
|
+
type Resolver = import("enhanced-resolve").Resolver;
|
|
35
|
+
type ResolveOptions = import("enhanced-resolve").ResolveOptions;
|
|
36
|
+
type ResolverCache = {
|
|
37
|
+
direct: WeakMap<Object, ResolverWithOptions>;
|
|
38
|
+
stringified: Map<string, ResolverWithOptions>;
|
|
39
|
+
};
|
|
40
|
+
type ResolverWithOptions = Resolver & WithOptions;
|
|
41
|
+
type WebpackResolveOptions = any;
|
|
42
|
+
type ResolvePluginInstance = any;
|
|
43
|
+
type WithOptions = {
|
|
44
|
+
/**
|
|
45
|
+
* create a resolver with additional/different options
|
|
46
|
+
*/
|
|
47
|
+
withOptions: (arg0: Partial<ResolveOptionsWithDependencyType>) => ResolverWithOptions;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=ResolverFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResolverFactory.d.ts","sourceRoot":"","sources":["../src/ResolverFactory.js"],"names":[],"mappings":";AA4EiB;IAEf;QACC,6EAA6E;wBAAlE,QAAQ,kBAAkB,CAAC,gCAAgC,CAAC,CAAC,CAAC;QAIzE,8FAA8F;kBAAnF,QAAQ,SAAS,CAAC,QAAQ,EAAE,cAAc,EAAE,gCAAgC,CAAC,CAAC,CAAC;OAIzF;IACF,yCAAyC;IACzC,OADW,IAAI,MAAM,EAAE,aAAa,CAAC,CACf;IAGvB;;;;OAIG;IACH,UAJW,MAAM,mBACN,gCAAgC,eAC9B,mBAAmB,CAyB/B;IAED;;;;OAIG;IACH,cAJW,MAAM,6BACN,gCAAgC,GAC9B,mBAAmB,CA6B/B;CACD;;;;;;wCAlIa,qBAAqB,GAAG;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE;;gBAJ9E,OAAO,kBAAkB,EAAE,QAAQ;sBADnC,OAAO,kBAAkB,EAAE,cAAc;;YAoDzC,QAAQ,MAAM,EAAE,mBAAmB,CAAC;iBACpC,IAAI,MAAM,EAAE,mBAAmB,CAAC;;2BA1ChC,QAAQ,GAAG,WAAW;;;;;;;wBAHb,QAAQ,gCAAgC,CAAC,KAAG,mBAAmB"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/ResolverFactory.js
|
|
4
|
+
*
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
* Author Tobias Koppers @sokra
|
|
7
|
+
* Copyright (c) JS Foundation and other contributors
|
|
8
|
+
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
"use strict";
|
|
11
|
+
const Factory = require("enhanced-resolve").ResolverFactory;
|
|
12
|
+
const { HookMap, SyncHook, SyncWaterfallHook } = require("tapable");
|
|
13
|
+
const { cachedCleverMerge, removeOperations, resolveByProperty } = require("./util/cleverMerge");
|
|
14
|
+
/** @typedef {import("enhanced-resolve").ResolveOptions} ResolveOptions */
|
|
15
|
+
/** @typedef {import("enhanced-resolve").Resolver} Resolver */
|
|
16
|
+
/** @typedef {import("../declarations/WebpackOptions").ResolveOptions} WebpackResolveOptions */
|
|
17
|
+
/** @typedef {import("../declarations/WebpackOptions").ResolvePluginInstance} ResolvePluginInstance */
|
|
18
|
+
/** @typedef {WebpackResolveOptions & {dependencyType?: string, resolveToContext?: boolean }} ResolveOptionsWithDependencyType */
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {Object} WithOptions
|
|
21
|
+
* @property {function(Partial<ResolveOptionsWithDependencyType>): ResolverWithOptions} withOptions create a resolver with additional/different options
|
|
22
|
+
*/
|
|
23
|
+
/** @typedef {Resolver & WithOptions} ResolverWithOptions */
|
|
24
|
+
// need to be hoisted on module level for caching identity
|
|
25
|
+
const EMPTY_RESOLVE_OPTIONS = {};
|
|
26
|
+
/**
|
|
27
|
+
* @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType enhanced options
|
|
28
|
+
* @returns {ResolveOptions} merged options
|
|
29
|
+
*/
|
|
30
|
+
const convertToResolveOptions = resolveOptionsWithDepType => {
|
|
31
|
+
const { dependencyType, plugins, ...remaining } = resolveOptionsWithDepType;
|
|
32
|
+
// check type compat
|
|
33
|
+
/** @type {Partial<ResolveOptions>} */
|
|
34
|
+
const partialOptions = {
|
|
35
|
+
...remaining,
|
|
36
|
+
plugins: plugins &&
|
|
37
|
+
/** @type {ResolvePluginInstance[]} */ (plugins.filter(item => item !== "..."))
|
|
38
|
+
};
|
|
39
|
+
if (!partialOptions.fileSystem) {
|
|
40
|
+
throw new Error("fileSystem is missing in resolveOptions, but it's required for enhanced-resolve");
|
|
41
|
+
}
|
|
42
|
+
// These weird types validate that we checked all non-optional properties
|
|
43
|
+
const options =
|
|
44
|
+
/** @type {Partial<ResolveOptions> & Pick<ResolveOptions, "fileSystem">} */ (partialOptions);
|
|
45
|
+
return removeOperations(resolveByProperty(options, "byDependency", dependencyType));
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {Object} ResolverCache
|
|
49
|
+
* @property {WeakMap<Object, ResolverWithOptions>} direct
|
|
50
|
+
* @property {Map<string, ResolverWithOptions>} stringified
|
|
51
|
+
*/
|
|
52
|
+
module.exports = class ResolverFactory {
|
|
53
|
+
constructor() {
|
|
54
|
+
this.hooks = Object.freeze({
|
|
55
|
+
/** @type {HookMap<SyncWaterfallHook<[ResolveOptionsWithDependencyType]>>} */
|
|
56
|
+
resolveOptions: new HookMap(() => new SyncWaterfallHook(["resolveOptions"])),
|
|
57
|
+
/** @type {HookMap<SyncHook<[Resolver, ResolveOptions, ResolveOptionsWithDependencyType]>>} */
|
|
58
|
+
resolver: new HookMap(() => new SyncHook(["resolver", "resolveOptions", "userResolveOptions"]))
|
|
59
|
+
});
|
|
60
|
+
/** @type {Map<string, ResolverCache>} */
|
|
61
|
+
this.cache = new Map();
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @param {string} type type of resolver
|
|
65
|
+
* @param {ResolveOptionsWithDependencyType=} resolveOptions options
|
|
66
|
+
* @returns {ResolverWithOptions} the resolver
|
|
67
|
+
*/
|
|
68
|
+
get(type, resolveOptions = EMPTY_RESOLVE_OPTIONS) {
|
|
69
|
+
let typedCaches = this.cache.get(type);
|
|
70
|
+
if (!typedCaches) {
|
|
71
|
+
typedCaches = {
|
|
72
|
+
direct: new WeakMap(),
|
|
73
|
+
stringified: new Map()
|
|
74
|
+
};
|
|
75
|
+
this.cache.set(type, typedCaches);
|
|
76
|
+
}
|
|
77
|
+
const cachedResolver = typedCaches.direct.get(resolveOptions);
|
|
78
|
+
if (cachedResolver) {
|
|
79
|
+
return cachedResolver;
|
|
80
|
+
}
|
|
81
|
+
const ident = JSON.stringify(resolveOptions);
|
|
82
|
+
const resolver = typedCaches.stringified.get(ident);
|
|
83
|
+
if (resolver) {
|
|
84
|
+
typedCaches.direct.set(resolveOptions, resolver);
|
|
85
|
+
return resolver;
|
|
86
|
+
}
|
|
87
|
+
const newResolver = this._create(type, resolveOptions);
|
|
88
|
+
typedCaches.direct.set(resolveOptions, newResolver);
|
|
89
|
+
typedCaches.stringified.set(ident, newResolver);
|
|
90
|
+
return newResolver;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @param {string} type type of resolver
|
|
94
|
+
* @param {ResolveOptionsWithDependencyType} resolveOptionsWithDepType options
|
|
95
|
+
* @returns {ResolverWithOptions} the resolver
|
|
96
|
+
*/
|
|
97
|
+
_create(type, resolveOptionsWithDepType) {
|
|
98
|
+
/** @type {ResolveOptionsWithDependencyType} */
|
|
99
|
+
const originalResolveOptions = { ...resolveOptionsWithDepType };
|
|
100
|
+
const resolveOptions = convertToResolveOptions(this.hooks.resolveOptions.for(type).call(resolveOptionsWithDepType));
|
|
101
|
+
const resolver = /** @type {ResolverWithOptions} */ (Factory.createResolver(resolveOptions));
|
|
102
|
+
if (!resolver) {
|
|
103
|
+
throw new Error("No resolver created");
|
|
104
|
+
}
|
|
105
|
+
/** @type {WeakMap<Partial<ResolveOptionsWithDependencyType>, ResolverWithOptions>} */
|
|
106
|
+
const childCache = new WeakMap();
|
|
107
|
+
resolver.withOptions = options => {
|
|
108
|
+
const cacheEntry = childCache.get(options);
|
|
109
|
+
if (cacheEntry !== undefined)
|
|
110
|
+
return cacheEntry;
|
|
111
|
+
const mergedOptions = cachedCleverMerge(originalResolveOptions, options);
|
|
112
|
+
const resolver = this.get(type, mergedOptions);
|
|
113
|
+
childCache.set(options, resolver);
|
|
114
|
+
return resolver;
|
|
115
|
+
};
|
|
116
|
+
this.hooks.resolver
|
|
117
|
+
.for(type)
|
|
118
|
+
.call(resolver, resolveOptions, originalResolveOptions);
|
|
119
|
+
return resolver;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=ResolverFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResolverFactory.js","sourceRoot":"","sources":["../src/ResolverFactory.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,CAAC;AAEb,MAAM,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,eAAe,CAAC;AAC5D,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AACpE,MAAM,EACL,i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YAAY;IAI/B,QAAQ,IAAI,MAAM,EAAE;CAWpB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _ChunkGroup_inner;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ChunkGroup = void 0;
|
|
16
|
+
class ChunkGroup {
|
|
17
|
+
constructor(inner) {
|
|
18
|
+
_ChunkGroup_inner.set(this, void 0);
|
|
19
|
+
__classPrivateFieldSet(this, _ChunkGroup_inner, inner, "f");
|
|
20
|
+
}
|
|
21
|
+
getFiles() {
|
|
22
|
+
const files = new Set();
|
|
23
|
+
for (const chunk of __classPrivateFieldGet(this, _ChunkGroup_inner, "f").chunks) {
|
|
24
|
+
for (const file of chunk.files) {
|
|
25
|
+
files.add(file);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return Array.from(files);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ChunkGroup = ChunkGroup;
|
|
32
|
+
_ChunkGroup_inner = new WeakMap();
|
|
33
|
+
//# sourceMappingURL=chunk_group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_group.js","sourceRoot":"","sources":["../src/chunk_group.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,MAAa,UAAU;IAGtB,YAAY,KAAmB;QAF/B,oCAAqB;QAGpB,uBAAA,IAAI,qBAAU,KAAK,MAAA,CAAC;IACrB,CAAC;IAED,QAAQ;QACP,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;QAEhC,KAAK,MAAM,KAAK,IAAI,uBAAA,IAAI,yBAAO,CAAC,MAAM,EAAE;YACvC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE;gBAC/B,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aAChB;SACD;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACD;AAlBD,gCAkBC"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as tapable from "tapable";
|
|
2
|
+
import { Source } from "webpack-sources";
|
|
3
|
+
import { JsCompilation, JsAssetInfo, JsCompatSource, JsModule } from "@rspack/binding";
|
|
4
|
+
import { RspackOptionsNormalized, StatsOptions, OutputNormalized, StatsValue } from "./config";
|
|
5
|
+
import { ChunkGroup } from "./chunk_group";
|
|
6
|
+
import { Compiler } from "./compiler";
|
|
7
|
+
import ResolverFactory from "./ResolverFactory";
|
|
8
|
+
import { createFakeProcessAssetsHook } from "./util/fake";
|
|
9
|
+
import { Stats } from "./stats";
|
|
10
|
+
export declare type AssetInfo = Partial<JsAssetInfo> & Record<string, any>;
|
|
11
|
+
export declare type Assets = Record<string, Source>;
|
|
12
|
+
export interface LogEntry {
|
|
13
|
+
type: string;
|
|
14
|
+
args: any[];
|
|
15
|
+
time: number;
|
|
16
|
+
trace?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface KnownCreateStatsOptionsContext {
|
|
19
|
+
forToString?: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<string, any>;
|
|
22
|
+
export declare class Compilation {
|
|
23
|
+
#private;
|
|
24
|
+
hooks: {
|
|
25
|
+
processAssets: ReturnType<typeof createFakeProcessAssetsHook>;
|
|
26
|
+
log: tapable.SyncBailHook<[string, LogEntry], true>;
|
|
27
|
+
optimizeChunkModules: tapable.AsyncSeriesBailHook<[
|
|
28
|
+
Array<JsModule>
|
|
29
|
+
], undefined>;
|
|
30
|
+
};
|
|
31
|
+
options: RspackOptionsNormalized;
|
|
32
|
+
outputOptions: OutputNormalized;
|
|
33
|
+
compiler: Compiler;
|
|
34
|
+
resolverFactory: ResolverFactory;
|
|
35
|
+
inputFileSystem: any;
|
|
36
|
+
logging: Map<string, LogEntry[]>;
|
|
37
|
+
name?: string;
|
|
38
|
+
constructor(compiler: Compiler, inner: JsCompilation);
|
|
39
|
+
get hash(): string;
|
|
40
|
+
get fullHash(): string;
|
|
41
|
+
/**
|
|
42
|
+
* Get a map of all assets.
|
|
43
|
+
*
|
|
44
|
+
* Source: [assets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L1008-L1009)
|
|
45
|
+
*/
|
|
46
|
+
get assets(): Record<string, Source>;
|
|
47
|
+
/**
|
|
48
|
+
* Get a map of all entrypoints.
|
|
49
|
+
*/
|
|
50
|
+
get entrypoints(): ReadonlyMap<string, ChunkGroup>;
|
|
51
|
+
createStatsOptions(optionsOrPreset: StatsValue | undefined, context?: CreateStatsOptionsContext): StatsOptions;
|
|
52
|
+
/**
|
|
53
|
+
* Update an existing asset. Trying to update an asset that doesn't exist will throw an error.
|
|
54
|
+
*
|
|
55
|
+
* See: [Compilation.updateAsset](https://webpack.js.org/api/compilation-object/#updateasset)
|
|
56
|
+
* Source: [updateAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4320)
|
|
57
|
+
*
|
|
58
|
+
* FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
|
|
59
|
+
*
|
|
60
|
+
* @param {string} file file name
|
|
61
|
+
* @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
|
|
62
|
+
* @param {JsAssetInfo | function(JsAssetInfo): JsAssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
|
|
63
|
+
*/
|
|
64
|
+
updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction: JsAssetInfo | ((assetInfo: JsAssetInfo) => JsAssetInfo)): void;
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param moduleIdentifier moduleIdentifier of the module you want to modify
|
|
68
|
+
* @param source
|
|
69
|
+
* @returns true if the setting is success, false if failed.
|
|
70
|
+
*/
|
|
71
|
+
setNoneAstModuleSource(moduleIdentifier: string, source: JsCompatSource): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
|
|
74
|
+
*
|
|
75
|
+
* See: [Compilation.emitAsset](https://webpack.js.org/api/compilation-object/#emitasset)
|
|
76
|
+
* Source: [emitAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4239)
|
|
77
|
+
*
|
|
78
|
+
* @param {string} file file name
|
|
79
|
+
* @param {Source} source asset source
|
|
80
|
+
* @param {JsAssetInfo} assetInfo extra asset information
|
|
81
|
+
* @returns {void}
|
|
82
|
+
*/
|
|
83
|
+
emitAsset(filename: string, source: Source, assetInfo?: AssetInfo): void;
|
|
84
|
+
deleteAsset(filename: string): void;
|
|
85
|
+
/**
|
|
86
|
+
* Get an array of Asset
|
|
87
|
+
*
|
|
88
|
+
* See: [Compilation.getAssets](https://webpack.js.org/api/compilation-object/#getassets)
|
|
89
|
+
* Source: [getAssets](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4448)
|
|
90
|
+
*
|
|
91
|
+
* @return {Readonly<JsAsset>[]}
|
|
92
|
+
*/
|
|
93
|
+
getAssets(): {
|
|
94
|
+
source: Source;
|
|
95
|
+
name: string;
|
|
96
|
+
info: JsAssetInfo;
|
|
97
|
+
}[];
|
|
98
|
+
getAsset(name: string): {
|
|
99
|
+
source: Source;
|
|
100
|
+
name: string;
|
|
101
|
+
info: JsAssetInfo;
|
|
102
|
+
} | undefined;
|
|
103
|
+
pushDiagnostic(severity: "error" | "warning", title: string, message: string): void;
|
|
104
|
+
get errors(): {
|
|
105
|
+
push: (err: Error) => void;
|
|
106
|
+
};
|
|
107
|
+
get warnings(): {
|
|
108
|
+
push: (warn: Error) => void;
|
|
109
|
+
};
|
|
110
|
+
getPath(filename: string, data?: Record<string, any>): any;
|
|
111
|
+
getAssetPath(filename: any, data: any): any;
|
|
112
|
+
getLogger(name: string | (() => string)): any;
|
|
113
|
+
get fileDependencies(): {
|
|
114
|
+
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
115
|
+
has(dep: string): boolean;
|
|
116
|
+
add: (dep: string) => void;
|
|
117
|
+
addAll: (deps: Iterable<string>) => void;
|
|
118
|
+
};
|
|
119
|
+
get contextDependencies(): {
|
|
120
|
+
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
121
|
+
has(dep: string): boolean;
|
|
122
|
+
add: (dep: string) => void;
|
|
123
|
+
addAll: (deps: Iterable<string>) => void;
|
|
124
|
+
};
|
|
125
|
+
get missingDependencies(): {
|
|
126
|
+
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
127
|
+
has(dep: string): boolean;
|
|
128
|
+
add: (dep: string) => void;
|
|
129
|
+
addAll: (deps: Iterable<string>) => void;
|
|
130
|
+
};
|
|
131
|
+
get buildDependencies(): {
|
|
132
|
+
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
133
|
+
has(dep: string): boolean;
|
|
134
|
+
add: (dep: string) => void;
|
|
135
|
+
addAll: (deps: Iterable<string>) => void;
|
|
136
|
+
};
|
|
137
|
+
getModules(): JsModule[];
|
|
138
|
+
getStats(): Stats;
|
|
139
|
+
/**
|
|
140
|
+
* Get the `Source` of an given asset filename.
|
|
141
|
+
*
|
|
142
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
143
|
+
*
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
146
|
+
__internal__getAssetSource(filename: string): Source | null;
|
|
147
|
+
/**
|
|
148
|
+
* Set the `Source` of an given asset filename.
|
|
149
|
+
*
|
|
150
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
151
|
+
*
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
154
|
+
__internal__setAssetSource(filename: string, source: Source): void;
|
|
155
|
+
/**
|
|
156
|
+
* Delete the `Source` of an given asset filename.
|
|
157
|
+
*
|
|
158
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
159
|
+
*
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
__internal__deleteAssetSource(filename: string): void;
|
|
163
|
+
/**
|
|
164
|
+
* Get a list of asset filenames.
|
|
165
|
+
*
|
|
166
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
167
|
+
*
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
170
|
+
__internal__getAssetFilenames(): string[];
|
|
171
|
+
/**
|
|
172
|
+
* Test if an asset exists.
|
|
173
|
+
*
|
|
174
|
+
* Note: This is not a webpack public API, maybe removed in future.
|
|
175
|
+
*
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
178
|
+
__internal__hasAsset(name: string): boolean;
|
|
179
|
+
__internal_getInner(): JsCompilation;
|
|
180
|
+
seal(): void;
|
|
181
|
+
unseal(): void;
|
|
182
|
+
static PROCESS_ASSETS_STAGE_ADDITIONAL: number;
|
|
183
|
+
static PROCESS_ASSETS_STAGE_PRE_PROCESS: number;
|
|
184
|
+
static PROCESS_ASSETS_STAGE_NONE: number;
|
|
185
|
+
static PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE: number;
|
|
186
|
+
static PROCESS_ASSETS_STAGE_SUMMARIZE: number;
|
|
187
|
+
static PROCESS_ASSETS_STAGE_REPORT: number;
|
|
188
|
+
__internal_getProcessAssetsHookByStage(stage: number): tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
|
|
189
|
+
}
|
|
190
|
+
export type { JsAssetInfo };
|
|
191
|
+
//# sourceMappingURL=compilation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compilation.d.ts","sourceRoot":"","sources":["../src/compilation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAa,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,EACN,aAAa,EACb,WAAW,EACX,cAAc,EAEd,QAAQ,EAER,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAEN,2BAA2B,EAC3B,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAwB,KAAK,EAAE,MAAM,SAAS,CAAC;AAKtD,oBAAY,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACnE,oBAAY,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC5C,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,IAAI,EAAE,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