@rspack/core 1.0.0-alpha.4 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/zod/index.d.ts +138 -52
- package/compiled/zod/index.js +300 -103
- package/compiled/zod/package.json +1 -1
- package/compiled/zod-validation-error/index.js +6 -6
- package/dist/Compilation.d.ts +21 -3
- package/dist/Compilation.js +64 -49
- package/dist/Compiler.js +28 -28
- package/dist/ErrorHelpers.js +2 -4
- package/dist/FileSystem.js +6 -6
- package/dist/Module.js +2 -6
- package/dist/ModuleTypeConstants.d.ts +45 -69
- package/dist/ModuleTypeConstants.js +24 -77
- package/dist/NormalModule.js +6 -6
- package/dist/Stats.js +4 -6
- package/dist/Template.d.ts +31 -147
- package/dist/Template.js +40 -236
- package/dist/Watching.js +2 -2
- package/dist/builtin-loader/lightningcss/index.d.ts +89 -0
- package/dist/builtin-loader/lightningcss/index.js +175 -0
- package/dist/builtin-plugin/BannerPlugin.d.ts +24 -48
- package/dist/builtin-plugin/DefinePlugin.js +9 -13
- package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +24 -0
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +8 -8
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +2 -2
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +10 -3
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +4 -1
- package/dist/builtin-plugin/SplitChunksPlugin.js +7 -17
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +15 -23
- package/dist/builtin-plugin/base.js +1 -3
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts +3 -3
- package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +17 -66
- package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +2 -0
- package/dist/builtin-plugin/css-extract/hmr/{normalize-url.js → normalizeUrl.js} +15 -24
- package/dist/builtin-plugin/css-extract/loader.js +6 -6
- package/dist/builtin-plugin/css-extract/utils.js +3 -3
- package/dist/builtin-plugin/lazy-compilation/backend.d.ts +3 -3
- package/dist/builtin-plugin/lazy-compilation/backend.js +1 -1
- package/dist/config/adapter.d.ts +1 -1
- package/dist/config/adapter.js +31 -30
- package/dist/config/adapterRuleUse.d.ts +5 -5
- package/dist/config/adapterRuleUse.js +23 -1
- package/dist/config/browserslistTargetHandler.d.ts +17 -15
- package/dist/config/browserslistTargetHandler.js +27 -33
- package/dist/config/defaults.js +27 -28
- package/dist/config/normalization.d.ts +2 -0
- package/dist/config/normalization.js +5 -5
- package/dist/config/target.d.ts +48 -109
- package/dist/config/target.js +50 -86
- package/dist/config/zod.d.ts +2398 -2212
- package/dist/config/zod.js +29 -19
- package/dist/container/ContainerPlugin.d.ts +7 -7
- package/dist/container/options.js +1 -1
- package/dist/exports.d.ts +4 -4
- package/dist/exports.js +2 -2
- package/dist/lib/CacheFacade.js +1 -0
- package/dist/lib/EntryOptionPlugin.js +2 -2
- package/dist/lib/ModuleFilenameHelpers.js +1 -3
- package/dist/lib/WebpackError.js +1 -1
- package/dist/lib/cache/mergeEtags.js +5 -11
- package/dist/lib/formatLocation.js +3 -5
- package/dist/loader-runner/LoaderLoadingError.d.ts +11 -1
- package/dist/loader-runner/LoaderLoadingError.js +3 -5
- package/dist/loader-runner/index.js +23 -25
- package/dist/loader-runner/loadLoader.d.ts +11 -2
- package/dist/loader-runner/loadLoader.js +18 -20
- package/dist/logging/createConsoleLogger.js +2 -6
- package/dist/logging/truncateArgs.js +5 -9
- package/dist/node/NodeWatchFileSystem.js +5 -5
- package/dist/node/nodeConsole.js +2 -4
- package/dist/rspack.js +6 -6
- package/dist/rspackOptionsApply.js +3 -3
- package/dist/stats/DefaultStatsFactoryPlugin.js +65 -20
- package/dist/stats/DefaultStatsPresetPlugin.js +4 -4
- package/dist/stats/DefaultStatsPrinterPlugin.js +12 -17
- package/dist/stats/StatsFactory.js +13 -17
- package/dist/stats/StatsPrinter.js +7 -9
- package/dist/stats/statsFactoryUtils.d.ts +9 -10
- package/dist/util/AssetInfo.js +11 -7
- package/dist/util/SplitChunkSize.js +1 -1
- package/dist/util/bindingVersionCheck.js +6 -6
- package/dist/util/cleverMerge.d.ts +33 -57
- package/dist/util/cleverMerge.js +89 -145
- package/dist/util/comparators.js +3 -5
- package/dist/util/createHash.d.ts +4 -3
- package/dist/util/createHash.js +31 -45
- package/dist/util/fs.js +16 -20
- package/dist/util/hash/BatchedHash.d.ts +24 -9
- package/dist/util/hash/BatchedHash.js +16 -13
- package/dist/util/hash/index.d.ts +9 -9
- package/dist/util/hash/index.js +14 -11
- package/dist/util/hash/md4.d.ts +29 -2
- package/dist/util/hash/md4.js +7 -3
- package/dist/util/hash/wasm-hash.d.ts +52 -5
- package/dist/util/hash/wasm-hash.js +19 -22
- package/dist/util/hash/xxhash64.d.ts +29 -2
- package/dist/util/hash/xxhash64.js +7 -3
- package/dist/util/identifier.js +13 -19
- package/dist/util/index.js +1 -1
- package/dist/util/memoize.js +7 -9
- package/package.json +9 -8
- package/dist/builtin-plugin/css-extract/hmr/normalize-url.d.ts +0 -2
|
@@ -1,145 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/*
|
|
2
3
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
4
|
Author Sean Larkin @TheLarkInn
|
|
4
5
|
*/
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const JAVASCRIPT_MODULE_TYPE_AUTO = "javascript/auto";
|
|
10
|
-
/**
|
|
11
|
-
* @type {Readonly<"javascript/dynamic">}
|
|
12
|
-
*/
|
|
13
|
-
const JAVASCRIPT_MODULE_TYPE_DYNAMIC = "javascript/dynamic";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = exports.WEBPACK_MODULE_TYPE_PROVIDE = exports.WEBPACK_MODULE_TYPE_REMOTE = exports.WEBPACK_MODULE_TYPE_FALLBACK = exports.WEBPACK_MODULE_TYPE_RUNTIME = exports.ASSET_MODULE_TYPE_RAW_DATA_URL = exports.ASSET_MODULE_TYPE_SOURCE = exports.ASSET_MODULE_TYPE_RESOURCE = exports.ASSET_MODULE_TYPE_INLINE = exports.ASSET_MODULE_TYPE = exports.CSS_MODULE_TYPE_AUTO = exports.CSS_MODULE_TYPE_MODULE = exports.CSS_MODULE_TYPE_GLOBAL = exports.CSS_MODULE_TYPE = exports.WEBASSEMBLY_MODULE_TYPE_SYNC = exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = exports.JSON_MODULE_TYPE = exports.JAVASCRIPT_MODULE_TYPE_ESM = exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = exports.JAVASCRIPT_MODULE_TYPE_AUTO = void 0;
|
|
8
|
+
exports.JAVASCRIPT_MODULE_TYPE_AUTO = "javascript/auto";
|
|
9
|
+
exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = "javascript/dynamic";
|
|
14
10
|
/**
|
|
15
|
-
* @type {Readonly<"javascript/esm">}
|
|
16
11
|
* This is the module type used for _strict_ ES Module syntax. This means that all legacy formats
|
|
17
12
|
* that webpack supports (CommonJS, AMD, SystemJS) are not supported.
|
|
18
13
|
*/
|
|
19
|
-
|
|
14
|
+
exports.JAVASCRIPT_MODULE_TYPE_ESM = "javascript/esm";
|
|
20
15
|
/**
|
|
21
|
-
* @type {Readonly<"json">}
|
|
22
16
|
* This is the module type used for JSON files. JSON files are always parsed as ES Module.
|
|
23
17
|
*/
|
|
24
|
-
|
|
18
|
+
exports.JSON_MODULE_TYPE = "json";
|
|
25
19
|
/**
|
|
26
|
-
* @type {Readonly<"webassembly/async">}
|
|
27
20
|
* This is the module type used for WebAssembly modules. In webpack 5 they are always treated as async modules.
|
|
28
21
|
*
|
|
29
22
|
*/
|
|
30
|
-
|
|
23
|
+
exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = "webassembly/async";
|
|
31
24
|
/**
|
|
32
|
-
* @type {Readonly<"webassembly/sync">}
|
|
33
25
|
* This is the module type used for WebAssembly modules. In webpack 4 they are always treated as sync modules.
|
|
34
26
|
* There is a legacy option to support this usage in webpack 5 and up.
|
|
35
27
|
*/
|
|
36
|
-
|
|
28
|
+
exports.WEBASSEMBLY_MODULE_TYPE_SYNC = "webassembly/sync";
|
|
37
29
|
/**
|
|
38
|
-
* @type {Readonly<"css">}
|
|
39
30
|
* This is the module type used for CSS files.
|
|
40
31
|
*/
|
|
41
|
-
|
|
32
|
+
exports.CSS_MODULE_TYPE = "css";
|
|
42
33
|
/**
|
|
43
|
-
* @type {Readonly<"css/global">}
|
|
44
34
|
* This is the module type used for CSS modules files where you need to use `:local` in selector list to hash classes.
|
|
45
35
|
*/
|
|
46
|
-
|
|
36
|
+
exports.CSS_MODULE_TYPE_GLOBAL = "css/global";
|
|
47
37
|
/**
|
|
48
|
-
* @type {Readonly<"css/module">}
|
|
49
38
|
* This is the module type used for CSS modules files, by default all classes are hashed.
|
|
50
39
|
*/
|
|
51
|
-
|
|
40
|
+
exports.CSS_MODULE_TYPE_MODULE = "css/module";
|
|
52
41
|
/**
|
|
53
|
-
* @type {Readonly<"css/auto">}
|
|
54
42
|
* This is the module type used for CSS files, the module will be parsed as CSS modules if it's filename contains `.module.` or `.modules.`.
|
|
55
43
|
*/
|
|
56
|
-
|
|
44
|
+
exports.CSS_MODULE_TYPE_AUTO = "css/auto";
|
|
57
45
|
/**
|
|
58
|
-
* @type {Readonly<"asset">}
|
|
59
46
|
* This is the module type used for automatically choosing between `asset/inline`, `asset/resource` based on asset size limit (8096).
|
|
60
47
|
*/
|
|
61
|
-
|
|
48
|
+
exports.ASSET_MODULE_TYPE = "asset";
|
|
62
49
|
/**
|
|
63
|
-
* @type {Readonly<"asset/inline">}
|
|
64
50
|
* This is the module type used for assets that are inlined as a data URI. This is the equivalent of `url-loader`.
|
|
65
51
|
*/
|
|
66
|
-
|
|
52
|
+
exports.ASSET_MODULE_TYPE_INLINE = "asset/inline";
|
|
67
53
|
/**
|
|
68
|
-
* @type {Readonly<"asset/resource">}
|
|
69
54
|
* This is the module type used for assets that are copied to the output directory. This is the equivalent of `file-loader`.
|
|
70
55
|
*/
|
|
71
|
-
|
|
56
|
+
exports.ASSET_MODULE_TYPE_RESOURCE = "asset/resource";
|
|
72
57
|
/**
|
|
73
58
|
* @type {Readonly<"asset/source">}
|
|
74
59
|
* This is the module type used for assets that are imported as source code. This is the equivalent of `raw-loader`.
|
|
75
60
|
*/
|
|
76
|
-
|
|
61
|
+
exports.ASSET_MODULE_TYPE_SOURCE = "asset/source";
|
|
77
62
|
/**
|
|
78
|
-
* @type {Readonly<"asset/raw-data-url">}
|
|
79
63
|
* TODO: Document what this asset type is for. See css-loader tests for its usage.
|
|
80
64
|
*/
|
|
81
|
-
|
|
65
|
+
exports.ASSET_MODULE_TYPE_RAW_DATA_URL = "asset/raw-data-url";
|
|
82
66
|
/**
|
|
83
|
-
* @type {Readonly<"runtime">}
|
|
84
67
|
* This is the module type used for the webpack runtime abstractions.
|
|
85
68
|
*/
|
|
86
|
-
|
|
69
|
+
exports.WEBPACK_MODULE_TYPE_RUNTIME = "runtime";
|
|
87
70
|
/**
|
|
88
|
-
* @type {Readonly<"fallback-module">}
|
|
89
71
|
* This is the module type used for the ModuleFederation feature's FallbackModule class.
|
|
90
72
|
* TODO: Document this better.
|
|
91
73
|
*/
|
|
92
|
-
|
|
74
|
+
exports.WEBPACK_MODULE_TYPE_FALLBACK = "fallback-module";
|
|
93
75
|
/**
|
|
94
|
-
* @type {Readonly<"remote-module">}
|
|
95
76
|
* This is the module type used for the ModuleFederation feature's RemoteModule class.
|
|
96
77
|
* TODO: Document this better.
|
|
97
78
|
*/
|
|
98
|
-
|
|
79
|
+
exports.WEBPACK_MODULE_TYPE_REMOTE = "remote-module";
|
|
99
80
|
/**
|
|
100
|
-
* @type {Readonly<"provide-module">}
|
|
101
81
|
* This is the module type used for the ModuleFederation feature's ProvideModule class.
|
|
102
82
|
* TODO: Document this better.
|
|
103
83
|
*/
|
|
104
|
-
|
|
84
|
+
exports.WEBPACK_MODULE_TYPE_PROVIDE = "provide-module";
|
|
105
85
|
/**
|
|
106
|
-
* @type {Readonly<"consume-shared-module">}
|
|
107
86
|
* This is the module type used for the ModuleFederation feature's ConsumeSharedModule class.
|
|
108
87
|
*/
|
|
109
|
-
|
|
88
|
+
exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE = "consume-shared-module";
|
|
110
89
|
/**
|
|
111
|
-
* @type {Readonly<"lazy-compilation-proxy">}
|
|
112
90
|
* Module type used for `experiments.lazyCompilation` feature. See `LazyCompilationPlugin` for more information.
|
|
113
91
|
*/
|
|
114
|
-
|
|
115
|
-
/** @typedef {"javascript/auto" | "javascript/dynamic" | "javascript/esm"} JavaScriptModuleTypes */
|
|
116
|
-
/** @typedef {"json"} JSONModuleType */
|
|
117
|
-
/** @typedef {"webassembly/async" | "webassembly/sync"} WebAssemblyModuleTypes */
|
|
118
|
-
/** @typedef {"css" | "css/global" | "css/module"} CSSModuleTypes */
|
|
119
|
-
/** @typedef {"asset" | "asset/inline" | "asset/resource" | "asset/source" | "asset/raw-data-url"} AssetModuleTypes */
|
|
120
|
-
/** @typedef {"runtime" | "fallback-module" | "remote-module" | "provide-module" | "consume-shared-module" | "lazy-compilation-proxy"} WebpackModuleTypes */
|
|
121
|
-
/** @typedef {string} UnknownModuleTypes */
|
|
122
|
-
/** @typedef {JavaScriptModuleTypes | JSONModuleType | WebAssemblyModuleTypes | CSSModuleTypes | AssetModuleTypes | WebpackModuleTypes | UnknownModuleTypes} ModuleTypes */
|
|
123
|
-
exports.ASSET_MODULE_TYPE = ASSET_MODULE_TYPE;
|
|
124
|
-
exports.ASSET_MODULE_TYPE_RAW_DATA_URL = ASSET_MODULE_TYPE_RAW_DATA_URL;
|
|
125
|
-
exports.ASSET_MODULE_TYPE_SOURCE = ASSET_MODULE_TYPE_SOURCE;
|
|
126
|
-
exports.ASSET_MODULE_TYPE_RESOURCE = ASSET_MODULE_TYPE_RESOURCE;
|
|
127
|
-
exports.ASSET_MODULE_TYPE_INLINE = ASSET_MODULE_TYPE_INLINE;
|
|
128
|
-
exports.JAVASCRIPT_MODULE_TYPE_AUTO = JAVASCRIPT_MODULE_TYPE_AUTO;
|
|
129
|
-
exports.JAVASCRIPT_MODULE_TYPE_DYNAMIC = JAVASCRIPT_MODULE_TYPE_DYNAMIC;
|
|
130
|
-
exports.JAVASCRIPT_MODULE_TYPE_ESM = JAVASCRIPT_MODULE_TYPE_ESM;
|
|
131
|
-
exports.JSON_MODULE_TYPE = JSON_MODULE_TYPE;
|
|
132
|
-
exports.WEBASSEMBLY_MODULE_TYPE_ASYNC = WEBASSEMBLY_MODULE_TYPE_ASYNC;
|
|
133
|
-
exports.WEBASSEMBLY_MODULE_TYPE_SYNC = WEBASSEMBLY_MODULE_TYPE_SYNC;
|
|
134
|
-
exports.CSS_MODULE_TYPE = CSS_MODULE_TYPE;
|
|
135
|
-
exports.CSS_MODULE_TYPE_GLOBAL = CSS_MODULE_TYPE_GLOBAL;
|
|
136
|
-
exports.CSS_MODULE_TYPE_MODULE = CSS_MODULE_TYPE_MODULE;
|
|
137
|
-
exports.CSS_MODULE_TYPE_AUTO = CSS_MODULE_TYPE_AUTO;
|
|
138
|
-
exports.WEBPACK_MODULE_TYPE_RUNTIME = WEBPACK_MODULE_TYPE_RUNTIME;
|
|
139
|
-
exports.WEBPACK_MODULE_TYPE_FALLBACK = WEBPACK_MODULE_TYPE_FALLBACK;
|
|
140
|
-
exports.WEBPACK_MODULE_TYPE_REMOTE = WEBPACK_MODULE_TYPE_REMOTE;
|
|
141
|
-
exports.WEBPACK_MODULE_TYPE_PROVIDE = WEBPACK_MODULE_TYPE_PROVIDE;
|
|
142
|
-
exports.WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE =
|
|
143
|
-
WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE;
|
|
144
|
-
exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY =
|
|
145
|
-
WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY;
|
|
92
|
+
exports.WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY = "lazy-compilation-proxy";
|
package/dist/NormalModule.js
CHANGED
|
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.NormalModule = void 0;
|
|
30
|
-
const
|
|
30
|
+
const node_util_1 = __importDefault(require("node:util"));
|
|
31
31
|
const liteTapable = __importStar(require("@rspack/lite-tapable"));
|
|
32
32
|
const Compilation_1 = require("./Compilation");
|
|
33
33
|
const compilationHooksMap = new WeakMap();
|
|
@@ -45,14 +45,14 @@ const deprecateAllProperties = (obj, message, code) => {
|
|
|
45
45
|
if (typeof descriptor.value === "function") {
|
|
46
46
|
Object.defineProperty(newObj, name, {
|
|
47
47
|
...descriptor,
|
|
48
|
-
value:
|
|
48
|
+
value: node_util_1.default.deprecate(descriptor.value, message, code)
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
else if (descriptor.get || descriptor.set) {
|
|
52
52
|
Object.defineProperty(newObj, name, {
|
|
53
53
|
...descriptor,
|
|
54
|
-
get: descriptor.get &&
|
|
55
|
-
set: descriptor.set &&
|
|
54
|
+
get: descriptor.get && node_util_1.default.deprecate(descriptor.get, message, code),
|
|
55
|
+
set: descriptor.set && node_util_1.default.deprecate(descriptor.set, message, code)
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
@@ -60,9 +60,9 @@ const deprecateAllProperties = (obj, message, code) => {
|
|
|
60
60
|
Object.defineProperty(newObj, name, {
|
|
61
61
|
configurable: descriptor.configurable,
|
|
62
62
|
enumerable: descriptor.enumerable,
|
|
63
|
-
get:
|
|
63
|
+
get: node_util_1.default.deprecate(() => value, message, code),
|
|
64
64
|
set: descriptor.writable
|
|
65
|
-
?
|
|
65
|
+
? node_util_1.default.deprecate((v) => (value = v), message, code)
|
|
66
66
|
: undefined
|
|
67
67
|
});
|
|
68
68
|
}
|
package/dist/Stats.js
CHANGED
|
@@ -99,13 +99,11 @@ _Stats_inner = new WeakMap(), _Stats_innerMap = new WeakMap(), _Stats_instances
|
|
|
99
99
|
function normalizeStatsPreset(options) {
|
|
100
100
|
if (typeof options === "boolean" || typeof options === "string")
|
|
101
101
|
return presetToOptions(options);
|
|
102
|
-
|
|
102
|
+
if (!options)
|
|
103
103
|
return {};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return obj;
|
|
108
|
-
}
|
|
104
|
+
const obj = { ...presetToOptions(options.preset), ...options };
|
|
105
|
+
delete obj.preset;
|
|
106
|
+
return obj;
|
|
109
107
|
}
|
|
110
108
|
exports.normalizeStatsPreset = normalizeStatsPreset;
|
|
111
109
|
function presetToOptions(name) {
|
package/dist/Template.d.ts
CHANGED
|
@@ -1,193 +1,77 @@
|
|
|
1
|
-
export = Template;
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @property {DependencyTemplates} dependencyTemplates
|
|
11
|
-
* @property {RuntimeTemplate} runtimeTemplate
|
|
12
|
-
* @property {ModuleGraph} moduleGraph
|
|
13
|
-
* @property {ChunkGraph} chunkGraph
|
|
14
|
-
*/
|
|
15
|
-
/** @typedef {RenderManifestEntryTemplated | RenderManifestEntryStatic} RenderManifestEntry */
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {Object} RenderManifestEntryTemplated
|
|
18
|
-
* @property {function(): Source} render
|
|
19
|
-
* @property {string | function(PathData, AssetInfo=): string} filenameTemplate
|
|
20
|
-
* @property {PathData=} pathOptions
|
|
21
|
-
* @property {AssetInfo=} info
|
|
22
|
-
* @property {string} identifier
|
|
23
|
-
* @property {string=} hash
|
|
24
|
-
* @property {boolean=} auxiliary
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {Object} RenderManifestEntryStatic
|
|
28
|
-
* @property {function(): Source} render
|
|
29
|
-
* @property {string} filename
|
|
30
|
-
* @property {AssetInfo} info
|
|
31
|
-
* @property {string} identifier
|
|
32
|
-
* @property {string=} hash
|
|
33
|
-
* @property {boolean=} auxiliary
|
|
34
|
-
*/
|
|
35
|
-
/**
|
|
36
|
-
* @typedef {Object} HasId
|
|
37
|
-
* @property {number | string} id
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* @typedef {function(Module, number): boolean} ModuleFilterPredicate
|
|
2
|
+
* The following code is modified based on
|
|
3
|
+
* https://github.com/webpack/webpack/blob/4b4ca3b/lib/Template.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
|
|
41
9
|
*/
|
|
42
10
|
declare class Template {
|
|
43
11
|
/**
|
|
44
12
|
*
|
|
45
|
-
* @param
|
|
46
|
-
* @returns
|
|
13
|
+
* @param fn a runtime function (.runtime.js) "template"
|
|
14
|
+
* @returns the updated and normalized function string
|
|
47
15
|
*/
|
|
48
16
|
static getFunctionContent(fn: Function): string;
|
|
49
17
|
/**
|
|
50
|
-
* @param
|
|
51
|
-
* @returns
|
|
18
|
+
* @param str the string converted to identifier
|
|
19
|
+
* @returns created identifier
|
|
52
20
|
*/
|
|
53
21
|
static toIdentifier(str: any): string;
|
|
54
22
|
/**
|
|
55
23
|
*
|
|
56
|
-
* @param
|
|
57
|
-
* @returns
|
|
24
|
+
* @param str string to be converted to commented in bundle code
|
|
25
|
+
* @returns returns a commented version of string
|
|
58
26
|
*/
|
|
59
27
|
static toComment(str: string): string;
|
|
60
28
|
/**
|
|
61
29
|
*
|
|
62
|
-
* @param
|
|
63
|
-
* @returns
|
|
30
|
+
* @param str string to be converted to "normal comment"
|
|
31
|
+
* @returns returns a commented version of string
|
|
64
32
|
*/
|
|
65
33
|
static toNormalComment(str: string): string;
|
|
66
34
|
/**
|
|
67
|
-
* @param
|
|
68
|
-
* @returns
|
|
35
|
+
* @param str string path to be normalized
|
|
36
|
+
* @returns normalized bundle-safe path
|
|
69
37
|
*/
|
|
70
38
|
static toPath(str: string): string;
|
|
71
39
|
/**
|
|
72
|
-
* @param
|
|
73
|
-
* @returns
|
|
40
|
+
* @param n number to convert to ident
|
|
41
|
+
* @returns returns single character ident
|
|
74
42
|
*/
|
|
75
43
|
static numberToIdentifier(n: number): string;
|
|
76
44
|
/**
|
|
77
|
-
* @param
|
|
78
|
-
* @returns
|
|
45
|
+
* @param n number to convert to ident
|
|
46
|
+
* @returns returns single character ident
|
|
79
47
|
*/
|
|
80
48
|
static numberToIdentifierContinuation(n: number): string;
|
|
81
49
|
/**
|
|
82
50
|
*
|
|
83
|
-
* @param
|
|
84
|
-
* @returns
|
|
51
|
+
* @param s string to convert to identity
|
|
52
|
+
* @returns converted identity
|
|
85
53
|
*/
|
|
86
54
|
static indent(s: string | string[]): string;
|
|
87
55
|
/**
|
|
88
56
|
*
|
|
89
|
-
* @param
|
|
90
|
-
* @param
|
|
91
|
-
* @returns
|
|
57
|
+
* @param s string to create prefix for
|
|
58
|
+
* @param prefix prefix to compose
|
|
59
|
+
* @returns returns new prefix string
|
|
92
60
|
*/
|
|
93
61
|
static prefix(s: string | string[], prefix: string): string;
|
|
94
62
|
/**
|
|
95
63
|
*
|
|
96
|
-
* @param
|
|
97
|
-
* @returns
|
|
64
|
+
* @param str string or string collection
|
|
65
|
+
* @returns returns a single string from array
|
|
98
66
|
*/
|
|
99
67
|
static asString(str: string | string[]): string;
|
|
100
68
|
/**
|
|
101
|
-
* @
|
|
102
|
-
* @
|
|
103
|
-
*/
|
|
104
|
-
/**
|
|
105
|
-
* @param {WithId[]} modules a collection of modules to get array bounds for
|
|
106
|
-
* @returns {[number, number] | false} returns the upper and lower array bounds
|
|
69
|
+
* @param modules a collection of modules to get array bounds for
|
|
70
|
+
* @returns returns the upper and lower array bounds
|
|
107
71
|
* or false if not every module has a number based id
|
|
108
72
|
*/
|
|
109
73
|
static getModulesArrayBounds(modules: {
|
|
110
74
|
id: string | number;
|
|
111
75
|
}[]): [number, number] | false;
|
|
112
|
-
/**
|
|
113
|
-
* @param {ChunkRenderContext} renderContext render context
|
|
114
|
-
* @param {Module[]} modules modules to render (should be ordered by identifier)
|
|
115
|
-
* @param {function(Module): Source} renderModule function to render a module
|
|
116
|
-
* @param {string=} prefix applying prefix strings
|
|
117
|
-
* @returns {Source | null} rendered chunk modules in a Source object or null if no modules
|
|
118
|
-
*/
|
|
119
|
-
static renderChunkModules(renderContext: ChunkRenderContext, modules: Module[], renderModule: (arg0: Module) => Source, prefix?: string | undefined): Source | null;
|
|
120
|
-
/**
|
|
121
|
-
* @param {RuntimeModule[]} runtimeModules array of runtime modules in order
|
|
122
|
-
* @param {RenderContext & { codeGenerationResults?: CodeGenerationResults }} renderContext render context
|
|
123
|
-
* @returns {Source} rendered runtime modules in a Source object
|
|
124
|
-
*/
|
|
125
|
-
static renderRuntimeModules(runtimeModules: RuntimeModule[], renderContext: RenderContext & {
|
|
126
|
-
codeGenerationResults?: CodeGenerationResults;
|
|
127
|
-
}): Source;
|
|
128
|
-
/**
|
|
129
|
-
* @param {RuntimeModule[]} runtimeModules array of runtime modules in order
|
|
130
|
-
* @param {RenderContext} renderContext render context
|
|
131
|
-
* @returns {Source} rendered chunk runtime modules in a Source object
|
|
132
|
-
*/
|
|
133
|
-
static renderChunkRuntimeModules(runtimeModules: RuntimeModule[], renderContext: RenderContext): Source;
|
|
134
|
-
}
|
|
135
|
-
declare namespace Template {
|
|
136
|
-
export { NUMBER_OF_IDENTIFIER_START_CHARS, NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS, Source, OutputOptions, Chunk, ChunkGraph, CodeGenerationResults, AssetInfo, PathData, DependencyTemplates, Module, ModuleGraph, ModuleTemplate, RuntimeModule, RuntimeTemplate, ChunkRenderContext, RenderContext, RenderManifestOptions, RenderManifestEntry, RenderManifestEntryTemplated, RenderManifestEntryStatic, HasId, ModuleFilterPredicate };
|
|
137
76
|
}
|
|
138
|
-
|
|
139
|
-
type Module = any;
|
|
140
|
-
type Source = import("../compiled/webpack-sources").Source;
|
|
141
|
-
type RuntimeModule = any;
|
|
142
|
-
type RenderContext = any;
|
|
143
|
-
type CodeGenerationResults = any;
|
|
144
|
-
declare const NUMBER_OF_IDENTIFIER_START_CHARS: number;
|
|
145
|
-
declare const NUMBER_OF_IDENTIFIER_CONTINUATION_CHARS: number;
|
|
146
|
-
type OutputOptions = any;
|
|
147
|
-
type Chunk = any;
|
|
148
|
-
type ChunkGraph = any;
|
|
149
|
-
type AssetInfo = any;
|
|
150
|
-
type PathData = any;
|
|
151
|
-
type DependencyTemplates = any;
|
|
152
|
-
type ModuleGraph = any;
|
|
153
|
-
type ModuleTemplate = any;
|
|
154
|
-
type RuntimeTemplate = any;
|
|
155
|
-
type RenderManifestOptions = {
|
|
156
|
-
/**
|
|
157
|
-
* the chunk used to render
|
|
158
|
-
*/
|
|
159
|
-
chunk: Chunk;
|
|
160
|
-
hash: string;
|
|
161
|
-
fullHash: string;
|
|
162
|
-
outputOptions: OutputOptions;
|
|
163
|
-
codeGenerationResults: CodeGenerationResults;
|
|
164
|
-
moduleTemplates: {
|
|
165
|
-
javascript: ModuleTemplate;
|
|
166
|
-
};
|
|
167
|
-
dependencyTemplates: DependencyTemplates;
|
|
168
|
-
runtimeTemplate: RuntimeTemplate;
|
|
169
|
-
moduleGraph: ModuleGraph;
|
|
170
|
-
chunkGraph: ChunkGraph;
|
|
171
|
-
};
|
|
172
|
-
type RenderManifestEntry = RenderManifestEntryTemplated | RenderManifestEntryStatic;
|
|
173
|
-
type RenderManifestEntryTemplated = {
|
|
174
|
-
render: () => Source;
|
|
175
|
-
filenameTemplate: string | ((arg0: PathData, arg1: AssetInfo | undefined) => string);
|
|
176
|
-
pathOptions?: PathData | undefined;
|
|
177
|
-
info?: AssetInfo | undefined;
|
|
178
|
-
identifier: string;
|
|
179
|
-
hash?: string | undefined;
|
|
180
|
-
auxiliary?: boolean | undefined;
|
|
181
|
-
};
|
|
182
|
-
type RenderManifestEntryStatic = {
|
|
183
|
-
render: () => Source;
|
|
184
|
-
filename: string;
|
|
185
|
-
info: AssetInfo;
|
|
186
|
-
identifier: string;
|
|
187
|
-
hash?: string | undefined;
|
|
188
|
-
auxiliary?: boolean | undefined;
|
|
189
|
-
};
|
|
190
|
-
type HasId = {
|
|
191
|
-
id: number | string;
|
|
192
|
-
};
|
|
193
|
-
type ModuleFilterPredicate = (arg0: Module, arg1: number) => boolean;
|
|
77
|
+
export { Template };
|