@ohos-ports/rsbuild-core 1.7.2-beta.1
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 +21 -0
- package/README.md +27 -0
- package/bin/rsbuild.js +20 -0
- package/compiled/@jridgewell/remapping/index.d.ts +1 -0
- package/compiled/@jridgewell/remapping/index.js +1222 -0
- package/compiled/@jridgewell/remapping/license +19 -0
- package/compiled/@jridgewell/remapping/package.json +1 -0
- package/compiled/@jridgewell/trace-mapping/index.d.ts +194 -0
- package/compiled/@jridgewell/trace-mapping/index.js +1408 -0
- package/compiled/@jridgewell/trace-mapping/license +19 -0
- package/compiled/@jridgewell/trace-mapping/package.json +1 -0
- package/compiled/chokidar/index.d.ts +384 -0
- package/compiled/chokidar/index.js +1793 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/connect/index.d.ts +90 -0
- package/compiled/connect/index.js +1240 -0
- package/compiled/connect/license +25 -0
- package/compiled/connect/package.json +1 -0
- package/compiled/cors/index.d.ts +56 -0
- package/compiled/cors/index.js +371 -0
- package/compiled/cors/license +22 -0
- package/compiled/cors/package.json +1 -0
- package/compiled/css-loader/api.js +85 -0
- package/compiled/css-loader/getUrl.js +26 -0
- package/compiled/css-loader/index.d.ts +1 -0
- package/compiled/css-loader/index.js +2 -0
- package/compiled/css-loader/license +20 -0
- package/compiled/css-loader/noSourceMaps.js +5 -0
- package/compiled/css-loader/package.json +1 -0
- package/compiled/css-loader/sourceMaps.js +16 -0
- package/compiled/html-rspack-plugin/default_index.ejs +9 -0
- package/compiled/html-rspack-plugin/index.d.ts +290 -0
- package/compiled/html-rspack-plugin/index.js +1602 -0
- package/compiled/html-rspack-plugin/license +20 -0
- package/compiled/html-rspack-plugin/loader.js +166 -0
- package/compiled/html-rspack-plugin/package.json +1 -0
- package/compiled/http-proxy-middleware/index.d.ts +319 -0
- package/compiled/http-proxy-middleware/index.js +5284 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/launch-editor-middleware/index.d.ts +1 -0
- package/compiled/launch-editor-middleware/index.js +719 -0
- package/compiled/launch-editor-middleware/license +21 -0
- package/compiled/launch-editor-middleware/package.json +1 -0
- package/compiled/memfs/index.d.ts +1462 -0
- package/compiled/memfs/index.js +1 -0
- package/compiled/memfs/license +201 -0
- package/compiled/memfs/package.json +1 -0
- package/compiled/mrmime/index.d.ts +4 -0
- package/compiled/mrmime/index.js +456 -0
- package/compiled/mrmime/package.json +1 -0
- package/compiled/picocolors/index.d.ts +55 -0
- package/compiled/picocolors/index.js +108 -0
- package/compiled/picocolors/license +15 -0
- package/compiled/picocolors/package.json +1 -0
- package/compiled/postcss/index.js +1 -0
- package/compiled/postcss/lib/at-rule.d.ts +140 -0
- package/compiled/postcss/lib/comment.d.ts +68 -0
- package/compiled/postcss/lib/container.d.ts +483 -0
- package/compiled/postcss/lib/css-syntax-error.d.ts +248 -0
- package/compiled/postcss/lib/declaration.d.ts +151 -0
- package/compiled/postcss/lib/document.d.ts +69 -0
- package/compiled/postcss/lib/fromJSON.d.ts +9 -0
- package/compiled/postcss/lib/input.d.ts +227 -0
- package/compiled/postcss/lib/lazy-result.d.ts +190 -0
- package/compiled/postcss/lib/list.d.ts +60 -0
- package/compiled/postcss/lib/no-work-result.d.ts +46 -0
- package/compiled/postcss/lib/node.d.ts +556 -0
- package/compiled/postcss/lib/parse.d.ts +9 -0
- package/compiled/postcss/lib/postcss.d.ts +458 -0
- package/compiled/postcss/lib/previous-map.d.ts +81 -0
- package/compiled/postcss/lib/processor.d.ts +115 -0
- package/compiled/postcss/lib/result.d.ts +205 -0
- package/compiled/postcss/lib/root.d.ts +87 -0
- package/compiled/postcss/lib/rule.d.ts +126 -0
- package/compiled/postcss/lib/source-map-js.d.ts +4 -0
- package/compiled/postcss/lib/stringifier.d.ts +46 -0
- package/compiled/postcss/lib/stringify.d.ts +9 -0
- package/compiled/postcss/lib/warning.d.ts +147 -0
- package/compiled/postcss/license +20 -0
- package/compiled/postcss/package.json +1 -0
- package/compiled/postcss-loader/index.d.ts +1 -0
- package/compiled/postcss-loader/index.js +720 -0
- package/compiled/postcss-loader/license +20 -0
- package/compiled/postcss-loader/package.json +1 -0
- package/compiled/rslog/index.d.ts +67 -0
- package/compiled/rslog/license +21 -0
- package/compiled/rslog/package.json +1 -0
- package/compiled/rspack-chain/license +22 -0
- package/compiled/rspack-chain/package.json +1 -0
- package/compiled/rspack-chain/types/index.d.ts +545 -0
- package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
- package/compiled/rspack-manifest-plugin/index.js +409 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/sirv/index.d.ts +1 -0
- package/compiled/sirv/index.js +274 -0
- package/compiled/sirv/package.json +1 -0
- package/compiled/style-loader/index.d.ts +1 -0
- package/compiled/style-loader/index.js +427 -0
- package/compiled/style-loader/license +20 -0
- package/compiled/style-loader/package.json +1 -0
- package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
- package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
- package/compiled/style-loader/runtime/insertBySelector.js +34 -0
- package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
- package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
- package/compiled/style-loader/runtime/isOldIE.js +17 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
- package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
- package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
- package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
- package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
- package/compiled/tinyglobby/index.d.ts +46 -0
- package/compiled/tinyglobby/index.js +2664 -0
- package/compiled/tinyglobby/license +21 -0
- package/compiled/tinyglobby/package.json +1 -0
- package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
- package/compiled/webpack-bundle-analyzer/index.js +23 -0
- package/compiled/webpack-bundle-analyzer/license +20 -0
- package/compiled/webpack-bundle-analyzer/package.json +1 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
- package/compiled/webpack-merge/index.d.ts +31 -0
- package/compiled/webpack-merge/index.js +1200 -0
- package/compiled/webpack-merge/license +20 -0
- package/compiled/webpack-merge/package.json +1 -0
- package/compiled/ws/index.d.ts +437 -0
- package/compiled/ws/index.js +3161 -0
- package/compiled/ws/license +20 -0
- package/compiled/ws/package.json +1 -0
- package/dist/0~open.js +427 -0
- package/dist/0~range-parser.js +49 -0
- package/dist/0~range-parser.js.LICENSE.txt +6 -0
- package/dist/131.js +9305 -0
- package/dist/131.js.LICENSE.txt +26 -0
- package/dist/136.mjs +42 -0
- package/dist/2~open.cjs +436 -0
- package/dist/2~range-parser.cjs +52 -0
- package/dist/2~range-parser.cjs.LICENSE.txt +6 -0
- package/dist/client/59.js +22 -0
- package/dist/client/hmr.js +206 -0
- package/dist/client/overlay.js +203 -0
- package/dist/ignoreCssLoader.mjs +3 -0
- package/dist/index.cjs +9456 -0
- package/dist/index.cjs.LICENSE.txt +26 -0
- package/dist/index.js +1 -0
- package/dist/rslib-runtime.js +44 -0
- package/dist/transformLoader.mjs +1 -0
- package/dist/transformRawLoader.mjs +4 -0
- package/dist-types/cli/commands.d.ts +28 -0
- package/dist-types/cli/index.d.ts +1 -0
- package/dist-types/cli/init.d.ts +7 -0
- package/dist-types/client/hmr.d.ts +3 -0
- package/dist-types/client/log.d.ts +13 -0
- package/dist-types/client/overlay.d.ts +1 -0
- package/dist-types/configChain.d.ts +154 -0
- package/dist-types/constants.d.ts +52 -0
- package/dist-types/createContext.d.ts +11 -0
- package/dist-types/createRsbuild.d.ts +5 -0
- package/dist-types/defaultConfig.d.ts +25 -0
- package/dist-types/helpers/compiler.d.ts +5 -0
- package/dist-types/helpers/exitHook.d.ts +3 -0
- package/dist-types/helpers/format.d.ts +2 -0
- package/dist-types/helpers/fs.d.ts +17 -0
- package/dist-types/helpers/index.d.ts +29 -0
- package/dist-types/helpers/path.d.ts +26 -0
- package/dist-types/helpers/stats.d.ts +18 -0
- package/dist-types/helpers/url.d.ts +11 -0
- package/dist-types/helpers/vendors.d.ts +29 -0
- package/dist-types/helpers/version.d.ts +7 -0
- package/dist-types/hooks.d.ts +44 -0
- package/dist-types/index.d.ts +22 -0
- package/dist-types/initPlugins.d.ts +6 -0
- package/dist-types/inspectConfig.d.ts +35 -0
- package/dist-types/loadConfig.d.ts +60 -0
- package/dist-types/loadEnv.d.ts +63 -0
- package/dist-types/loader/ignoreCssLoader.d.ts +3 -0
- package/dist-types/loader/transformLoader.d.ts +8 -0
- package/dist-types/loader/transformRawLoader.d.ts +3 -0
- package/dist-types/logger.d.ts +19 -0
- package/dist-types/mergeConfig.d.ts +2 -0
- package/dist-types/package.json +1 -0
- package/dist-types/pluginHelper.d.ts +12 -0
- package/dist-types/pluginManager.d.ts +21 -0
- package/dist-types/plugins/appIcon.d.ts +2 -0
- package/dist-types/plugins/asset.d.ts +3 -0
- package/dist-types/plugins/basic.d.ts +5 -0
- package/dist-types/plugins/bundleAnalyzer.d.ts +2 -0
- package/dist-types/plugins/cache.d.ts +2 -0
- package/dist-types/plugins/cleanOutput.d.ts +2 -0
- package/dist-types/plugins/css.d.ts +4 -0
- package/dist-types/plugins/define.d.ts +2 -0
- package/dist-types/plugins/entry.d.ts +2 -0
- package/dist-types/plugins/esm.d.ts +2 -0
- package/dist-types/plugins/externals.d.ts +2 -0
- package/dist-types/plugins/fileSize.d.ts +6 -0
- package/dist-types/plugins/html.d.ts +9 -0
- package/dist-types/plugins/inlineChunk.d.ts +6 -0
- package/dist-types/plugins/lazyCompilation.d.ts +2 -0
- package/dist-types/plugins/manifest.d.ts +2 -0
- package/dist-types/plugins/minimize.d.ts +10 -0
- package/dist-types/plugins/moduleFederation.d.ts +2 -0
- package/dist-types/plugins/moment.d.ts +2 -0
- package/dist-types/plugins/nodeAddons.d.ts +2 -0
- package/dist-types/plugins/nonce.d.ts +2 -0
- package/dist-types/plugins/output.d.ts +2 -0
- package/dist-types/plugins/performance.d.ts +5 -0
- package/dist-types/plugins/progress.d.ts +2 -0
- package/dist-types/plugins/resolve.d.ts +2 -0
- package/dist-types/plugins/resourceHints.d.ts +2 -0
- package/dist-types/plugins/rsdoctor.d.ts +2 -0
- package/dist-types/plugins/rspackProfile.d.ts +2 -0
- package/dist-types/plugins/server.d.ts +2 -0
- package/dist-types/plugins/sourceMap.d.ts +2 -0
- package/dist-types/plugins/splitChunks.d.ts +4 -0
- package/dist-types/plugins/sri.d.ts +2 -0
- package/dist-types/plugins/swc.d.ts +5 -0
- package/dist-types/plugins/target.d.ts +2 -0
- package/dist-types/plugins/wasm.d.ts +2 -0
- package/dist-types/provider/build.d.ts +4 -0
- package/dist-types/provider/createCompiler.d.ts +6 -0
- package/dist-types/provider/helpers.d.ts +12 -0
- package/dist-types/provider/initConfigs.d.ts +19 -0
- package/dist-types/provider/provider.d.ts +2 -0
- package/dist-types/provider/rspackConfig.d.ts +8 -0
- package/dist-types/restart.d.ts +18 -0
- package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +38 -0
- package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +32 -0
- package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +28 -0
- package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +23 -0
- package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +22 -0
- package/dist-types/rspack.d.ts +2 -0
- package/dist-types/server/ansiHTML.d.ts +4 -0
- package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +12 -0
- package/dist-types/server/assets-middleware/index.d.ts +37 -0
- package/dist-types/server/assets-middleware/middleware.d.ts +2 -0
- package/dist-types/server/assets-middleware/parseTokenList.d.ts +1 -0
- package/dist-types/server/assets-middleware/setupOutputFileSystem.d.ts +3 -0
- package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +15 -0
- package/dist-types/server/browserLogs.d.ts +9 -0
- package/dist-types/server/buildManager.d.ts +33 -0
- package/dist-types/server/cliShortcuts.d.ts +10 -0
- package/dist-types/server/devMiddlewares.d.ts +21 -0
- package/dist-types/server/devServer.d.ts +79 -0
- package/dist-types/server/environment.d.ts +8 -0
- package/dist-types/server/gracefulShutdown.d.ts +10 -0
- package/dist-types/server/gzipMiddleware.d.ts +2 -0
- package/dist-types/server/helper.d.ts +91 -0
- package/dist-types/server/historyApiFallback.d.ts +2 -0
- package/dist-types/server/hmrFallback.d.ts +1 -0
- package/dist-types/server/httpServer.d.ts +7 -0
- package/dist-types/server/middlewares.d.ts +33 -0
- package/dist-types/server/open.d.ts +10 -0
- package/dist-types/server/overlay.d.ts +3 -0
- package/dist-types/server/prodServer.d.ts +24 -0
- package/dist-types/server/proxy.d.ts +6 -0
- package/dist-types/server/runner/asModule.d.ts +2 -0
- package/dist-types/server/runner/basic.d.ts +29 -0
- package/dist-types/server/runner/cjs.d.ts +10 -0
- package/dist-types/server/runner/esm.d.ts +6 -0
- package/dist-types/server/runner/index.d.ts +4 -0
- package/dist-types/server/runner/type.d.ts +42 -0
- package/dist-types/server/socketServer.d.ts +81 -0
- package/dist-types/server/watchFiles.d.ts +14 -0
- package/dist-types/types/config.d.ts +1882 -0
- package/dist-types/types/context.d.ts +110 -0
- package/dist-types/types/hooks.d.ts +275 -0
- package/dist-types/types/index.d.ts +8 -0
- package/dist-types/types/plugin.d.ts +585 -0
- package/dist-types/types/rsbuild.d.ts +286 -0
- package/dist-types/types/rspack.d.ts +16 -0
- package/dist-types/types/thirdParty.d.ts +186 -0
- package/dist-types/types/utils.d.ts +19 -0
- package/package.json +114 -0
- package/static/openChrome.applescript +95 -0
- package/types.d.ts +349 -0
|
@@ -0,0 +1,1602 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
694: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
|
+
"use strict";
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(479);
|
|
6
|
+
const compilerMap = new WeakMap();
|
|
7
|
+
class CachedChildCompilation {
|
|
8
|
+
constructor(compiler) {
|
|
9
|
+
this.compiler = compiler;
|
|
10
|
+
if (compilerMap.has(compiler)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const persistentChildCompilerSingletonPlugin =
|
|
14
|
+
new PersistentChildCompilerSingletonPlugin();
|
|
15
|
+
compilerMap.set(compiler, persistentChildCompilerSingletonPlugin);
|
|
16
|
+
persistentChildCompilerSingletonPlugin.apply(compiler);
|
|
17
|
+
}
|
|
18
|
+
addEntry(entry) {
|
|
19
|
+
const persistentChildCompilerSingletonPlugin = compilerMap.get(
|
|
20
|
+
this.compiler,
|
|
21
|
+
);
|
|
22
|
+
if (!persistentChildCompilerSingletonPlugin) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
"PersistentChildCompilerSingletonPlugin instance not found.",
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
persistentChildCompilerSingletonPlugin.addEntry(entry);
|
|
28
|
+
}
|
|
29
|
+
getCompilationResult() {
|
|
30
|
+
const persistentChildCompilerSingletonPlugin = compilerMap.get(
|
|
31
|
+
this.compiler,
|
|
32
|
+
);
|
|
33
|
+
if (!persistentChildCompilerSingletonPlugin) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
"PersistentChildCompilerSingletonPlugin instance not found.",
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return persistentChildCompilerSingletonPlugin.getLatestResult();
|
|
39
|
+
}
|
|
40
|
+
getCompilationEntryResult(entry) {
|
|
41
|
+
const latestResult = this.getCompilationResult();
|
|
42
|
+
const compilationResult = latestResult.compilationResult;
|
|
43
|
+
return "error" in compilationResult
|
|
44
|
+
? {
|
|
45
|
+
mainCompilationHash: latestResult.mainCompilationHash,
|
|
46
|
+
error: compilationResult.error,
|
|
47
|
+
}
|
|
48
|
+
: {
|
|
49
|
+
mainCompilationHash: latestResult.mainCompilationHash,
|
|
50
|
+
compiledEntry: compilationResult.compiledEntries[entry],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class PersistentChildCompilerSingletonPlugin {
|
|
55
|
+
static createSnapshot(fileDependencies, mainCompilation) {
|
|
56
|
+
const timestamps = {};
|
|
57
|
+
const fs = mainCompilation.inputFileSystem;
|
|
58
|
+
return Promise.all(
|
|
59
|
+
fileDependencies.map(
|
|
60
|
+
(file) =>
|
|
61
|
+
new Promise((resolve) => {
|
|
62
|
+
fs.stat(file, (err, stat) => {
|
|
63
|
+
if (!err && stat) {
|
|
64
|
+
timestamps[file] = stat.mtime.getTime();
|
|
65
|
+
} else {
|
|
66
|
+
timestamps[file] = null;
|
|
67
|
+
}
|
|
68
|
+
resolve();
|
|
69
|
+
});
|
|
70
|
+
}),
|
|
71
|
+
),
|
|
72
|
+
).then(() => timestamps);
|
|
73
|
+
}
|
|
74
|
+
static isSnapshotValid(snapshot, mainCompilation) {
|
|
75
|
+
const fs = mainCompilation.inputFileSystem;
|
|
76
|
+
return Promise.all(
|
|
77
|
+
Object.keys(snapshot).map(
|
|
78
|
+
(file) =>
|
|
79
|
+
new Promise((resolve) => {
|
|
80
|
+
fs.stat(file, (err, stat) => {
|
|
81
|
+
if (!err && stat && snapshot[file] !== null) {
|
|
82
|
+
resolve(stat.mtime.getTime() === snapshot[file]);
|
|
83
|
+
} else if (err && snapshot[file] === null) {
|
|
84
|
+
resolve(true);
|
|
85
|
+
} else {
|
|
86
|
+
resolve(false);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}),
|
|
90
|
+
),
|
|
91
|
+
).then((results) => !results.includes(false));
|
|
92
|
+
}
|
|
93
|
+
static watchFiles(mainCompilation, fileDependencies) {
|
|
94
|
+
Object.keys(fileDependencies).forEach((depencyTypes) => {
|
|
95
|
+
fileDependencies[depencyTypes].forEach((fileDependency) => {
|
|
96
|
+
mainCompilation[depencyTypes].add(fileDependency);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
constructor() {
|
|
101
|
+
this.compilationState = {
|
|
102
|
+
isCompiling: false,
|
|
103
|
+
isVerifyingCache: false,
|
|
104
|
+
entries: [],
|
|
105
|
+
compiledEntries: [],
|
|
106
|
+
mainCompilationHash: "initial",
|
|
107
|
+
compilationResult: {
|
|
108
|
+
dependencies: {
|
|
109
|
+
fileDependencies: [],
|
|
110
|
+
contextDependencies: [],
|
|
111
|
+
missingDependencies: [],
|
|
112
|
+
},
|
|
113
|
+
compiledEntries: {},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
apply(compiler) {
|
|
118
|
+
let childCompilationResultPromise = Promise.resolve({
|
|
119
|
+
dependencies: {
|
|
120
|
+
fileDependencies: [],
|
|
121
|
+
contextDependencies: [],
|
|
122
|
+
missingDependencies: [],
|
|
123
|
+
},
|
|
124
|
+
compiledEntries: {},
|
|
125
|
+
});
|
|
126
|
+
let mainCompilationHashOfLastChildRecompile = "";
|
|
127
|
+
let previousFileSystemSnapshot;
|
|
128
|
+
let compilationStartTime = Date.now();
|
|
129
|
+
compiler.hooks.make.tapAsync(
|
|
130
|
+
"PersistentChildCompilerSingletonPlugin",
|
|
131
|
+
(mainCompilation, callback) => {
|
|
132
|
+
if (
|
|
133
|
+
this.compilationState.isCompiling ||
|
|
134
|
+
this.compilationState.isVerifyingCache
|
|
135
|
+
) {
|
|
136
|
+
return callback(
|
|
137
|
+
new Error("Child compilation has already started"),
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
compilationStartTime = Date.now();
|
|
141
|
+
this.compilationState = {
|
|
142
|
+
isCompiling: false,
|
|
143
|
+
isVerifyingCache: true,
|
|
144
|
+
previousEntries: this.compilationState.compiledEntries,
|
|
145
|
+
previousResult: this.compilationState.compilationResult,
|
|
146
|
+
entries: this.compilationState.entries,
|
|
147
|
+
};
|
|
148
|
+
const isCacheValidPromise = this.isCacheValid(
|
|
149
|
+
previousFileSystemSnapshot,
|
|
150
|
+
mainCompilation,
|
|
151
|
+
);
|
|
152
|
+
let cachedResult = childCompilationResultPromise;
|
|
153
|
+
childCompilationResultPromise = isCacheValidPromise.then(
|
|
154
|
+
(isCacheValid) => {
|
|
155
|
+
if (isCacheValid) {
|
|
156
|
+
return cachedResult;
|
|
157
|
+
}
|
|
158
|
+
const compiledEntriesPromise = this.compileEntries(
|
|
159
|
+
mainCompilation,
|
|
160
|
+
this.compilationState.entries,
|
|
161
|
+
);
|
|
162
|
+
compiledEntriesPromise
|
|
163
|
+
.then((childCompilationResult) =>
|
|
164
|
+
PersistentChildCompilerSingletonPlugin.createSnapshot(
|
|
165
|
+
childCompilationResult.dependencies.fileDependencies,
|
|
166
|
+
mainCompilation,
|
|
167
|
+
),
|
|
168
|
+
)
|
|
169
|
+
.then((snapshot) => {
|
|
170
|
+
previousFileSystemSnapshot = snapshot;
|
|
171
|
+
});
|
|
172
|
+
return compiledEntriesPromise;
|
|
173
|
+
},
|
|
174
|
+
);
|
|
175
|
+
mainCompilation.hooks.optimizeTree.tapAsync(
|
|
176
|
+
"PersistentChildCompilerSingletonPlugin",
|
|
177
|
+
(chunks, modules, callback) => {
|
|
178
|
+
const handleCompilationDonePromise =
|
|
179
|
+
childCompilationResultPromise.then(
|
|
180
|
+
(childCompilationResult) => {
|
|
181
|
+
this.watchFiles(
|
|
182
|
+
mainCompilation,
|
|
183
|
+
childCompilationResult.dependencies,
|
|
184
|
+
);
|
|
185
|
+
},
|
|
186
|
+
);
|
|
187
|
+
handleCompilationDonePromise.then(
|
|
188
|
+
() => callback(null, chunks, modules),
|
|
189
|
+
callback,
|
|
190
|
+
);
|
|
191
|
+
},
|
|
192
|
+
);
|
|
193
|
+
mainCompilation.hooks.additionalAssets.tapAsync(
|
|
194
|
+
"PersistentChildCompilerSingletonPlugin",
|
|
195
|
+
(callback) => {
|
|
196
|
+
const didRecompilePromise = Promise.all([
|
|
197
|
+
childCompilationResultPromise,
|
|
198
|
+
cachedResult,
|
|
199
|
+
]).then(
|
|
200
|
+
([childCompilationResult, cachedResult]) =>
|
|
201
|
+
cachedResult !== childCompilationResult,
|
|
202
|
+
);
|
|
203
|
+
const handleCompilationDonePromise = Promise.all([
|
|
204
|
+
childCompilationResultPromise,
|
|
205
|
+
didRecompilePromise,
|
|
206
|
+
]).then(([childCompilationResult, didRecompile]) => {
|
|
207
|
+
if (didRecompile) {
|
|
208
|
+
mainCompilationHashOfLastChildRecompile =
|
|
209
|
+
mainCompilation.hash;
|
|
210
|
+
}
|
|
211
|
+
this.compilationState = {
|
|
212
|
+
isCompiling: false,
|
|
213
|
+
isVerifyingCache: false,
|
|
214
|
+
entries: this.compilationState.entries,
|
|
215
|
+
compiledEntries: this.compilationState.entries,
|
|
216
|
+
compilationResult: childCompilationResult,
|
|
217
|
+
mainCompilationHash:
|
|
218
|
+
mainCompilationHashOfLastChildRecompile,
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
handleCompilationDonePromise.then(
|
|
222
|
+
() => callback(null),
|
|
223
|
+
callback,
|
|
224
|
+
);
|
|
225
|
+
},
|
|
226
|
+
);
|
|
227
|
+
callback(null);
|
|
228
|
+
},
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
addEntry(entry) {
|
|
232
|
+
if (
|
|
233
|
+
this.compilationState.isCompiling ||
|
|
234
|
+
this.compilationState.isVerifyingCache
|
|
235
|
+
) {
|
|
236
|
+
throw new Error(
|
|
237
|
+
"The child compiler has already started to compile. " +
|
|
238
|
+
"Please add entries before the main compiler 'make' phase has started or " +
|
|
239
|
+
"after the compilation is done.",
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
if (this.compilationState.entries.indexOf(entry) === -1) {
|
|
243
|
+
this.compilationState.entries = [
|
|
244
|
+
...this.compilationState.entries,
|
|
245
|
+
entry,
|
|
246
|
+
];
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
getLatestResult() {
|
|
250
|
+
if (
|
|
251
|
+
this.compilationState.isCompiling ||
|
|
252
|
+
this.compilationState.isVerifyingCache
|
|
253
|
+
) {
|
|
254
|
+
throw new Error(
|
|
255
|
+
"The child compiler is not done compiling. " +
|
|
256
|
+
"Please access the result after the compiler 'make' phase has started or " +
|
|
257
|
+
"after the compilation is done.",
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
mainCompilationHash: this.compilationState.mainCompilationHash,
|
|
262
|
+
compilationResult: this.compilationState.compilationResult,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
isCacheValid(snapshot, mainCompilation) {
|
|
266
|
+
if (!this.compilationState.isVerifyingCache) {
|
|
267
|
+
return Promise.reject(
|
|
268
|
+
new Error(
|
|
269
|
+
"Cache validation can only be done right before the compilation starts",
|
|
270
|
+
),
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
if (this.compilationState.entries.length === 0) {
|
|
274
|
+
return Promise.resolve(true);
|
|
275
|
+
}
|
|
276
|
+
if (
|
|
277
|
+
this.compilationState.entries !==
|
|
278
|
+
this.compilationState.previousEntries
|
|
279
|
+
) {
|
|
280
|
+
return Promise.resolve(false);
|
|
281
|
+
}
|
|
282
|
+
if (!snapshot) {
|
|
283
|
+
return Promise.resolve(false);
|
|
284
|
+
}
|
|
285
|
+
return PersistentChildCompilerSingletonPlugin.isSnapshotValid(
|
|
286
|
+
snapshot,
|
|
287
|
+
mainCompilation,
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
compileEntries(mainCompilation, entries) {
|
|
291
|
+
const compiler = new HtmlWebpackChildCompiler(entries);
|
|
292
|
+
return compiler.compileTemplates(mainCompilation).then(
|
|
293
|
+
(result) => ({
|
|
294
|
+
compiledEntries: result,
|
|
295
|
+
dependencies: compiler.fileDependencies,
|
|
296
|
+
mainCompilationHash: mainCompilation.hash,
|
|
297
|
+
}),
|
|
298
|
+
(error) => ({
|
|
299
|
+
error,
|
|
300
|
+
dependencies: compiler.fileDependencies,
|
|
301
|
+
mainCompilationHash: mainCompilation.hash,
|
|
302
|
+
}),
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
watchFiles(mainCompilation, files) {
|
|
306
|
+
PersistentChildCompilerSingletonPlugin.watchFiles(
|
|
307
|
+
mainCompilation,
|
|
308
|
+
files,
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
module.exports = { CachedChildCompilation };
|
|
313
|
+
},
|
|
314
|
+
479: (module) => {
|
|
315
|
+
"use strict";
|
|
316
|
+
class HtmlWebpackChildCompiler {
|
|
317
|
+
constructor(templates) {
|
|
318
|
+
this.templates = templates;
|
|
319
|
+
this.compilationPromise;
|
|
320
|
+
this.compilationStartedTimestamp;
|
|
321
|
+
this.compilationEndedTimestamp;
|
|
322
|
+
this.fileDependencies = {
|
|
323
|
+
fileDependencies: [],
|
|
324
|
+
contextDependencies: [],
|
|
325
|
+
missingDependencies: [],
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
isCompiling() {
|
|
329
|
+
return (
|
|
330
|
+
!this.didCompile() && this.compilationStartedTimestamp !== undefined
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
didCompile() {
|
|
334
|
+
return this.compilationEndedTimestamp !== undefined;
|
|
335
|
+
}
|
|
336
|
+
compileTemplates(mainCompilation) {
|
|
337
|
+
const webpack = mainCompilation.compiler.webpack;
|
|
338
|
+
const Compilation = webpack.Compilation;
|
|
339
|
+
const NodeTemplatePlugin = webpack.node.NodeTemplatePlugin;
|
|
340
|
+
const NodeTargetPlugin = webpack.node.NodeTargetPlugin;
|
|
341
|
+
const LoaderTargetPlugin = webpack.LoaderTargetPlugin;
|
|
342
|
+
const EntryPlugin = webpack.EntryPlugin;
|
|
343
|
+
if (this.compilationPromise) {
|
|
344
|
+
return this.compilationPromise;
|
|
345
|
+
}
|
|
346
|
+
const outputOptions = {
|
|
347
|
+
filename: "__child-[name]",
|
|
348
|
+
publicPath: "",
|
|
349
|
+
library: { type: "var", name: "HTML_WEBPACK_PLUGIN_RESULT" },
|
|
350
|
+
scriptType: "text/javascript",
|
|
351
|
+
iife: true,
|
|
352
|
+
};
|
|
353
|
+
const compilerName = "HtmlRspackCompiler";
|
|
354
|
+
const childCompiler = mainCompilation.createChildCompiler(
|
|
355
|
+
compilerName,
|
|
356
|
+
outputOptions,
|
|
357
|
+
[
|
|
358
|
+
new NodeTargetPlugin(),
|
|
359
|
+
new NodeTemplatePlugin(),
|
|
360
|
+
new LoaderTargetPlugin("node"),
|
|
361
|
+
new webpack.library.EnableLibraryPlugin("var"),
|
|
362
|
+
],
|
|
363
|
+
);
|
|
364
|
+
childCompiler.context = mainCompilation.compiler.context;
|
|
365
|
+
const temporaryTemplateNames = this.templates.map(
|
|
366
|
+
(template, index) =>
|
|
367
|
+
`__child-HtmlRspackPlugin_${index}-${template}`,
|
|
368
|
+
);
|
|
369
|
+
this.templates.forEach((template, index) => {
|
|
370
|
+
new EntryPlugin(
|
|
371
|
+
childCompiler.context,
|
|
372
|
+
"data:text/javascript,__webpack_public_path__ = __webpack_base_uri__ = htmlWebpackPluginPublicPath;",
|
|
373
|
+
`HtmlRspackPlugin_${index}-${template}`,
|
|
374
|
+
).apply(childCompiler);
|
|
375
|
+
new EntryPlugin(
|
|
376
|
+
childCompiler.context,
|
|
377
|
+
template,
|
|
378
|
+
`HtmlRspackPlugin_${index}-${template}`,
|
|
379
|
+
).apply(childCompiler);
|
|
380
|
+
});
|
|
381
|
+
childCompiler.options.module = { ...childCompiler.options.module };
|
|
382
|
+
childCompiler.options.module.parser = {
|
|
383
|
+
...childCompiler.options.module.parser,
|
|
384
|
+
};
|
|
385
|
+
const javascriptModules = [
|
|
386
|
+
"javascript",
|
|
387
|
+
"javascript/auto",
|
|
388
|
+
"javascript/dynamic",
|
|
389
|
+
"javascript/esm",
|
|
390
|
+
];
|
|
391
|
+
for (const moduleType of javascriptModules) {
|
|
392
|
+
childCompiler.options.module.parser[moduleType] = {
|
|
393
|
+
...childCompiler.options.module.parser[moduleType],
|
|
394
|
+
url: "relative",
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
this.compilationStartedTimestamp = Date.now();
|
|
398
|
+
this.compilationPromise = new Promise((resolve, reject) => {
|
|
399
|
+
const extractedAssets = [];
|
|
400
|
+
childCompiler.hooks.thisCompilation.tap(
|
|
401
|
+
"HtmlRspackPlugin",
|
|
402
|
+
(compilation) => {
|
|
403
|
+
compilation.hooks.processAssets.tap(
|
|
404
|
+
{
|
|
405
|
+
name: "HtmlRspackPlugin",
|
|
406
|
+
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
|
|
407
|
+
},
|
|
408
|
+
(assets) => {
|
|
409
|
+
temporaryTemplateNames.forEach((temporaryTemplateName) => {
|
|
410
|
+
if (assets[temporaryTemplateName]) {
|
|
411
|
+
extractedAssets.push(assets[temporaryTemplateName]);
|
|
412
|
+
compilation.deleteAsset(temporaryTemplateName);
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
},
|
|
416
|
+
);
|
|
417
|
+
},
|
|
418
|
+
);
|
|
419
|
+
childCompiler.runAsChild((err, entries, childCompilation) => {
|
|
420
|
+
const compiledTemplates = entries
|
|
421
|
+
? extractedAssets.map((asset) => asset.source())
|
|
422
|
+
: [];
|
|
423
|
+
if (entries && childCompilation) {
|
|
424
|
+
this.fileDependencies = {
|
|
425
|
+
fileDependencies: Array.from(
|
|
426
|
+
childCompilation.fileDependencies,
|
|
427
|
+
),
|
|
428
|
+
contextDependencies: Array.from(
|
|
429
|
+
childCompilation.contextDependencies,
|
|
430
|
+
),
|
|
431
|
+
missingDependencies: Array.from(
|
|
432
|
+
childCompilation.missingDependencies,
|
|
433
|
+
),
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
if (
|
|
437
|
+
childCompilation &&
|
|
438
|
+
childCompilation.errors &&
|
|
439
|
+
childCompilation.errors.length
|
|
440
|
+
) {
|
|
441
|
+
const errorDetails = childCompilation.errors
|
|
442
|
+
.map((error) => {
|
|
443
|
+
let message = error.message;
|
|
444
|
+
if (error.stack) {
|
|
445
|
+
message += "\n" + error.stack;
|
|
446
|
+
}
|
|
447
|
+
return message;
|
|
448
|
+
})
|
|
449
|
+
.join("\n");
|
|
450
|
+
reject(new Error("Child compilation failed:\n" + errorDetails));
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (err) {
|
|
454
|
+
reject(err);
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (!childCompilation || !entries) {
|
|
458
|
+
reject(new Error("Empty child compilation"));
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
const result = {};
|
|
462
|
+
const assets = {};
|
|
463
|
+
for (const asset of childCompilation.getAssets()) {
|
|
464
|
+
assets[asset.name] = { source: asset.source, info: asset.info };
|
|
465
|
+
}
|
|
466
|
+
compiledTemplates.forEach((templateSource, entryIndex) => {
|
|
467
|
+
result[this.templates[entryIndex]] = {
|
|
468
|
+
content: templateSource,
|
|
469
|
+
hash: childCompilation.hash || "XXXX",
|
|
470
|
+
entry: entries[entryIndex],
|
|
471
|
+
assets,
|
|
472
|
+
};
|
|
473
|
+
});
|
|
474
|
+
this.compilationEndedTimestamp = Date.now();
|
|
475
|
+
resolve(result);
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
return this.compilationPromise;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
module.exports = { HtmlWebpackChildCompiler };
|
|
482
|
+
},
|
|
483
|
+
645: (module) => {
|
|
484
|
+
"use strict";
|
|
485
|
+
module.exports = {};
|
|
486
|
+
module.exports.none = (chunks) => chunks;
|
|
487
|
+
module.exports.manual = (
|
|
488
|
+
entryPointNames,
|
|
489
|
+
compilation,
|
|
490
|
+
htmlWebpackPluginOptions,
|
|
491
|
+
) => {
|
|
492
|
+
const chunks = htmlWebpackPluginOptions.chunks;
|
|
493
|
+
if (!Array.isArray(chunks)) {
|
|
494
|
+
return entryPointNames;
|
|
495
|
+
}
|
|
496
|
+
return chunks.filter((entryPointName) =>
|
|
497
|
+
compilation.entrypoints.has(entryPointName),
|
|
498
|
+
);
|
|
499
|
+
};
|
|
500
|
+
module.exports.auto = module.exports.none;
|
|
501
|
+
},
|
|
502
|
+
276: (module) => {
|
|
503
|
+
"use strict";
|
|
504
|
+
module.exports = function (err) {
|
|
505
|
+
return {
|
|
506
|
+
toHtml: function () {
|
|
507
|
+
return (
|
|
508
|
+
"[html-rspack-plugin]:\n<pre>\n" + this.toString() + "</pre>"
|
|
509
|
+
);
|
|
510
|
+
},
|
|
511
|
+
toJsonHtml: function () {
|
|
512
|
+
return JSON.stringify(this.toHtml());
|
|
513
|
+
},
|
|
514
|
+
toString: function () {
|
|
515
|
+
if (err.message) {
|
|
516
|
+
return `[html-rspack-plugin]: ` + err.message;
|
|
517
|
+
}
|
|
518
|
+
return err;
|
|
519
|
+
},
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
},
|
|
523
|
+
171: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
524
|
+
"use strict";
|
|
525
|
+
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
|
|
526
|
+
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
527
|
+
function getHtmlRspackPluginHooks(compilation) {
|
|
528
|
+
let hooks = htmlWebpackPluginHooksMap.get(compilation);
|
|
529
|
+
if (hooks === undefined) {
|
|
530
|
+
hooks = createHtmlRspackPluginHooks();
|
|
531
|
+
htmlWebpackPluginHooksMap.set(compilation, hooks);
|
|
532
|
+
}
|
|
533
|
+
return hooks;
|
|
534
|
+
}
|
|
535
|
+
function createHtmlRspackPluginHooks() {
|
|
536
|
+
return {
|
|
537
|
+
beforeAssetTagGeneration: new AsyncSeriesWaterfallHook([
|
|
538
|
+
"pluginArgs",
|
|
539
|
+
]),
|
|
540
|
+
alterAssetTags: new AsyncSeriesWaterfallHook(["pluginArgs"]),
|
|
541
|
+
alterAssetTagGroups: new AsyncSeriesWaterfallHook(["pluginArgs"]),
|
|
542
|
+
afterTemplateExecution: new AsyncSeriesWaterfallHook(["pluginArgs"]),
|
|
543
|
+
beforeEmit: new AsyncSeriesWaterfallHook(["pluginArgs"]),
|
|
544
|
+
afterEmit: new AsyncSeriesWaterfallHook(["pluginArgs"]),
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
module.exports = { getHtmlRspackPluginHooks };
|
|
548
|
+
},
|
|
549
|
+
10: (module) => {
|
|
550
|
+
const voidTags = [
|
|
551
|
+
"area",
|
|
552
|
+
"base",
|
|
553
|
+
"br",
|
|
554
|
+
"col",
|
|
555
|
+
"embed",
|
|
556
|
+
"hr",
|
|
557
|
+
"img",
|
|
558
|
+
"input",
|
|
559
|
+
"keygen",
|
|
560
|
+
"link",
|
|
561
|
+
"meta",
|
|
562
|
+
"param",
|
|
563
|
+
"source",
|
|
564
|
+
"track",
|
|
565
|
+
"wbr",
|
|
566
|
+
];
|
|
567
|
+
function htmlTagObjectToString(tagDefinition, xhtml) {
|
|
568
|
+
const attributes = Object.keys(tagDefinition.attributes || {})
|
|
569
|
+
.filter(function (attributeName) {
|
|
570
|
+
return (
|
|
571
|
+
tagDefinition.attributes[attributeName] === "" ||
|
|
572
|
+
tagDefinition.attributes[attributeName]
|
|
573
|
+
);
|
|
574
|
+
})
|
|
575
|
+
.map(function (attributeName) {
|
|
576
|
+
if (tagDefinition.attributes[attributeName] === true) {
|
|
577
|
+
return xhtml
|
|
578
|
+
? attributeName + '="' + attributeName + '"'
|
|
579
|
+
: attributeName;
|
|
580
|
+
}
|
|
581
|
+
return (
|
|
582
|
+
attributeName +
|
|
583
|
+
'="' +
|
|
584
|
+
tagDefinition.attributes[attributeName] +
|
|
585
|
+
'"'
|
|
586
|
+
);
|
|
587
|
+
});
|
|
588
|
+
return (
|
|
589
|
+
"<" +
|
|
590
|
+
[tagDefinition.tagName].concat(attributes).join(" ") +
|
|
591
|
+
(tagDefinition.voidTag && xhtml ? "/" : "") +
|
|
592
|
+
">" +
|
|
593
|
+
(tagDefinition.innerHTML || "") +
|
|
594
|
+
(tagDefinition.voidTag ? "" : "</" + tagDefinition.tagName + ">")
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
function createHtmlTagObject(tagName, attributes, innerHTML, meta) {
|
|
598
|
+
return {
|
|
599
|
+
tagName,
|
|
600
|
+
voidTag: voidTags.indexOf(tagName) !== -1,
|
|
601
|
+
attributes: attributes || {},
|
|
602
|
+
meta: meta || {},
|
|
603
|
+
innerHTML,
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
class HtmlTagArray extends Array {
|
|
607
|
+
toString() {
|
|
608
|
+
return this.join("");
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
module.exports = {
|
|
612
|
+
HtmlTagArray,
|
|
613
|
+
createHtmlTagObject,
|
|
614
|
+
htmlTagObjectToString,
|
|
615
|
+
};
|
|
616
|
+
},
|
|
617
|
+
387: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
618
|
+
"use strict";
|
|
619
|
+
const promisify = __nccwpck_require__(23).promisify;
|
|
620
|
+
const vm = __nccwpck_require__(154);
|
|
621
|
+
const fs = __nccwpck_require__(896);
|
|
622
|
+
const path = __nccwpck_require__(928);
|
|
623
|
+
const { CachedChildCompilation } = __nccwpck_require__(694);
|
|
624
|
+
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
625
|
+
__nccwpck_require__(10);
|
|
626
|
+
const prettyError = __nccwpck_require__(276);
|
|
627
|
+
const chunkSorter = __nccwpck_require__(645);
|
|
628
|
+
const getHtmlRspackPluginHooks =
|
|
629
|
+
__nccwpck_require__(171).getHtmlRspackPluginHooks;
|
|
630
|
+
const WITH_PLACEHOLDER = "function __with_placeholder__";
|
|
631
|
+
class HtmlRspackPlugin {
|
|
632
|
+
constructor(userOptions = {}) {
|
|
633
|
+
this.version = HtmlRspackPlugin.version;
|
|
634
|
+
const defaultOptions = {
|
|
635
|
+
template: "auto",
|
|
636
|
+
templateContent: false,
|
|
637
|
+
templateParameters: templateParametersGenerator,
|
|
638
|
+
filename:
|
|
639
|
+
userOptions.filename === undefined
|
|
640
|
+
? "index.html"
|
|
641
|
+
: userOptions.filename,
|
|
642
|
+
publicPath:
|
|
643
|
+
userOptions.publicPath === undefined
|
|
644
|
+
? "auto"
|
|
645
|
+
: userOptions.publicPath,
|
|
646
|
+
hash: false,
|
|
647
|
+
inject: userOptions.scriptLoading === "blocking" ? "body" : "head",
|
|
648
|
+
scriptLoading: "defer",
|
|
649
|
+
compile: true,
|
|
650
|
+
favicon: false,
|
|
651
|
+
cache: true,
|
|
652
|
+
showErrors: true,
|
|
653
|
+
chunks: "all",
|
|
654
|
+
excludeChunks: [],
|
|
655
|
+
chunksSortMode: "auto",
|
|
656
|
+
meta: {},
|
|
657
|
+
base: false,
|
|
658
|
+
title: "Rspack App",
|
|
659
|
+
xhtml: false,
|
|
660
|
+
};
|
|
661
|
+
this.options = Object.assign(defaultOptions, userOptions);
|
|
662
|
+
}
|
|
663
|
+
apply(compiler) {
|
|
664
|
+
this.logger = compiler.getInfrastructureLogger("HtmlRspackPlugin");
|
|
665
|
+
compiler.hooks.initialize.tap("HtmlRspackPlugin", () => {
|
|
666
|
+
const options = this.options;
|
|
667
|
+
options.template = this.getTemplatePath(
|
|
668
|
+
this.options.template,
|
|
669
|
+
compiler.context,
|
|
670
|
+
);
|
|
671
|
+
if (
|
|
672
|
+
options.scriptLoading !== "defer" &&
|
|
673
|
+
options.scriptLoading !== "blocking" &&
|
|
674
|
+
options.scriptLoading !== "module" &&
|
|
675
|
+
options.scriptLoading !== "systemjs-module"
|
|
676
|
+
) {
|
|
677
|
+
this.logger.error(
|
|
678
|
+
'The "scriptLoading" option need to be set to "defer", "blocking" or "module" or "systemjs-module"',
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
if (
|
|
682
|
+
options.inject !== true &&
|
|
683
|
+
options.inject !== false &&
|
|
684
|
+
options.inject !== "head" &&
|
|
685
|
+
options.inject !== "body"
|
|
686
|
+
) {
|
|
687
|
+
this.logger.error(
|
|
688
|
+
'The `inject` option needs to be set to true, false, "head" or "body',
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
if (
|
|
692
|
+
this.options.templateParameters !== false &&
|
|
693
|
+
typeof this.options.templateParameters !== "function" &&
|
|
694
|
+
typeof this.options.templateParameters !== "object"
|
|
695
|
+
) {
|
|
696
|
+
this.logger.error(
|
|
697
|
+
"The `templateParameters` has to be either a function or an object or false",
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
const userOptionFilename = this.options.filename;
|
|
701
|
+
const filenameFunction =
|
|
702
|
+
typeof userOptionFilename === "function"
|
|
703
|
+
? userOptionFilename
|
|
704
|
+
: (entryName) =>
|
|
705
|
+
userOptionFilename.replace(/\[name\]/g, entryName);
|
|
706
|
+
const entryNames = Object.keys(compiler.options.entry);
|
|
707
|
+
const outputFileNames = new Set(
|
|
708
|
+
(entryNames.length ? entryNames : ["main"]).map(filenameFunction),
|
|
709
|
+
);
|
|
710
|
+
outputFileNames.forEach((outputFileName) => {
|
|
711
|
+
const assetJson = { value: undefined };
|
|
712
|
+
const previousEmittedAssets = [];
|
|
713
|
+
let childCompilerPlugin;
|
|
714
|
+
if (!this.options.templateContent) {
|
|
715
|
+
childCompilerPlugin = new CachedChildCompilation(compiler);
|
|
716
|
+
childCompilerPlugin.addEntry(this.options.template);
|
|
717
|
+
}
|
|
718
|
+
let filename = outputFileName;
|
|
719
|
+
if (path.resolve(filename) === path.normalize(filename)) {
|
|
720
|
+
const outputPath = compiler.options.output.path;
|
|
721
|
+
filename = path.relative(outputPath, filename);
|
|
722
|
+
}
|
|
723
|
+
compiler.hooks.thisCompilation.tap(
|
|
724
|
+
"HtmlRspackPlugin",
|
|
725
|
+
(compilation) => {
|
|
726
|
+
compilation.hooks.processAssets.tapAsync(
|
|
727
|
+
{
|
|
728
|
+
name: "HtmlRspackPlugin",
|
|
729
|
+
stage:
|
|
730
|
+
compiler.webpack.Compilation
|
|
731
|
+
.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE,
|
|
732
|
+
},
|
|
733
|
+
(_, callback) => {
|
|
734
|
+
this.generateHTML(
|
|
735
|
+
compiler,
|
|
736
|
+
compilation,
|
|
737
|
+
filename,
|
|
738
|
+
childCompilerPlugin,
|
|
739
|
+
previousEmittedAssets,
|
|
740
|
+
assetJson,
|
|
741
|
+
callback,
|
|
742
|
+
);
|
|
743
|
+
},
|
|
744
|
+
);
|
|
745
|
+
},
|
|
746
|
+
);
|
|
747
|
+
});
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
getTemplatePath(template, context) {
|
|
751
|
+
if (template === "auto") {
|
|
752
|
+
template = path.resolve(context, "src/index.ejs");
|
|
753
|
+
if (!fs.existsSync(template)) {
|
|
754
|
+
template = __nccwpck_require__.ab + "default_index.ejs";
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
if (template.indexOf("!") === -1) {
|
|
758
|
+
const loader = __nccwpck_require__.ab + "loader.js";
|
|
759
|
+
template = loader + "!" + path.resolve(context, template);
|
|
760
|
+
}
|
|
761
|
+
return template.replace(
|
|
762
|
+
/([!])([^/\\][^!?]+|[^/\\!?])($|\?[^!?\n]+$)/,
|
|
763
|
+
(match, prefix, filepath, postfix) =>
|
|
764
|
+
prefix + path.resolve(filepath) + postfix,
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
filterEntryChunks(chunks, includedChunks, excludedChunks) {
|
|
768
|
+
return chunks.filter((chunkName) => {
|
|
769
|
+
if (
|
|
770
|
+
Array.isArray(includedChunks) &&
|
|
771
|
+
includedChunks.indexOf(chunkName) === -1
|
|
772
|
+
) {
|
|
773
|
+
return false;
|
|
774
|
+
}
|
|
775
|
+
if (
|
|
776
|
+
Array.isArray(excludedChunks) &&
|
|
777
|
+
excludedChunks.indexOf(chunkName) !== -1
|
|
778
|
+
) {
|
|
779
|
+
return false;
|
|
780
|
+
}
|
|
781
|
+
return true;
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
sortEntryChunks(entryNames, sortMode, compilation) {
|
|
785
|
+
if (typeof sortMode === "function") {
|
|
786
|
+
return entryNames.sort(sortMode);
|
|
787
|
+
}
|
|
788
|
+
if (typeof chunkSorter[sortMode] !== "undefined") {
|
|
789
|
+
return chunkSorter[sortMode](entryNames, compilation, this.options);
|
|
790
|
+
}
|
|
791
|
+
throw new Error('"' + sortMode + '" is not a valid chunk sort mode');
|
|
792
|
+
}
|
|
793
|
+
urlencodePath(filePath) {
|
|
794
|
+
const queryStringStart = filePath.indexOf("?");
|
|
795
|
+
const urlPath =
|
|
796
|
+
queryStringStart === -1
|
|
797
|
+
? filePath
|
|
798
|
+
: filePath.substr(0, queryStringStart);
|
|
799
|
+
const queryString = filePath.substr(urlPath.length);
|
|
800
|
+
const encodedUrlPath = urlPath
|
|
801
|
+
.split("/")
|
|
802
|
+
.map(encodeURIComponent)
|
|
803
|
+
.join("/");
|
|
804
|
+
return encodedUrlPath + queryString;
|
|
805
|
+
}
|
|
806
|
+
appendHash(url, hash) {
|
|
807
|
+
if (!url) {
|
|
808
|
+
return url;
|
|
809
|
+
}
|
|
810
|
+
return url + (url.indexOf("?") === -1 ? "?" : "&") + hash;
|
|
811
|
+
}
|
|
812
|
+
getPublicPath(compilation, filename, customPublicPath) {
|
|
813
|
+
const webpackPublicPath = compilation.getAssetPath(
|
|
814
|
+
compilation.outputOptions.publicPath,
|
|
815
|
+
{ hash: compilation.hash },
|
|
816
|
+
);
|
|
817
|
+
const isPublicPathDefined = webpackPublicPath !== "auto";
|
|
818
|
+
let publicPath =
|
|
819
|
+
customPublicPath !== "auto"
|
|
820
|
+
? customPublicPath
|
|
821
|
+
: isPublicPathDefined
|
|
822
|
+
? webpackPublicPath
|
|
823
|
+
: path
|
|
824
|
+
.relative(
|
|
825
|
+
path.resolve(
|
|
826
|
+
compilation.options.output.path,
|
|
827
|
+
path.dirname(filename),
|
|
828
|
+
),
|
|
829
|
+
compilation.options.output.path,
|
|
830
|
+
)
|
|
831
|
+
.split(path.sep)
|
|
832
|
+
.join("/");
|
|
833
|
+
if (publicPath.length && publicPath.substr(-1, 1) !== "/") {
|
|
834
|
+
publicPath += "/";
|
|
835
|
+
}
|
|
836
|
+
return publicPath;
|
|
837
|
+
}
|
|
838
|
+
getAssetsInformationByGroups(
|
|
839
|
+
compilation,
|
|
840
|
+
outputName,
|
|
841
|
+
entryNames,
|
|
842
|
+
entrypoints,
|
|
843
|
+
) {
|
|
844
|
+
const publicPath = this.getPublicPath(
|
|
845
|
+
compilation,
|
|
846
|
+
outputName,
|
|
847
|
+
this.options.publicPath,
|
|
848
|
+
);
|
|
849
|
+
const assets = { publicPath, js: [], css: [], favicon: undefined };
|
|
850
|
+
const entryPointPublicPathMap = {};
|
|
851
|
+
const extensionRegexp = /\.(css|js|mjs)(\?|$)/;
|
|
852
|
+
for (let i = 0; i < entryNames.length; i++) {
|
|
853
|
+
const entryName = entryNames[i];
|
|
854
|
+
const entryPointUnfilteredFiles = entrypoints
|
|
855
|
+
.get(entryName)
|
|
856
|
+
.getFiles();
|
|
857
|
+
const entryPointFiles = entryPointUnfilteredFiles.filter(
|
|
858
|
+
(chunkFile) => {
|
|
859
|
+
const asset = compilation.getAsset(chunkFile);
|
|
860
|
+
if (!asset) {
|
|
861
|
+
return true;
|
|
862
|
+
}
|
|
863
|
+
const assetMetaInformation = asset.info || {};
|
|
864
|
+
return !(
|
|
865
|
+
assetMetaInformation.hotModuleReplacement ||
|
|
866
|
+
assetMetaInformation.development
|
|
867
|
+
);
|
|
868
|
+
},
|
|
869
|
+
);
|
|
870
|
+
const entryPointPublicPaths = entryPointFiles.map((chunkFile) => {
|
|
871
|
+
const entryPointPublicPath =
|
|
872
|
+
publicPath + this.urlencodePath(chunkFile);
|
|
873
|
+
return this.options.hash
|
|
874
|
+
? this.appendHash(entryPointPublicPath, compilation.hash)
|
|
875
|
+
: entryPointPublicPath;
|
|
876
|
+
});
|
|
877
|
+
entryPointPublicPaths.forEach((entryPointPublicPath) => {
|
|
878
|
+
const extMatch = extensionRegexp.exec(entryPointPublicPath);
|
|
879
|
+
if (!extMatch) {
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
if (entryPointPublicPathMap[entryPointPublicPath]) {
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
entryPointPublicPathMap[entryPointPublicPath] = true;
|
|
886
|
+
const ext = extMatch[1] === "mjs" ? "js" : extMatch[1];
|
|
887
|
+
assets[ext].push(entryPointPublicPath);
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
return assets;
|
|
891
|
+
}
|
|
892
|
+
evaluateCompilationResult(source, publicPath, templateFilename) {
|
|
893
|
+
if (!source) {
|
|
894
|
+
return Promise.reject(
|
|
895
|
+
new Error("The child compilation didn't provide a result"),
|
|
896
|
+
);
|
|
897
|
+
}
|
|
898
|
+
if (source.indexOf(WITH_PLACEHOLDER) >= 0) {
|
|
899
|
+
source = source.replace(WITH_PLACEHOLDER, "with");
|
|
900
|
+
}
|
|
901
|
+
if (source.indexOf("HTML_WEBPACK_PLUGIN_RESULT") >= 0) {
|
|
902
|
+
source += ";\nHTML_WEBPACK_PLUGIN_RESULT";
|
|
903
|
+
}
|
|
904
|
+
const templateWithoutLoaders = templateFilename
|
|
905
|
+
.replace(/^.+!/, "")
|
|
906
|
+
.replace(/\?.+$/, "");
|
|
907
|
+
const vmContext = vm.createContext({
|
|
908
|
+
...global,
|
|
909
|
+
HTML_WEBPACK_PLUGIN: true,
|
|
910
|
+
require,
|
|
911
|
+
htmlWebpackPluginPublicPath: publicPath,
|
|
912
|
+
__filename: templateWithoutLoaders,
|
|
913
|
+
__dirname: path.dirname(templateWithoutLoaders),
|
|
914
|
+
AbortController: global.AbortController,
|
|
915
|
+
AbortSignal: global.AbortSignal,
|
|
916
|
+
Blob: global.Blob,
|
|
917
|
+
Buffer: global.Buffer,
|
|
918
|
+
ByteLengthQueuingStrategy: global.ByteLengthQueuingStrategy,
|
|
919
|
+
BroadcastChannel: global.BroadcastChannel,
|
|
920
|
+
CompressionStream: global.CompressionStream,
|
|
921
|
+
CountQueuingStrategy: global.CountQueuingStrategy,
|
|
922
|
+
Crypto: global.Crypto,
|
|
923
|
+
CryptoKey: global.CryptoKey,
|
|
924
|
+
CustomEvent: global.CustomEvent,
|
|
925
|
+
DecompressionStream: global.DecompressionStream,
|
|
926
|
+
Event: global.Event,
|
|
927
|
+
EventTarget: global.EventTarget,
|
|
928
|
+
File: global.File,
|
|
929
|
+
FormData: global.FormData,
|
|
930
|
+
Headers: global.Headers,
|
|
931
|
+
MessageChannel: global.MessageChannel,
|
|
932
|
+
MessageEvent: global.MessageEvent,
|
|
933
|
+
MessagePort: global.MessagePort,
|
|
934
|
+
PerformanceEntry: global.PerformanceEntry,
|
|
935
|
+
PerformanceMark: global.PerformanceMark,
|
|
936
|
+
PerformanceMeasure: global.PerformanceMeasure,
|
|
937
|
+
PerformanceObserver: global.PerformanceObserver,
|
|
938
|
+
PerformanceObserverEntryList: global.PerformanceObserverEntryList,
|
|
939
|
+
PerformanceResourceTiming: global.PerformanceResourceTiming,
|
|
940
|
+
ReadableByteStreamController: global.ReadableByteStreamController,
|
|
941
|
+
ReadableStream: global.ReadableStream,
|
|
942
|
+
ReadableStreamBYOBReader: global.ReadableStreamBYOBReader,
|
|
943
|
+
ReadableStreamBYOBRequest: global.ReadableStreamBYOBRequest,
|
|
944
|
+
ReadableStreamDefaultController:
|
|
945
|
+
global.ReadableStreamDefaultController,
|
|
946
|
+
ReadableStreamDefaultReader: global.ReadableStreamDefaultReader,
|
|
947
|
+
Response: global.Response,
|
|
948
|
+
Request: global.Request,
|
|
949
|
+
SubtleCrypto: global.SubtleCrypto,
|
|
950
|
+
DOMException: global.DOMException,
|
|
951
|
+
TextDecoder: global.TextDecoder,
|
|
952
|
+
TextDecoderStream: global.TextDecoderStream,
|
|
953
|
+
TextEncoder: global.TextEncoder,
|
|
954
|
+
TextEncoderStream: global.TextEncoderStream,
|
|
955
|
+
TransformStream: global.TransformStream,
|
|
956
|
+
TransformStreamDefaultController:
|
|
957
|
+
global.TransformStreamDefaultController,
|
|
958
|
+
URL: global.URL,
|
|
959
|
+
URLSearchParams: global.URLSearchParams,
|
|
960
|
+
WebAssembly: global.WebAssembly,
|
|
961
|
+
WritableStream: global.WritableStream,
|
|
962
|
+
WritableStreamDefaultController:
|
|
963
|
+
global.WritableStreamDefaultController,
|
|
964
|
+
WritableStreamDefaultWriter: global.WritableStreamDefaultWriter,
|
|
965
|
+
});
|
|
966
|
+
const vmScript = new vm.Script(source, {
|
|
967
|
+
filename: templateWithoutLoaders,
|
|
968
|
+
});
|
|
969
|
+
let newSource;
|
|
970
|
+
try {
|
|
971
|
+
newSource = vmScript.runInContext(vmContext);
|
|
972
|
+
} catch (e) {
|
|
973
|
+
return Promise.reject(e);
|
|
974
|
+
}
|
|
975
|
+
if (
|
|
976
|
+
typeof newSource === "object" &&
|
|
977
|
+
newSource.__esModule &&
|
|
978
|
+
newSource.default
|
|
979
|
+
) {
|
|
980
|
+
newSource = newSource.default;
|
|
981
|
+
}
|
|
982
|
+
return typeof newSource === "string" ||
|
|
983
|
+
typeof newSource === "function"
|
|
984
|
+
? Promise.resolve(newSource)
|
|
985
|
+
: Promise.reject(
|
|
986
|
+
new Error(
|
|
987
|
+
'The loader "' +
|
|
988
|
+
templateWithoutLoaders +
|
|
989
|
+
"\" didn't return html.",
|
|
990
|
+
),
|
|
991
|
+
);
|
|
992
|
+
}
|
|
993
|
+
prepareAssetTagGroupForRendering(assetTagGroup) {
|
|
994
|
+
const xhtml = this.options.xhtml;
|
|
995
|
+
return HtmlTagArray.from(
|
|
996
|
+
assetTagGroup.map((assetTag) => {
|
|
997
|
+
const copiedAssetTag = Object.assign({}, assetTag);
|
|
998
|
+
copiedAssetTag.toString = function () {
|
|
999
|
+
return htmlTagObjectToString(this, xhtml);
|
|
1000
|
+
};
|
|
1001
|
+
return copiedAssetTag;
|
|
1002
|
+
}),
|
|
1003
|
+
);
|
|
1004
|
+
}
|
|
1005
|
+
getTemplateParameters(
|
|
1006
|
+
compilation,
|
|
1007
|
+
assetsInformationByGroups,
|
|
1008
|
+
assetTags,
|
|
1009
|
+
) {
|
|
1010
|
+
const templateParameters = this.options.templateParameters;
|
|
1011
|
+
if (templateParameters === false) {
|
|
1012
|
+
return Promise.resolve({});
|
|
1013
|
+
}
|
|
1014
|
+
if (
|
|
1015
|
+
typeof templateParameters !== "function" &&
|
|
1016
|
+
typeof templateParameters !== "object"
|
|
1017
|
+
) {
|
|
1018
|
+
throw new Error(
|
|
1019
|
+
"templateParameters has to be either a function or an object",
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
const templateParameterFunction =
|
|
1023
|
+
typeof templateParameters === "function"
|
|
1024
|
+
? templateParameters
|
|
1025
|
+
: (compilation, assetsInformationByGroups, assetTags, options) =>
|
|
1026
|
+
Object.assign(
|
|
1027
|
+
{},
|
|
1028
|
+
templateParametersGenerator(
|
|
1029
|
+
compilation,
|
|
1030
|
+
assetsInformationByGroups,
|
|
1031
|
+
assetTags,
|
|
1032
|
+
options,
|
|
1033
|
+
),
|
|
1034
|
+
templateParameters,
|
|
1035
|
+
);
|
|
1036
|
+
const preparedAssetTags = {
|
|
1037
|
+
headTags: this.prepareAssetTagGroupForRendering(assetTags.headTags),
|
|
1038
|
+
bodyTags: this.prepareAssetTagGroupForRendering(assetTags.bodyTags),
|
|
1039
|
+
};
|
|
1040
|
+
return Promise.resolve().then(() =>
|
|
1041
|
+
templateParameterFunction(
|
|
1042
|
+
compilation,
|
|
1043
|
+
assetsInformationByGroups,
|
|
1044
|
+
preparedAssetTags,
|
|
1045
|
+
this.options,
|
|
1046
|
+
),
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
executeTemplate(
|
|
1050
|
+
templateFunction,
|
|
1051
|
+
assetsInformationByGroups,
|
|
1052
|
+
assetTags,
|
|
1053
|
+
compilation,
|
|
1054
|
+
) {
|
|
1055
|
+
const templateParamsPromise = this.getTemplateParameters(
|
|
1056
|
+
compilation,
|
|
1057
|
+
assetsInformationByGroups,
|
|
1058
|
+
assetTags,
|
|
1059
|
+
);
|
|
1060
|
+
return templateParamsPromise.then((templateParams) => {
|
|
1061
|
+
try {
|
|
1062
|
+
return templateFunction(templateParams);
|
|
1063
|
+
} catch (e) {
|
|
1064
|
+
compilation.errors.push(
|
|
1065
|
+
new Error("Template execution failed: " + e),
|
|
1066
|
+
);
|
|
1067
|
+
return Promise.reject(e);
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
postProcessHtml(
|
|
1072
|
+
compiler,
|
|
1073
|
+
originalHtml,
|
|
1074
|
+
assetsInformationByGroups,
|
|
1075
|
+
assetTags,
|
|
1076
|
+
) {
|
|
1077
|
+
let html = originalHtml;
|
|
1078
|
+
if (typeof html !== "string") {
|
|
1079
|
+
return Promise.reject(
|
|
1080
|
+
new Error(
|
|
1081
|
+
"Expected html to be a string but got " + JSON.stringify(html),
|
|
1082
|
+
),
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
if (this.options.inject) {
|
|
1086
|
+
const htmlRegExp = /(<html[^>]*>)/i;
|
|
1087
|
+
const headRegExp = /(<\/head\s*>)/i;
|
|
1088
|
+
const bodyRegExp = /(<\/body\s*>)/i;
|
|
1089
|
+
const doctypeRegExp = /<!doctype html>/i;
|
|
1090
|
+
const metaViewportRegExp = /<meta[^>]+name=["']viewport["'][^>]*>/i;
|
|
1091
|
+
const body = assetTags.bodyTags.map((assetTagObject) =>
|
|
1092
|
+
htmlTagObjectToString(assetTagObject, this.options.xhtml),
|
|
1093
|
+
);
|
|
1094
|
+
const head = assetTags.headTags
|
|
1095
|
+
.filter((item) => {
|
|
1096
|
+
if (
|
|
1097
|
+
item.tagName === "meta" &&
|
|
1098
|
+
item.attributes &&
|
|
1099
|
+
item.attributes.name === "viewport" &&
|
|
1100
|
+
metaViewportRegExp.test(html)
|
|
1101
|
+
) {
|
|
1102
|
+
return false;
|
|
1103
|
+
}
|
|
1104
|
+
return true;
|
|
1105
|
+
})
|
|
1106
|
+
.map((assetTagObject) =>
|
|
1107
|
+
htmlTagObjectToString(assetTagObject, this.options.xhtml),
|
|
1108
|
+
);
|
|
1109
|
+
if (body.length) {
|
|
1110
|
+
if (bodyRegExp.test(html)) {
|
|
1111
|
+
html = html.replace(
|
|
1112
|
+
bodyRegExp,
|
|
1113
|
+
(match) => body.join("") + match,
|
|
1114
|
+
);
|
|
1115
|
+
} else {
|
|
1116
|
+
html += body.join("");
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
if (head.length) {
|
|
1120
|
+
if (!headRegExp.test(html)) {
|
|
1121
|
+
if (!htmlRegExp.test(html)) {
|
|
1122
|
+
if (doctypeRegExp.test(html)) {
|
|
1123
|
+
html = html.replace(
|
|
1124
|
+
doctypeRegExp,
|
|
1125
|
+
(match) => match + "<head></head>",
|
|
1126
|
+
);
|
|
1127
|
+
} else {
|
|
1128
|
+
html = "<head></head>" + html;
|
|
1129
|
+
}
|
|
1130
|
+
} else {
|
|
1131
|
+
html = html.replace(
|
|
1132
|
+
htmlRegExp,
|
|
1133
|
+
(match) => match + "<head></head>",
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
html = html.replace(headRegExp, (match) => head.join("") + match);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
const isProductionLikeMode =
|
|
1141
|
+
compiler.options.mode === "production" || !compiler.options.mode;
|
|
1142
|
+
const needMinify =
|
|
1143
|
+
typeof this.options.minify === "function" && isProductionLikeMode;
|
|
1144
|
+
if (!needMinify) {
|
|
1145
|
+
return Promise.resolve(html);
|
|
1146
|
+
}
|
|
1147
|
+
return Promise.resolve(this.options.minify(html));
|
|
1148
|
+
}
|
|
1149
|
+
getAssetFiles(assets) {
|
|
1150
|
+
const uniq = (arr) => Array.from(new Set(arr));
|
|
1151
|
+
const files = uniq(
|
|
1152
|
+
Object.keys(assets)
|
|
1153
|
+
.filter(
|
|
1154
|
+
(assetType) => assetType !== "chunks" && assets[assetType],
|
|
1155
|
+
)
|
|
1156
|
+
.reduce(
|
|
1157
|
+
(files, assetType) => files.concat(assets[assetType]),
|
|
1158
|
+
[],
|
|
1159
|
+
),
|
|
1160
|
+
);
|
|
1161
|
+
files.sort();
|
|
1162
|
+
return files;
|
|
1163
|
+
}
|
|
1164
|
+
generateFavicon(
|
|
1165
|
+
compiler,
|
|
1166
|
+
favicon,
|
|
1167
|
+
compilation,
|
|
1168
|
+
publicPath,
|
|
1169
|
+
previousEmittedAssets,
|
|
1170
|
+
) {
|
|
1171
|
+
if (!favicon) {
|
|
1172
|
+
return Promise.resolve(undefined);
|
|
1173
|
+
}
|
|
1174
|
+
const filename = path.resolve(compilation.compiler.context, favicon);
|
|
1175
|
+
return promisify(compilation.inputFileSystem.readFile)(filename)
|
|
1176
|
+
.then((buf) => {
|
|
1177
|
+
const source = new compiler.webpack.sources.RawSource(buf, false);
|
|
1178
|
+
const name = path.basename(filename);
|
|
1179
|
+
compilation.fileDependencies.add(filename);
|
|
1180
|
+
compilation.emitAsset(name, source);
|
|
1181
|
+
previousEmittedAssets.push({ name, source });
|
|
1182
|
+
const faviconPath = publicPath + name;
|
|
1183
|
+
if (this.options.hash) {
|
|
1184
|
+
return this.appendHash(faviconPath, compilation.hash);
|
|
1185
|
+
}
|
|
1186
|
+
return faviconPath;
|
|
1187
|
+
})
|
|
1188
|
+
.catch(() =>
|
|
1189
|
+
Promise.reject(
|
|
1190
|
+
new Error("HtmlRspackPlugin: could not load file " + filename),
|
|
1191
|
+
),
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1194
|
+
generatedScriptTags(jsAssets) {
|
|
1195
|
+
return jsAssets.map((src) => {
|
|
1196
|
+
const attributes = {};
|
|
1197
|
+
if (this.options.scriptLoading === "defer") {
|
|
1198
|
+
attributes.defer = true;
|
|
1199
|
+
} else if (this.options.scriptLoading === "module") {
|
|
1200
|
+
attributes.type = "module";
|
|
1201
|
+
} else if (this.options.scriptLoading === "systemjs-module") {
|
|
1202
|
+
attributes.type = "systemjs-module";
|
|
1203
|
+
}
|
|
1204
|
+
attributes.src = src;
|
|
1205
|
+
return {
|
|
1206
|
+
tagName: "script",
|
|
1207
|
+
voidTag: false,
|
|
1208
|
+
meta: { plugin: "html-webpack-plugin" },
|
|
1209
|
+
attributes,
|
|
1210
|
+
};
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
generateStyleTags(cssAssets) {
|
|
1214
|
+
return cssAssets.map((styleAsset) => ({
|
|
1215
|
+
tagName: "link",
|
|
1216
|
+
voidTag: true,
|
|
1217
|
+
meta: { plugin: "html-webpack-plugin" },
|
|
1218
|
+
attributes: { href: styleAsset, rel: "stylesheet" },
|
|
1219
|
+
}));
|
|
1220
|
+
}
|
|
1221
|
+
generateBaseTag(base) {
|
|
1222
|
+
return [
|
|
1223
|
+
{
|
|
1224
|
+
tagName: "base",
|
|
1225
|
+
voidTag: true,
|
|
1226
|
+
meta: { plugin: "html-webpack-plugin" },
|
|
1227
|
+
attributes: typeof base === "string" ? { href: base } : base,
|
|
1228
|
+
},
|
|
1229
|
+
];
|
|
1230
|
+
}
|
|
1231
|
+
generatedMetaTags(metaOptions) {
|
|
1232
|
+
if (metaOptions === false) {
|
|
1233
|
+
return [];
|
|
1234
|
+
}
|
|
1235
|
+
const metaTagAttributeObjects = Object.keys(metaOptions)
|
|
1236
|
+
.map((metaName) => {
|
|
1237
|
+
const metaTagContent = metaOptions[metaName];
|
|
1238
|
+
return typeof metaTagContent === "string"
|
|
1239
|
+
? { name: metaName, content: metaTagContent }
|
|
1240
|
+
: metaTagContent;
|
|
1241
|
+
})
|
|
1242
|
+
.filter((attribute) => attribute !== false);
|
|
1243
|
+
return metaTagAttributeObjects.map((metaTagAttributes) => {
|
|
1244
|
+
if (metaTagAttributes === false) {
|
|
1245
|
+
throw new Error("Invalid meta tag");
|
|
1246
|
+
}
|
|
1247
|
+
return {
|
|
1248
|
+
tagName: "meta",
|
|
1249
|
+
voidTag: true,
|
|
1250
|
+
meta: { plugin: "html-webpack-plugin" },
|
|
1251
|
+
attributes: metaTagAttributes,
|
|
1252
|
+
};
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
generateFaviconTag(favicon) {
|
|
1256
|
+
return [
|
|
1257
|
+
{
|
|
1258
|
+
tagName: "link",
|
|
1259
|
+
voidTag: true,
|
|
1260
|
+
meta: { plugin: "html-webpack-plugin" },
|
|
1261
|
+
attributes: { rel: "icon", href: favicon },
|
|
1262
|
+
},
|
|
1263
|
+
];
|
|
1264
|
+
}
|
|
1265
|
+
groupAssetsByElements(assetTags, scriptTarget) {
|
|
1266
|
+
const result = {
|
|
1267
|
+
headTags: [...assetTags.meta, ...assetTags.styles],
|
|
1268
|
+
bodyTags: [],
|
|
1269
|
+
};
|
|
1270
|
+
if (scriptTarget === "body") {
|
|
1271
|
+
result.bodyTags.push(...assetTags.scripts);
|
|
1272
|
+
} else {
|
|
1273
|
+
const insertPosition =
|
|
1274
|
+
this.options.scriptLoading === "blocking"
|
|
1275
|
+
? result.headTags.length
|
|
1276
|
+
: assetTags.meta.length;
|
|
1277
|
+
result.headTags.splice(insertPosition, 0, ...assetTags.scripts);
|
|
1278
|
+
}
|
|
1279
|
+
return result;
|
|
1280
|
+
}
|
|
1281
|
+
replacePlaceholdersInFilename(
|
|
1282
|
+
compiler,
|
|
1283
|
+
filename,
|
|
1284
|
+
fileContent,
|
|
1285
|
+
compilation,
|
|
1286
|
+
) {
|
|
1287
|
+
if (/\[(?:[\w:]+)\]/.test(filename) === false) {
|
|
1288
|
+
return { path: filename, info: {} };
|
|
1289
|
+
}
|
|
1290
|
+
const hash = compiler.webpack.util.createHash(
|
|
1291
|
+
compilation.outputOptions.hashFunction,
|
|
1292
|
+
);
|
|
1293
|
+
hash.update(fileContent);
|
|
1294
|
+
if (compilation.outputOptions.hashSalt) {
|
|
1295
|
+
hash.update(compilation.outputOptions.hashSalt);
|
|
1296
|
+
}
|
|
1297
|
+
const contentHash = hash
|
|
1298
|
+
.digest(compilation.outputOptions.hashDigest)
|
|
1299
|
+
.slice(0, compilation.outputOptions.hashDigestLength);
|
|
1300
|
+
return compilation.getPathWithInfo(filename, {
|
|
1301
|
+
contentHash,
|
|
1302
|
+
chunk: { hash: contentHash, contentHash },
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
generateHTML(
|
|
1306
|
+
compiler,
|
|
1307
|
+
compilation,
|
|
1308
|
+
outputName,
|
|
1309
|
+
childCompilerPlugin,
|
|
1310
|
+
previousEmittedAssets,
|
|
1311
|
+
assetJson,
|
|
1312
|
+
callback,
|
|
1313
|
+
) {
|
|
1314
|
+
const { entrypoints } = compilation;
|
|
1315
|
+
const entryNames = Array.from(entrypoints.keys());
|
|
1316
|
+
const filteredEntryNames = this.filterEntryChunks(
|
|
1317
|
+
entryNames,
|
|
1318
|
+
this.options.chunks,
|
|
1319
|
+
this.options.excludeChunks,
|
|
1320
|
+
);
|
|
1321
|
+
const sortedEntryNames = this.sortEntryChunks(
|
|
1322
|
+
filteredEntryNames,
|
|
1323
|
+
this.options.chunksSortMode,
|
|
1324
|
+
compilation,
|
|
1325
|
+
);
|
|
1326
|
+
const templateResult = this.options.templateContent
|
|
1327
|
+
? { mainCompilationHash: compilation.hash }
|
|
1328
|
+
: childCompilerPlugin.getCompilationEntryResult(
|
|
1329
|
+
this.options.template,
|
|
1330
|
+
);
|
|
1331
|
+
if ("error" in templateResult) {
|
|
1332
|
+
compilation.errors.push(
|
|
1333
|
+
prettyError(templateResult.error).toString(),
|
|
1334
|
+
);
|
|
1335
|
+
}
|
|
1336
|
+
const isCompilationCached =
|
|
1337
|
+
templateResult.mainCompilationHash !== compilation.hash;
|
|
1338
|
+
const assetsInformationByGroups = this.getAssetsInformationByGroups(
|
|
1339
|
+
compilation,
|
|
1340
|
+
outputName,
|
|
1341
|
+
sortedEntryNames,
|
|
1342
|
+
entrypoints,
|
|
1343
|
+
);
|
|
1344
|
+
const newAssetJson = JSON.stringify(
|
|
1345
|
+
this.getAssetFiles(assetsInformationByGroups),
|
|
1346
|
+
);
|
|
1347
|
+
if (
|
|
1348
|
+
isCompilationCached &&
|
|
1349
|
+
this.options.cache &&
|
|
1350
|
+
assetJson.value === newAssetJson
|
|
1351
|
+
) {
|
|
1352
|
+
previousEmittedAssets.forEach(({ name, source, info }) => {
|
|
1353
|
+
compilation.emitAsset(name, source, info);
|
|
1354
|
+
});
|
|
1355
|
+
return callback();
|
|
1356
|
+
} else {
|
|
1357
|
+
previousEmittedAssets.length = 0;
|
|
1358
|
+
assetJson.value = newAssetJson;
|
|
1359
|
+
}
|
|
1360
|
+
const assetsPromise = this.generateFavicon(
|
|
1361
|
+
compiler,
|
|
1362
|
+
this.options.favicon,
|
|
1363
|
+
compilation,
|
|
1364
|
+
assetsInformationByGroups.publicPath,
|
|
1365
|
+
previousEmittedAssets,
|
|
1366
|
+
).then((faviconPath) => {
|
|
1367
|
+
assetsInformationByGroups.favicon = faviconPath;
|
|
1368
|
+
return getHtmlRspackPluginHooks(
|
|
1369
|
+
compilation,
|
|
1370
|
+
).beforeAssetTagGeneration.promise({
|
|
1371
|
+
assets: assetsInformationByGroups,
|
|
1372
|
+
outputName,
|
|
1373
|
+
plugin: this,
|
|
1374
|
+
});
|
|
1375
|
+
});
|
|
1376
|
+
const assetTagGroupsPromise = assetsPromise
|
|
1377
|
+
.then(({ assets }) =>
|
|
1378
|
+
getHtmlRspackPluginHooks(compilation).alterAssetTags.promise({
|
|
1379
|
+
assetTags: {
|
|
1380
|
+
scripts: this.generatedScriptTags(assets.js),
|
|
1381
|
+
styles: this.generateStyleTags(assets.css),
|
|
1382
|
+
meta: [
|
|
1383
|
+
...(this.options.base !== false
|
|
1384
|
+
? this.generateBaseTag(this.options.base)
|
|
1385
|
+
: []),
|
|
1386
|
+
...this.generatedMetaTags(this.options.meta),
|
|
1387
|
+
...(assets.favicon
|
|
1388
|
+
? this.generateFaviconTag(assets.favicon)
|
|
1389
|
+
: []),
|
|
1390
|
+
],
|
|
1391
|
+
},
|
|
1392
|
+
outputName,
|
|
1393
|
+
publicPath: assetsInformationByGroups.publicPath,
|
|
1394
|
+
plugin: this,
|
|
1395
|
+
}),
|
|
1396
|
+
)
|
|
1397
|
+
.then(({ assetTags }) => {
|
|
1398
|
+
const scriptTarget =
|
|
1399
|
+
this.options.inject === "head" ||
|
|
1400
|
+
(this.options.inject !== "body" &&
|
|
1401
|
+
this.options.scriptLoading !== "blocking")
|
|
1402
|
+
? "head"
|
|
1403
|
+
: "body";
|
|
1404
|
+
const assetGroups = this.groupAssetsByElements(
|
|
1405
|
+
assetTags,
|
|
1406
|
+
scriptTarget,
|
|
1407
|
+
);
|
|
1408
|
+
return getHtmlRspackPluginHooks(
|
|
1409
|
+
compilation,
|
|
1410
|
+
).alterAssetTagGroups.promise({
|
|
1411
|
+
headTags: assetGroups.headTags,
|
|
1412
|
+
bodyTags: assetGroups.bodyTags,
|
|
1413
|
+
outputName,
|
|
1414
|
+
publicPath: assetsInformationByGroups.publicPath,
|
|
1415
|
+
plugin: this,
|
|
1416
|
+
});
|
|
1417
|
+
});
|
|
1418
|
+
const templateEvaluationPromise = Promise.resolve().then(() => {
|
|
1419
|
+
if ("error" in templateResult) {
|
|
1420
|
+
return this.options.showErrors
|
|
1421
|
+
? prettyError(templateResult.error).toHtml()
|
|
1422
|
+
: "ERROR";
|
|
1423
|
+
}
|
|
1424
|
+
if (this.options.templateContent !== false) {
|
|
1425
|
+
return this.options.templateContent;
|
|
1426
|
+
}
|
|
1427
|
+
if ("compiledEntry" in templateResult) {
|
|
1428
|
+
const compiledEntry = templateResult.compiledEntry;
|
|
1429
|
+
const assets = compiledEntry.assets;
|
|
1430
|
+
for (const name in assets) {
|
|
1431
|
+
previousEmittedAssets.push({
|
|
1432
|
+
name,
|
|
1433
|
+
source: assets[name].source,
|
|
1434
|
+
info: assets[name].info,
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
return this.evaluateCompilationResult(
|
|
1438
|
+
compiledEntry.content,
|
|
1439
|
+
assetsInformationByGroups.publicPath,
|
|
1440
|
+
this.options.template,
|
|
1441
|
+
);
|
|
1442
|
+
}
|
|
1443
|
+
return Promise.reject(
|
|
1444
|
+
new Error("Child compilation contained no compiledEntry"),
|
|
1445
|
+
);
|
|
1446
|
+
});
|
|
1447
|
+
const templateExectutionPromise = Promise.all([
|
|
1448
|
+
assetsPromise,
|
|
1449
|
+
assetTagGroupsPromise,
|
|
1450
|
+
templateEvaluationPromise,
|
|
1451
|
+
]).then(([assetsHookResult, assetTags, compilationResult]) =>
|
|
1452
|
+
typeof compilationResult !== "function"
|
|
1453
|
+
? compilationResult
|
|
1454
|
+
: this.executeTemplate(
|
|
1455
|
+
compilationResult,
|
|
1456
|
+
assetsHookResult.assets,
|
|
1457
|
+
{
|
|
1458
|
+
headTags: assetTags.headTags,
|
|
1459
|
+
bodyTags: assetTags.bodyTags,
|
|
1460
|
+
},
|
|
1461
|
+
compilation,
|
|
1462
|
+
),
|
|
1463
|
+
);
|
|
1464
|
+
const injectedHtmlPromise = Promise.all([
|
|
1465
|
+
assetTagGroupsPromise,
|
|
1466
|
+
templateExectutionPromise,
|
|
1467
|
+
])
|
|
1468
|
+
.then(([assetTags, html]) => {
|
|
1469
|
+
const pluginArgs = {
|
|
1470
|
+
html,
|
|
1471
|
+
headTags: assetTags.headTags,
|
|
1472
|
+
bodyTags: assetTags.bodyTags,
|
|
1473
|
+
plugin: this,
|
|
1474
|
+
outputName,
|
|
1475
|
+
};
|
|
1476
|
+
return getHtmlRspackPluginHooks(
|
|
1477
|
+
compilation,
|
|
1478
|
+
).afterTemplateExecution.promise(pluginArgs);
|
|
1479
|
+
})
|
|
1480
|
+
.then(({ html, headTags, bodyTags }) =>
|
|
1481
|
+
this.postProcessHtml(compiler, html, assetsInformationByGroups, {
|
|
1482
|
+
headTags,
|
|
1483
|
+
bodyTags,
|
|
1484
|
+
}),
|
|
1485
|
+
);
|
|
1486
|
+
const emitHtmlPromise = injectedHtmlPromise
|
|
1487
|
+
.then((html) => {
|
|
1488
|
+
const pluginArgs = { html, plugin: this, outputName };
|
|
1489
|
+
return getHtmlRspackPluginHooks(compilation)
|
|
1490
|
+
.beforeEmit.promise(pluginArgs)
|
|
1491
|
+
.then((result) => result.html);
|
|
1492
|
+
})
|
|
1493
|
+
.catch((err) => {
|
|
1494
|
+
compilation.errors.push(prettyError(err).toString());
|
|
1495
|
+
return this.options.showErrors
|
|
1496
|
+
? prettyError(err).toHtml()
|
|
1497
|
+
: "ERROR";
|
|
1498
|
+
})
|
|
1499
|
+
.then((html) => {
|
|
1500
|
+
const filename = outputName;
|
|
1501
|
+
const replacedFilename = this.replacePlaceholdersInFilename(
|
|
1502
|
+
compiler,
|
|
1503
|
+
filename,
|
|
1504
|
+
html,
|
|
1505
|
+
compilation,
|
|
1506
|
+
);
|
|
1507
|
+
const source = new compiler.webpack.sources.RawSource(
|
|
1508
|
+
html,
|
|
1509
|
+
false,
|
|
1510
|
+
);
|
|
1511
|
+
compilation.emitAsset(
|
|
1512
|
+
replacedFilename.path,
|
|
1513
|
+
source,
|
|
1514
|
+
replacedFilename.info,
|
|
1515
|
+
);
|
|
1516
|
+
previousEmittedAssets.push({
|
|
1517
|
+
name: replacedFilename.path,
|
|
1518
|
+
source,
|
|
1519
|
+
});
|
|
1520
|
+
return replacedFilename.path;
|
|
1521
|
+
})
|
|
1522
|
+
.then((finalOutputName) =>
|
|
1523
|
+
getHtmlRspackPluginHooks(compilation)
|
|
1524
|
+
.afterEmit.promise({
|
|
1525
|
+
outputName: finalOutputName,
|
|
1526
|
+
plugin: this,
|
|
1527
|
+
})
|
|
1528
|
+
.catch((err) => {
|
|
1529
|
+
this.logger.error(err);
|
|
1530
|
+
return null;
|
|
1531
|
+
})
|
|
1532
|
+
.then(() => null),
|
|
1533
|
+
);
|
|
1534
|
+
emitHtmlPromise.then(() => {
|
|
1535
|
+
callback();
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
function templateParametersGenerator(
|
|
1540
|
+
compilation,
|
|
1541
|
+
assets,
|
|
1542
|
+
assetTags,
|
|
1543
|
+
options,
|
|
1544
|
+
) {
|
|
1545
|
+
return {
|
|
1546
|
+
compilation,
|
|
1547
|
+
webpackConfig: compilation.options,
|
|
1548
|
+
htmlWebpackPlugin: { tags: assetTags, files: assets, options },
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
HtmlRspackPlugin.version = 6;
|
|
1552
|
+
HtmlRspackPlugin.getCompilationHooks = getHtmlRspackPluginHooks;
|
|
1553
|
+
HtmlRspackPlugin.getHooks = getHtmlRspackPluginHooks;
|
|
1554
|
+
HtmlRspackPlugin.createHtmlTagObject = createHtmlTagObject;
|
|
1555
|
+
module.exports = HtmlRspackPlugin;
|
|
1556
|
+
},
|
|
1557
|
+
408: (module) => {
|
|
1558
|
+
"use strict";
|
|
1559
|
+
module.exports = require("@rspack/lite-tapable");
|
|
1560
|
+
},
|
|
1561
|
+
896: (module) => {
|
|
1562
|
+
"use strict";
|
|
1563
|
+
module.exports = require("fs");
|
|
1564
|
+
},
|
|
1565
|
+
928: (module) => {
|
|
1566
|
+
"use strict";
|
|
1567
|
+
module.exports = require("path");
|
|
1568
|
+
},
|
|
1569
|
+
23: (module) => {
|
|
1570
|
+
"use strict";
|
|
1571
|
+
module.exports = require("util");
|
|
1572
|
+
},
|
|
1573
|
+
154: (module) => {
|
|
1574
|
+
"use strict";
|
|
1575
|
+
module.exports = require("vm");
|
|
1576
|
+
},
|
|
1577
|
+
};
|
|
1578
|
+
var __webpack_module_cache__ = {};
|
|
1579
|
+
function __nccwpck_require__(moduleId) {
|
|
1580
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
1581
|
+
if (cachedModule !== undefined) {
|
|
1582
|
+
return cachedModule.exports;
|
|
1583
|
+
}
|
|
1584
|
+
var module = (__webpack_module_cache__[moduleId] = { exports: {} });
|
|
1585
|
+
var threw = true;
|
|
1586
|
+
try {
|
|
1587
|
+
__webpack_modules__[moduleId](
|
|
1588
|
+
module,
|
|
1589
|
+
module.exports,
|
|
1590
|
+
__nccwpck_require__,
|
|
1591
|
+
);
|
|
1592
|
+
threw = false;
|
|
1593
|
+
} finally {
|
|
1594
|
+
if (threw) delete __webpack_module_cache__[moduleId];
|
|
1595
|
+
}
|
|
1596
|
+
return module.exports;
|
|
1597
|
+
}
|
|
1598
|
+
if (typeof __nccwpck_require__ !== "undefined")
|
|
1599
|
+
__nccwpck_require__.ab = __dirname + "/";
|
|
1600
|
+
var __webpack_exports__ = __nccwpck_require__(387);
|
|
1601
|
+
module.exports = __webpack_exports__;
|
|
1602
|
+
})();
|