@umijs/bundler-webpack 3.5.20 → 4.0.0-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/README.md +2 -0
- package/bin/bundler-webpack.js +1 -2
- package/client/client/client.js +202 -0
- package/client/constants.js +12 -0
- package/client/utils/formatWebpackMessages.js +92 -0
- package/compiled/@svgr/webpack/.svgo.yml +75 -0
- package/compiled/@svgr/webpack/LICENSE +7 -0
- package/compiled/@svgr/webpack/index.js +343 -0
- package/compiled/@svgr/webpack/package.json +1 -0
- package/compiled/autoprefixer/LICENSE +20 -0
- package/compiled/autoprefixer/browserslist/index.d.ts +172 -0
- package/compiled/autoprefixer/index.js +9 -0
- package/compiled/autoprefixer/lib/autoprefixer.d.ts +95 -0
- package/compiled/autoprefixer/package.json +1 -0
- package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +106 -0
- package/compiled/autoprefixer/postcss/lib/comment.d.ts +56 -0
- package/compiled/autoprefixer/postcss/lib/container.d.ts +442 -0
- package/compiled/autoprefixer/postcss/lib/css-syntax-error.d.ts +192 -0
- package/compiled/autoprefixer/postcss/lib/declaration.d.ts +124 -0
- package/compiled/autoprefixer/postcss/lib/document.d.ts +57 -0
- package/compiled/autoprefixer/postcss/lib/input.d.ts +130 -0
- package/compiled/autoprefixer/postcss/lib/lazy-result.d.ts +175 -0
- package/compiled/autoprefixer/postcss/lib/list.d.ts +51 -0
- package/compiled/autoprefixer/postcss/lib/node.d.ts +444 -0
- package/compiled/autoprefixer/postcss/lib/postcss.d.ts +472 -0
- package/compiled/autoprefixer/postcss/lib/previous-map.d.ts +72 -0
- package/compiled/autoprefixer/postcss/lib/processor.d.ts +101 -0
- package/compiled/autoprefixer/postcss/lib/result.d.ts +195 -0
- package/compiled/autoprefixer/postcss/lib/root.d.ts +73 -0
- package/compiled/autoprefixer/postcss/lib/rule.d.ts +104 -0
- package/compiled/autoprefixer/postcss/lib/warning.d.ts +104 -0
- package/compiled/autoprefixer/source-map-js/source-map.d.ts +98 -0
- package/compiled/babel-loader/LICENSE +22 -0
- package/compiled/babel-loader/index.js +3 -0
- package/compiled/babel-loader/package.json +1 -0
- package/compiled/compression/LICENSE +23 -0
- package/compiled/compression/index.js +57 -0
- package/compiled/compression/package.json +1 -0
- package/compiled/connect-history-api-fallback/LICENSE +21 -0
- package/compiled/connect-history-api-fallback/index.js +1 -0
- package/compiled/connect-history-api-fallback/package.json +1 -0
- package/{lib/webpack/plugins/mini-css-extract-plugin → compiled/copy-webpack-plugin}/LICENSE +0 -0
- package/compiled/copy-webpack-plugin/index.js +46 -0
- package/compiled/copy-webpack-plugin/package.json +1 -0
- package/{lib/webpack/plugins/terser-webpack-plugin → compiled/css-loader}/LICENSE +0 -0
- package/compiled/css-loader/api.js +102 -0
- package/compiled/css-loader/getUrl.js +29 -0
- package/compiled/css-loader/index.js +2 -0
- package/compiled/css-loader/noSourceMaps.js +5 -0
- package/compiled/css-loader/package.json +1 -0
- package/compiled/css-loader/sourceMaps.js +22 -0
- package/compiled/css-minimizer-webpack-plugin/LICENSE +20 -0
- package/compiled/css-minimizer-webpack-plugin/index.js +3 -0
- package/compiled/css-minimizer-webpack-plugin/minify.js +72 -0
- package/compiled/css-minimizer-webpack-plugin/package.json +1 -0
- package/compiled/css-minimizer-webpack-plugin/utils.js +166 -0
- package/compiled/cssnano/index.js +192 -0
- package/compiled/cssnano/package.json +1 -0
- package/compiled/express/LICENSE +24 -0
- package/compiled/express/body-parser/index.d.ts +104 -0
- package/compiled/express/connect/index.d.ts +93 -0
- package/compiled/express/express-serve-static-core/index.d.ts +1252 -0
- package/compiled/express/index.d.ts +133 -0
- package/compiled/express/index.js +338 -0
- package/compiled/express/mime/index.d.ts +35 -0
- package/compiled/express/package.json +1 -0
- package/compiled/express/qs/index.d.ts +62 -0
- package/compiled/express/range-parser/index.d.ts +35 -0
- package/compiled/express/serve-static/index.d.ts +108 -0
- package/compiled/http-proxy-middleware/LICENSE +22 -0
- package/compiled/http-proxy-middleware/dist/index.d.ts +4 -0
- package/compiled/http-proxy-middleware/dist/types.d.ts +54 -0
- package/compiled/http-proxy-middleware/http-proxy/index.d.ts +226 -0
- package/compiled/http-proxy-middleware/index.js +66 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/less/index.js +31 -0
- package/compiled/less/package.json +1 -0
- package/compiled/less-loader/LICENSE +20 -0
- package/compiled/less-loader/index.js +1 -0
- package/compiled/less-loader/package.json +1 -0
- package/compiled/mini-css-extract-plugin/LICENSE +20 -0
- package/{lib/webpack/plugins/mini-css-extract-plugin/src → compiled/mini-css-extract-plugin}/hmr/hotModuleReplacement.js +50 -52
- package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +35 -0
- package/compiled/mini-css-extract-plugin/index.js +11606 -0
- package/compiled/mini-css-extract-plugin/loader-options.json +32 -0
- package/compiled/mini-css-extract-plugin/loader.js +315 -0
- package/compiled/mini-css-extract-plugin/package.json +1 -0
- package/compiled/mini-css-extract-plugin/utils.js +154 -0
- package/compiled/postcss-flexbugs-fixes/LICENSE +20 -0
- package/compiled/postcss-flexbugs-fixes/index.js +1 -0
- package/compiled/postcss-flexbugs-fixes/package.json +1 -0
- package/compiled/postcss-loader/LICENSE +20 -0
- package/compiled/postcss-loader/index.js +1 -0
- package/compiled/postcss-loader/package.json +1 -0
- package/compiled/purgecss-webpack-plugin/LICENSE +21 -0
- package/compiled/purgecss-webpack-plugin/index.js +7781 -0
- package/compiled/purgecss-webpack-plugin/package.json +1 -0
- package/compiled/react-refresh/index.js +19 -0
- package/compiled/sass-loader/LICENSE +20 -0
- package/compiled/sass-loader/index.js +1 -0
- package/compiled/sass-loader/package.json +1 -0
- package/compiled/schema-utils/LICENSE +20 -0
- package/compiled/schema-utils/ajv/lib/ajv.d.ts +397 -0
- package/compiled/schema-utils/declarations/ValidationError.d.ts +74 -0
- package/compiled/schema-utils/declarations/index.d.ts +3 -0
- package/compiled/schema-utils/declarations/validate.d.ts +37 -0
- package/compiled/schema-utils/index.js +3 -0
- package/compiled/schema-utils/json-schema/index.d.ts +751 -0
- package/compiled/schema-utils/package.json +1 -0
- package/compiled/speed-measure-webpack-plugin/LICENSE +21 -0
- package/compiled/speed-measure-webpack-plugin/index.js +1 -0
- package/compiled/speed-measure-webpack-plugin/package.json +1 -0
- package/compiled/style-loader/LICENSE +20 -0
- package/compiled/style-loader/index.js +1 -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 +104 -0
- package/compiled/style-loader/runtime/insertBySelector.js +39 -0
- package/compiled/style-loader/runtime/insertStyleElement.js +11 -0
- package/compiled/style-loader/runtime/isEqualLocals.js +35 -0
- package/compiled/style-loader/runtime/isOldIE.js +19 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributes.js +16 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +10 -0
- package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +12 -0
- package/compiled/style-loader/runtime/singletonStyleDomAPI.js +93 -0
- package/compiled/style-loader/runtime/styleDomAPI.js +70 -0
- package/compiled/style-loader/runtime/styleTagTransform.js +16 -0
- package/compiled/svgo-loader/LICENSE +22 -0
- package/compiled/svgo-loader/index.js +4 -0
- package/compiled/svgo-loader/package.json +1 -0
- package/compiled/swc-loader/LICENSE +25 -0
- package/compiled/swc-loader/index.js +1 -0
- package/compiled/swc-loader/package.json +1 -0
- package/compiled/tapable/LICENSE +21 -0
- package/compiled/tapable/index.js +1 -0
- package/compiled/tapable/package.json +1 -0
- package/compiled/tapable/tapable.d.ts +116 -0
- package/compiled/terser/LICENSE +29 -0
- package/compiled/terser/index.js +1 -0
- package/compiled/terser/mappings.wasm +0 -0
- package/compiled/terser/package.json +1 -0
- package/compiled/terser/source-map/source-map.d.ts +369 -0
- package/compiled/terser/tools/terser.d.ts +207 -0
- package/compiled/terser-webpack-plugin/LICENSE +20 -0
- package/compiled/terser-webpack-plugin/ajv/lib/ajv.d.ts +397 -0
- package/compiled/terser-webpack-plugin/index.js +15142 -0
- package/compiled/terser-webpack-plugin/jest-worker/build/index.d.ts +49 -0
- package/compiled/terser-webpack-plugin/jest-worker/build/types.d.ts +142 -0
- package/compiled/terser-webpack-plugin/json-schema/index.d.ts +751 -0
- package/compiled/terser-webpack-plugin/minify.js +43 -0
- package/compiled/terser-webpack-plugin/package.json +1 -0
- package/compiled/terser-webpack-plugin/schema-utils/declarations/ValidationError.d.ts +74 -0
- package/compiled/terser-webpack-plugin/schema-utils/declarations/index.d.ts +3 -0
- package/compiled/terser-webpack-plugin/schema-utils/declarations/validate.d.ts +37 -0
- package/compiled/terser-webpack-plugin/source-map/source-map.d.ts +98 -0
- package/compiled/terser-webpack-plugin/types/cjs.d.ts +3 -0
- package/compiled/terser-webpack-plugin/types/index.d.ts +295 -0
- package/compiled/terser-webpack-plugin/types/utils.d.ts +105 -0
- package/compiled/terser-webpack-plugin/utils.js +594 -0
- package/compiled/url-loader/LICENSE +20 -0
- package/compiled/url-loader/index.js +15 -0
- package/compiled/url-loader/package.json +1 -0
- package/compiled/webpack/Chunk.js +1 -0
- package/compiled/webpack/Compilation.js +1 -0
- package/compiled/webpack/HotModuleReplacement.runtime.js +394 -0
- package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +462 -0
- package/compiled/webpack/LICENSE +20 -0
- package/compiled/webpack/LibraryTemplatePlugin.js +1 -0
- package/compiled/webpack/LoaderTargetPlugin.js +1 -0
- package/compiled/webpack/ModuleFilenameHelpers.js +1 -0
- package/compiled/webpack/NormalModule.js +1 -0
- package/compiled/webpack/RuntimeGlobals.js +1 -0
- package/compiled/webpack/RuntimeModule.js +1 -0
- package/compiled/webpack/SingleEntryPlugin.js +1 -0
- package/compiled/webpack/Template.js +1 -0
- package/compiled/webpack/ajv/lib/ajv.d.ts +397 -0
- package/compiled/webpack/deepImports.json +12 -0
- package/compiled/webpack/index.js +162727 -0
- package/compiled/webpack/json-schema/index.d.ts +751 -0
- package/compiled/webpack/lazy-compilation-node.js +38 -0
- package/compiled/webpack/lazy-compilation-web.js +74 -0
- package/compiled/webpack/package.json +1 -0
- package/compiled/webpack/schema-utils/declarations/ValidationError.d.ts +74 -0
- package/compiled/webpack/schema-utils/declarations/index.d.ts +3 -0
- package/compiled/webpack/schema-utils/declarations/validate.d.ts +37 -0
- package/compiled/webpack/types.d.ts +12633 -0
- package/compiled/webpack-5-chain/LICENSE +373 -0
- package/compiled/webpack-5-chain/index.js +1 -0
- package/compiled/webpack-5-chain/package.json +1 -0
- package/compiled/webpack-5-chain/types/index.d.ts +543 -0
- package/compiled/webpack-bundle-analyzer/LICENSE +20 -0
- package/compiled/webpack-bundle-analyzer/index.js +30 -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-bundle-analyzer/public/viewer.js.map +1 -0
- package/compiled/webpack-dev-middleware/LICENSE +20 -0
- package/compiled/webpack-dev-middleware/index.js +21 -0
- package/compiled/webpack-dev-middleware/package.json +1 -0
- package/compiled/webpack-sources/LICENSE +21 -0
- package/compiled/webpack-sources/index.d.ts +20 -0
- package/compiled/webpack-sources/index.js +1 -0
- package/compiled/webpack-sources/lib/CachedSource.d.ts +18 -0
- package/compiled/webpack-sources/lib/CompatSource.d.ts +9 -0
- package/compiled/webpack-sources/lib/ConcatSource.d.ts +22 -0
- package/compiled/webpack-sources/lib/OriginalSource.d.ts +18 -0
- package/compiled/webpack-sources/lib/PrefixSource.d.ts +12 -0
- package/compiled/webpack-sources/lib/RawSource.d.ts +13 -0
- package/compiled/webpack-sources/lib/ReplaceSource.d.ts +35 -0
- package/compiled/webpack-sources/lib/SizeOnlySource.d.ts +7 -0
- package/compiled/webpack-sources/lib/Source.d.ts +45 -0
- package/compiled/webpack-sources/lib/SourceMapSource.d.ts +22 -0
- package/compiled/webpack-sources/lib/index.d.ts +60 -0
- package/compiled/webpack-sources/package.json +1 -0
- package/compiled/webpack-sources/source-list-map/index.d.ts +91 -0
- package/compiled/webpack-sources/source-map/source-map.d.ts +369 -0
- package/compiled/ws/LICENSE +19 -0
- package/compiled/ws/index.d.ts +359 -0
- package/compiled/ws/index.js +1 -0
- package/compiled/ws/package.json +1 -0
- package/dist/build.d.ts +10 -0
- package/dist/build.js +61 -0
- package/{lib → dist}/cli.d.ts +0 -0
- package/dist/cli.js +113 -0
- package/{lib/webpackHotDevClient/webpackHotDevClient.d.ts → dist/client/client.d.ts} +0 -0
- package/dist/client/client.js +239 -0
- package/dist/config/_sampleFeature.d.ts +10 -0
- package/dist/config/_sampleFeature.js +22 -0
- package/dist/config/assetRules.d.ts +11 -0
- package/dist/config/assetRules.js +56 -0
- package/dist/config/bundleAnalyzerPlugin.d.ts +10 -0
- package/dist/config/bundleAnalyzerPlugin.js +30 -0
- package/dist/config/compressPlugin.d.ts +10 -0
- package/dist/config/compressPlugin.js +77 -0
- package/dist/config/config.d.ts +16 -0
- package/dist/config/config.js +163 -0
- package/dist/config/copyPlugin.d.ts +10 -0
- package/dist/config/copyPlugin.js +49 -0
- package/dist/config/cssRules.d.ts +11 -0
- package/dist/config/cssRules.js +98 -0
- package/dist/config/definePlugin.d.ts +15 -0
- package/dist/config/definePlugin.js +45 -0
- package/dist/config/fastRefreshPlugin.d.ts +12 -0
- package/dist/config/fastRefreshPlugin.js +34 -0
- package/dist/config/ignorePlugin.d.ts +10 -0
- package/dist/config/ignorePlugin.js +27 -0
- package/dist/config/javaScriptRules.d.ts +12 -0
- package/dist/config/javaScriptRules.js +150 -0
- package/dist/config/miniCSSExtractPlugin.d.ts +10 -0
- package/dist/config/miniCSSExtractPlugin.js +34 -0
- package/dist/config/nodePolyfill.d.ts +10 -0
- package/dist/config/nodePolyfill.js +34 -0
- package/dist/config/progressPlugin.d.ts +11 -0
- package/dist/config/progressPlugin.js +27 -0
- package/dist/config/purgecssWebpackPlugin.d.ts +10 -0
- package/dist/config/purgecssWebpackPlugin.js +32 -0
- package/dist/config/speedMeasureWebpackPlugin.d.ts +6 -0
- package/dist/config/speedMeasureWebpackPlugin.js +34 -0
- package/dist/config/svgRules.d.ts +11 -0
- package/dist/config/svgRules.js +56 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +15 -0
- package/dist/dev.d.ts +13 -0
- package/dist/dev.js +71 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +16 -0
- package/dist/plugins/ESBuildCSSMinifyPlugin.d.ts +11 -0
- package/dist/plugins/ESBuildCSSMinifyPlugin.js +65 -0
- package/dist/plugins/ProgressPlugin.d.ts +15 -0
- package/dist/plugins/ProgressPlugin.js +44 -0
- package/dist/plugins/_SamplePlugin.d.ts +9 -0
- package/dist/plugins/_SamplePlugin.js +14 -0
- package/dist/requireHook.d.ts +1 -0
- package/dist/requireHook.js +31 -0
- package/dist/schema.d.ts +3 -0
- package/dist/schema.js +68 -0
- package/dist/server/server.d.ts +16 -0
- package/dist/server/server.js +157 -0
- package/dist/server/ws.d.ts +8 -0
- package/dist/server/ws.js +42 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.js +29 -0
- package/dist/utils/browsersList.d.ts +5 -0
- package/dist/utils/browsersList.js +10 -0
- package/dist/utils/depMatch.d.ts +6 -0
- package/dist/utils/depMatch.js +46 -0
- package/dist/utils/formatWebpackMessages.d.ts +12 -0
- package/dist/utils/formatWebpackMessages.js +100 -0
- package/package.json +163 -35
- package/bundled/css/hotModuleReplacement.js +0 -1203
- package/bundled/js/webpackHotDevClient.js +0 -13386
- package/lib/DevCompileDonePlugin.d.ts +0 -10
- package/lib/DevCompileDonePlugin.js +0 -53
- package/lib/cli.js +0 -184
- package/lib/getConfig/css.d.ts +0 -22
- package/lib/getConfig/css.js +0 -186
- package/lib/getConfig/getConfig.d.ts +0 -26
- package/lib/getConfig/getConfig.js +0 -578
- package/lib/getConfig/nodeModulesTransform.d.ts +0 -13
- package/lib/getConfig/nodeModulesTransform.js +0 -141
- package/lib/getConfig/pkgMatch.d.ts +0 -2
- package/lib/getConfig/pkgMatch.js +0 -58
- package/lib/getConfig/resolveDefine.d.ts +0 -5
- package/lib/getConfig/resolveDefine.js +0 -53
- package/lib/getConfig/runtimePublicPathEntry.d.ts +0 -1
- package/lib/getConfig/runtimePublicPathEntry.js +0 -3
- package/lib/getConfig/terserOptions.d.ts +0 -41
- package/lib/getConfig/terserOptions.js +0 -64
- package/lib/index.d.ts +0 -34
- package/lib/index.js +0 -314
- package/lib/requireHook.d.ts +0 -3
- package/lib/requireHook.js +0 -51
- package/lib/webpack/plugins/mini-css-extract-plugin/src/CssDependency.js +0 -94
- package/lib/webpack/plugins/mini-css-extract-plugin/src/CssDependencyTemplate.js +0 -26
- package/lib/webpack/plugins/mini-css-extract-plugin/src/CssLoadingRuntimeModule.js +0 -93
- package/lib/webpack/plugins/mini-css-extract-plugin/src/CssModule.js +0 -164
- package/lib/webpack/plugins/mini-css-extract-plugin/src/CssModuleFactory.js +0 -32
- package/lib/webpack/plugins/mini-css-extract-plugin/src/cjs.js +0 -15
- package/lib/webpack/plugins/mini-css-extract-plugin/src/index.js +0 -542
- package/lib/webpack/plugins/mini-css-extract-plugin/src/loader.js +0 -319
- package/lib/webpack/plugins/mini-css-extract-plugin/src/utils.js +0 -97
- package/lib/webpack/plugins/mini-css-extract-plugin.d.ts +0 -1
- package/lib/webpack/plugins/mini-css-extract-plugin.js +0 -15
- package/lib/webpack/plugins/terser-webpack-plugin/package.json +0 -3
- package/lib/webpack/plugins/terser-webpack-plugin/src/Webpack4Cache.js +0 -187
- package/lib/webpack/plugins/terser-webpack-plugin/src/Webpack5Cache.js +0 -61
- package/lib/webpack/plugins/terser-webpack-plugin/src/index.js +0 -683
- package/lib/webpack/plugins/terser-webpack-plugin/src/minify.js +0 -197
- package/lib/webpack/plugins/terser-webpack-plugin.d.ts +0 -1
- package/lib/webpack/plugins/terser-webpack-plugin.js +0 -15
- package/lib/webpackHotDevClient/formatWebpackMessages.d.ts +0 -11
- package/lib/webpackHotDevClient/formatWebpackMessages.js +0 -127
- package/lib/webpackHotDevClient/webpackHotDevClient.js +0 -311
|
@@ -1,542 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
function _react() {
|
|
9
|
-
const data = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
|
-
_react = function _react() {
|
|
12
|
-
return data;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return data;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _webpack() {
|
|
19
|
-
const data = _interopRequireWildcard(require("@umijs/deps/compiled/webpack"));
|
|
20
|
-
|
|
21
|
-
_webpack = function _webpack() {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return data;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var _CssModuleFactory = _interopRequireDefault(require("./CssModuleFactory"));
|
|
29
|
-
|
|
30
|
-
var _CssDependencyTemplate = _interopRequireDefault(require("./CssDependencyTemplate"));
|
|
31
|
-
|
|
32
|
-
var _CssDependency = _interopRequireDefault(require("./CssDependency"));
|
|
33
|
-
|
|
34
|
-
var _utils = require("./utils");
|
|
35
|
-
|
|
36
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
-
|
|
38
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
-
|
|
40
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
-
|
|
42
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
43
|
-
|
|
44
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
45
|
-
|
|
46
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
-
|
|
48
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
-
|
|
50
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
51
|
-
|
|
52
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
53
|
-
|
|
54
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
55
|
-
|
|
56
|
-
// webpack 5 exposes the sources property to ensure the right version of webpack-sources is used
|
|
57
|
-
const _ref = // eslint-disable-next-line global-require
|
|
58
|
-
_webpack().default.sources || require('@umijs/deps/compiled/webpack-sources'),
|
|
59
|
-
ConcatSource = _ref.ConcatSource,
|
|
60
|
-
SourceMapSource = _ref.SourceMapSource,
|
|
61
|
-
OriginalSource = _ref.OriginalSource;
|
|
62
|
-
|
|
63
|
-
const Template = _webpack().default.Template,
|
|
64
|
-
createHash = _webpack().default.util.createHash;
|
|
65
|
-
|
|
66
|
-
const isWebpack4 = _webpack().version[0] === '4';
|
|
67
|
-
const pluginName = 'mini-css-extract-plugin';
|
|
68
|
-
const REGEXP_CHUNKHASH = /\[chunkhash(?::(\d+))?\]/i;
|
|
69
|
-
const REGEXP_CONTENTHASH = /\[contenthash(?::(\d+))?\]/i;
|
|
70
|
-
const REGEXP_NAME = /\[name\]/i;
|
|
71
|
-
const REGEXP_PLACEHOLDERS = /\[(name|id|chunkhash)\]/g;
|
|
72
|
-
const DEFAULT_FILENAME = '[name].css';
|
|
73
|
-
|
|
74
|
-
class MiniCssExtractPlugin {
|
|
75
|
-
constructor(options = {}) {
|
|
76
|
-
this.options = Object.assign({
|
|
77
|
-
filename: DEFAULT_FILENAME,
|
|
78
|
-
moduleFilename: () => this.options.filename || DEFAULT_FILENAME,
|
|
79
|
-
ignoreOrder: false
|
|
80
|
-
}, options);
|
|
81
|
-
|
|
82
|
-
if (!this.options.chunkFilename) {
|
|
83
|
-
const filename = this.options.filename; // Anything changing depending on chunk is fine
|
|
84
|
-
|
|
85
|
-
if (filename.match(REGEXP_PLACEHOLDERS)) {
|
|
86
|
-
this.options.chunkFilename = filename;
|
|
87
|
-
} else {
|
|
88
|
-
// Elsewise prefix '[id].' in front of the basename to make it changing
|
|
89
|
-
this.options.chunkFilename = filename.replace(/(^|\/)([^/]*(?:\?|$))/, '$1[id].$2');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (!isWebpack4 && 'hmr' in this.options) {
|
|
94
|
-
throw new Error("The 'hmr' option doesn't exist for the mini-css-extract-plugin when using webpack 5 (it's automatically determined)");
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
/** @param {import("webpack").Compiler} compiler */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
apply(compiler) {
|
|
101
|
-
if (!isWebpack4) {
|
|
102
|
-
const splitChunks = compiler.options.optimization.splitChunks;
|
|
103
|
-
|
|
104
|
-
if (splitChunks) {
|
|
105
|
-
if (splitChunks.defaultSizeTypes.includes('...')) {
|
|
106
|
-
splitChunks.defaultSizeTypes.push(_utils.MODULE_TYPE);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
|
112
|
-
compilation.dependencyFactories.set(_CssDependency.default, new _CssModuleFactory.default());
|
|
113
|
-
compilation.dependencyTemplates.set(_CssDependency.default, new _CssDependencyTemplate.default());
|
|
114
|
-
|
|
115
|
-
if (isWebpack4) {
|
|
116
|
-
compilation.mainTemplate.hooks.renderManifest.tap(pluginName, (result, {
|
|
117
|
-
chunk
|
|
118
|
-
}) => {
|
|
119
|
-
const chunkGraph = compilation.chunkGraph;
|
|
120
|
-
const renderedModules = Array.from(this.getChunkModules(chunk, chunkGraph)).filter(module => module.type === _utils.MODULE_TYPE);
|
|
121
|
-
|
|
122
|
-
const filenameTemplate = chunk.filenameTemplate || (({
|
|
123
|
-
chunk: chunkData
|
|
124
|
-
}) => this.options.moduleFilename(chunkData));
|
|
125
|
-
|
|
126
|
-
if (renderedModules.length > 0) {
|
|
127
|
-
result.push({
|
|
128
|
-
render: () => this.renderContentAsset(compilation, chunk, renderedModules, compilation.runtimeTemplate.requestShortener),
|
|
129
|
-
filenameTemplate,
|
|
130
|
-
pathOptions: {
|
|
131
|
-
chunk,
|
|
132
|
-
contentHashType: _utils.MODULE_TYPE
|
|
133
|
-
},
|
|
134
|
-
identifier: `${pluginName}.${chunk.id}`,
|
|
135
|
-
hash: chunk.contentHash[_utils.MODULE_TYPE]
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
compilation.chunkTemplate.hooks.renderManifest.tap(pluginName, (result, {
|
|
140
|
-
chunk
|
|
141
|
-
}) => {
|
|
142
|
-
const chunkGraph = compilation.chunkGraph;
|
|
143
|
-
const renderedModules = Array.from(this.getChunkModules(chunk, chunkGraph)).filter(module => module.type === _utils.MODULE_TYPE);
|
|
144
|
-
const filenameTemplate = chunk.filenameTemplate || this.options.chunkFilename;
|
|
145
|
-
|
|
146
|
-
if (renderedModules.length > 0) {
|
|
147
|
-
result.push({
|
|
148
|
-
render: () => this.renderContentAsset(compilation, chunk, renderedModules, compilation.runtimeTemplate.requestShortener),
|
|
149
|
-
filenameTemplate,
|
|
150
|
-
pathOptions: {
|
|
151
|
-
chunk,
|
|
152
|
-
contentHashType: _utils.MODULE_TYPE
|
|
153
|
-
},
|
|
154
|
-
identifier: `${pluginName}.${chunk.id}`,
|
|
155
|
-
hash: chunk.contentHash[_utils.MODULE_TYPE]
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
} else {
|
|
160
|
-
compilation.hooks.renderManifest.tap(pluginName, (result, {
|
|
161
|
-
chunk
|
|
162
|
-
}) => {
|
|
163
|
-
const chunkGraph = compilation.chunkGraph; // We don't need hot update chunks for css
|
|
164
|
-
// We will use the real asset instead to update
|
|
165
|
-
|
|
166
|
-
if (chunk instanceof _webpack().default.HotUpdateChunk) return;
|
|
167
|
-
const renderedModules = Array.from(this.getChunkModules(chunk, chunkGraph)).filter(module => module.type === _utils.MODULE_TYPE);
|
|
168
|
-
const filenameTemplate = chunk.canBeInitial() ? ({
|
|
169
|
-
chunk: chunkData
|
|
170
|
-
}) => this.options.moduleFilename(chunkData) : this.options.chunkFilename;
|
|
171
|
-
|
|
172
|
-
if (renderedModules.length > 0) {
|
|
173
|
-
result.push({
|
|
174
|
-
render: () => this.renderContentAsset(compilation, chunk, renderedModules, compilation.runtimeTemplate.requestShortener),
|
|
175
|
-
filenameTemplate,
|
|
176
|
-
pathOptions: {
|
|
177
|
-
chunk,
|
|
178
|
-
contentHashType: _utils.MODULE_TYPE
|
|
179
|
-
},
|
|
180
|
-
identifier: `${pluginName}.${chunk.id}`,
|
|
181
|
-
hash: chunk.contentHash[_utils.MODULE_TYPE]
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
/*
|
|
187
|
-
* For webpack 5 this will be unneeded once the logic uses a RuntimeModule
|
|
188
|
-
* as the content of runtime modules is hashed and added to the chunk hash automatically
|
|
189
|
-
* */
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (isWebpack4) {
|
|
193
|
-
compilation.mainTemplate.hooks.hashForChunk.tap(pluginName, (hash, chunk) => {
|
|
194
|
-
const chunkFilename = this.options.chunkFilename;
|
|
195
|
-
|
|
196
|
-
if (REGEXP_CHUNKHASH.test(chunkFilename)) {
|
|
197
|
-
hash.update(JSON.stringify(chunk.getChunkMaps(true).hash));
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (REGEXP_CONTENTHASH.test(chunkFilename)) {
|
|
201
|
-
hash.update(JSON.stringify(chunk.getChunkMaps(true).contentHash[_utils.MODULE_TYPE] || {}));
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (REGEXP_NAME.test(chunkFilename)) {
|
|
205
|
-
hash.update(JSON.stringify(chunk.getChunkMaps(true).name));
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
compilation.hooks.contentHash.tap(pluginName, chunk => {
|
|
211
|
-
const outputOptions = compilation.outputOptions,
|
|
212
|
-
chunkGraph = compilation.chunkGraph;
|
|
213
|
-
const hashFunction = outputOptions.hashFunction,
|
|
214
|
-
hashDigest = outputOptions.hashDigest,
|
|
215
|
-
hashDigestLength = outputOptions.hashDigestLength;
|
|
216
|
-
const hash = createHash(hashFunction);
|
|
217
|
-
|
|
218
|
-
var _iterator = _createForOfIteratorHelper(this.getChunkModules(chunk, chunkGraph)),
|
|
219
|
-
_step;
|
|
220
|
-
|
|
221
|
-
try {
|
|
222
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
223
|
-
const m = _step.value;
|
|
224
|
-
|
|
225
|
-
if (m.type === _utils.MODULE_TYPE) {
|
|
226
|
-
m.updateHash(hash, {
|
|
227
|
-
chunkGraph
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
} catch (err) {
|
|
232
|
-
_iterator.e(err);
|
|
233
|
-
} finally {
|
|
234
|
-
_iterator.f();
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
const contentHash = chunk.contentHash;
|
|
238
|
-
contentHash[_utils.MODULE_TYPE] = hash.digest(hashDigest).substring(0, hashDigestLength);
|
|
239
|
-
});
|
|
240
|
-
const mainTemplate = compilation.mainTemplate;
|
|
241
|
-
|
|
242
|
-
if (isWebpack4) {
|
|
243
|
-
mainTemplate.hooks.localVars.tap(pluginName, (source, chunk) => {
|
|
244
|
-
const chunkMap = this.getCssChunkObject(chunk, compilation);
|
|
245
|
-
|
|
246
|
-
if (Object.keys(chunkMap).length > 0) {
|
|
247
|
-
return Template.asString([source, '', '// object to store loaded CSS chunks', 'var installedCssChunks = {', Template.indent(chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(',\n')), '};']);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
return source;
|
|
251
|
-
});
|
|
252
|
-
mainTemplate.hooks.requireEnsure.tap(pluginName, (source, chunk, hash) => {
|
|
253
|
-
const chunkMap = this.getCssChunkObject(chunk, compilation);
|
|
254
|
-
|
|
255
|
-
if (Object.keys(chunkMap).length > 0) {
|
|
256
|
-
const chunkMaps = chunk.getChunkMaps();
|
|
257
|
-
const crossOriginLoading = mainTemplate.outputOptions.crossOriginLoading;
|
|
258
|
-
const linkHrefPath = mainTemplate.getAssetPath(JSON.stringify(this.options.chunkFilename), {
|
|
259
|
-
hash: `" + ${mainTemplate.renderCurrentHashCode(hash)} + "`,
|
|
260
|
-
hashWithLength: length => `" + ${mainTemplate.renderCurrentHashCode(hash, length)} + "`,
|
|
261
|
-
chunk: {
|
|
262
|
-
id: '" + chunkId + "',
|
|
263
|
-
hash: `" + ${JSON.stringify(chunkMaps.hash)}[chunkId] + "`,
|
|
264
|
-
|
|
265
|
-
hashWithLength(length) {
|
|
266
|
-
const shortChunkHashMap = Object.create(null);
|
|
267
|
-
|
|
268
|
-
for (var _i = 0, _Object$keys = Object.keys(chunkMaps.hash); _i < _Object$keys.length; _i++) {
|
|
269
|
-
const chunkId = _Object$keys[_i];
|
|
270
|
-
|
|
271
|
-
if (typeof chunkMaps.hash[chunkId] === 'string') {
|
|
272
|
-
shortChunkHashMap[chunkId] = chunkMaps.hash[chunkId].substring(0, length);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return `" + ${JSON.stringify(shortChunkHashMap)}[chunkId] + "`;
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
contentHash: {
|
|
280
|
-
[_utils.MODULE_TYPE]: `" + ${JSON.stringify(chunkMaps.contentHash[_utils.MODULE_TYPE])}[chunkId] + "`
|
|
281
|
-
},
|
|
282
|
-
contentHashWithLength: {
|
|
283
|
-
[_utils.MODULE_TYPE]: length => {
|
|
284
|
-
const shortContentHashMap = {};
|
|
285
|
-
const contentHash = chunkMaps.contentHash[_utils.MODULE_TYPE];
|
|
286
|
-
|
|
287
|
-
for (var _i2 = 0, _Object$keys2 = Object.keys(contentHash); _i2 < _Object$keys2.length; _i2++) {
|
|
288
|
-
const chunkId = _Object$keys2[_i2];
|
|
289
|
-
|
|
290
|
-
if (typeof contentHash[chunkId] === 'string') {
|
|
291
|
-
shortContentHashMap[chunkId] = contentHash[chunkId].substring(0, length);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return `" + ${JSON.stringify(shortContentHashMap)}[chunkId] + "`;
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
name: `" + (${JSON.stringify(chunkMaps.name)}[chunkId]||chunkId) + "`
|
|
299
|
-
},
|
|
300
|
-
contentHashType: _utils.MODULE_TYPE
|
|
301
|
-
});
|
|
302
|
-
return Template.asString([source, '', `// ${pluginName} CSS loading`, `var cssChunks = ${JSON.stringify(chunkMap)};`, 'if(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);', 'else if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {', Template.indent(['promises.push(installedCssChunks[chunkId] = new Promise(function(resolve, reject) {', Template.indent([`var href = ${linkHrefPath};`, `var fullhref = ${mainTemplate.requireFn}.p + href;`, 'var existingLinkTags = document.getElementsByTagName("link");', 'for(var i = 0; i < existingLinkTags.length; i++) {', Template.indent(['var tag = existingLinkTags[i];', 'var dataHref = tag.getAttribute("data-href") || tag.getAttribute("href");', 'if(tag.rel === "stylesheet" && (dataHref === href || dataHref === fullhref)) return resolve();']), '}', 'var existingStyleTags = document.getElementsByTagName("style");', 'for(var i = 0; i < existingStyleTags.length; i++) {', Template.indent(['var tag = existingStyleTags[i];', 'var dataHref = tag.getAttribute("data-href");', 'if(dataHref === href || dataHref === fullhref) return resolve();']), '}', 'var linkTag = document.createElement("link");', 'linkTag.rel = "stylesheet";', 'linkTag.type = "text/css";', 'linkTag.onload = resolve;', 'linkTag.onerror = function(event) {', Template.indent(['var request = event && event.target && event.target.src || fullhref;', 'var err = new Error("Loading CSS chunk " + chunkId + " failed.\\n(" + request + ")");', 'err.code = "CSS_CHUNK_LOAD_FAILED";', 'err.request = request;', 'delete installedCssChunks[chunkId]', 'linkTag.parentNode.removeChild(linkTag)', 'reject(err);']), '};', 'linkTag.href = fullhref;', crossOriginLoading ? Template.asString([`if (linkTag.href.indexOf(window.location.origin + '/') !== 0) {`, Template.indent(`linkTag.crossOrigin = ${JSON.stringify(crossOriginLoading)};`), '}']) : '', 'var head = document.getElementsByTagName("head")[0];', 'head.appendChild(linkTag);']), '}).then(function() {', Template.indent(['installedCssChunks[chunkId] = 0;']), '}));']), '}']);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return source;
|
|
306
|
-
});
|
|
307
|
-
} else {
|
|
308
|
-
const enabledChunks = new WeakSet();
|
|
309
|
-
|
|
310
|
-
const handler = (chunk, set) => {
|
|
311
|
-
if (enabledChunks.has(chunk)) return;
|
|
312
|
-
enabledChunks.add(chunk); // eslint-disable-next-line global-require
|
|
313
|
-
|
|
314
|
-
const CssLoadingRuntimeModule = require('./CssLoadingRuntimeModule');
|
|
315
|
-
|
|
316
|
-
set.add(_webpack().default.RuntimeGlobals.publicPath);
|
|
317
|
-
compilation.addRuntimeModule(chunk, new (_webpack().default.runtime.GetChunkFilenameRuntimeModule)(_utils.MODULE_TYPE, 'mini-css', `${_webpack().default.RuntimeGlobals.require}.miniCssF`, referencedChunk => referencedChunk.canBeInitial() ? ({
|
|
318
|
-
chunk: chunkData
|
|
319
|
-
}) => this.options.moduleFilename(chunkData) : this.options.chunkFilename, true));
|
|
320
|
-
compilation.addRuntimeModule(chunk, new CssLoadingRuntimeModule(set));
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
compilation.hooks.runtimeRequirementInTree.for(_webpack().default.RuntimeGlobals.ensureChunkHandlers).tap(pluginName, handler);
|
|
324
|
-
compilation.hooks.runtimeRequirementInTree.for(_webpack().default.RuntimeGlobals.hmrDownloadUpdateHandlers).tap(pluginName, handler);
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
getChunkModules(chunk, chunkGraph) {
|
|
330
|
-
return typeof chunkGraph !== 'undefined' ? chunkGraph.getOrderedChunkModulesIterable(chunk, _utils.compareModulesByIdentifier) : chunk.modulesIterable;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
getCssChunkObject(mainChunk, compilation) {
|
|
334
|
-
const obj = {};
|
|
335
|
-
const chunkGraph = compilation.chunkGraph;
|
|
336
|
-
|
|
337
|
-
var _iterator2 = _createForOfIteratorHelper(mainChunk.getAllAsyncChunks()),
|
|
338
|
-
_step2;
|
|
339
|
-
|
|
340
|
-
try {
|
|
341
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
342
|
-
const chunk = _step2.value;
|
|
343
|
-
|
|
344
|
-
var _iterator3 = _createForOfIteratorHelper(this.getChunkModules(chunk, chunkGraph)),
|
|
345
|
-
_step3;
|
|
346
|
-
|
|
347
|
-
try {
|
|
348
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
349
|
-
const module = _step3.value;
|
|
350
|
-
|
|
351
|
-
if (module.type === _utils.MODULE_TYPE) {
|
|
352
|
-
obj[chunk.id] = 1;
|
|
353
|
-
break;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
} catch (err) {
|
|
357
|
-
_iterator3.e(err);
|
|
358
|
-
} finally {
|
|
359
|
-
_iterator3.f();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
} catch (err) {
|
|
363
|
-
_iterator2.e(err);
|
|
364
|
-
} finally {
|
|
365
|
-
_iterator2.f();
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
return obj;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
renderContentAsset(compilation, chunk, modules, requestShortener) {
|
|
372
|
-
let usedModules;
|
|
373
|
-
|
|
374
|
-
const _chunk$groupsIterable = _slicedToArray(chunk.groupsIterable, 1),
|
|
375
|
-
chunkGroup = _chunk$groupsIterable[0];
|
|
376
|
-
|
|
377
|
-
const moduleIndexFunctionName = typeof compilation.chunkGraph !== 'undefined' ? 'getModulePostOrderIndex' : 'getModuleIndex2';
|
|
378
|
-
|
|
379
|
-
if (typeof chunkGroup[moduleIndexFunctionName] === 'function') {
|
|
380
|
-
// Store dependencies for modules
|
|
381
|
-
const moduleDependencies = new Map(modules.map(m => [m, new Set()]));
|
|
382
|
-
const moduleDependenciesReasons = new Map(modules.map(m => [m, new Map()])); // Get ordered list of modules per chunk group
|
|
383
|
-
// This loop also gathers dependencies from the ordered lists
|
|
384
|
-
// Lists are in reverse order to allow to use Array.pop()
|
|
385
|
-
|
|
386
|
-
const modulesByChunkGroup = Array.from(chunk.groupsIterable, cg => {
|
|
387
|
-
const sortedModules = modules.map(m => {
|
|
388
|
-
return {
|
|
389
|
-
module: m,
|
|
390
|
-
index: cg[moduleIndexFunctionName](m)
|
|
391
|
-
};
|
|
392
|
-
}) // eslint-disable-next-line no-undefined
|
|
393
|
-
.filter(item => item.index !== undefined).sort((a, b) => b.index - a.index).map(item => item.module);
|
|
394
|
-
|
|
395
|
-
for (let i = 0; i < sortedModules.length; i++) {
|
|
396
|
-
const set = moduleDependencies.get(sortedModules[i]);
|
|
397
|
-
const reasons = moduleDependenciesReasons.get(sortedModules[i]);
|
|
398
|
-
|
|
399
|
-
for (let j = i + 1; j < sortedModules.length; j++) {
|
|
400
|
-
const module = sortedModules[j];
|
|
401
|
-
set.add(module);
|
|
402
|
-
const reason = reasons.get(module) || new Set();
|
|
403
|
-
reason.add(cg);
|
|
404
|
-
reasons.set(module, reason);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
return sortedModules;
|
|
409
|
-
}); // set with already included modules in correct order
|
|
410
|
-
|
|
411
|
-
usedModules = new Set();
|
|
412
|
-
|
|
413
|
-
const unusedModulesFilter = m => !usedModules.has(m);
|
|
414
|
-
|
|
415
|
-
while (usedModules.size < modules.length) {
|
|
416
|
-
let success = false;
|
|
417
|
-
let bestMatch;
|
|
418
|
-
let bestMatchDeps; // get first module where dependencies are fulfilled
|
|
419
|
-
|
|
420
|
-
var _iterator4 = _createForOfIteratorHelper(modulesByChunkGroup),
|
|
421
|
-
_step4;
|
|
422
|
-
|
|
423
|
-
try {
|
|
424
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
425
|
-
const list = _step4.value;
|
|
426
|
-
|
|
427
|
-
// skip and remove already added modules
|
|
428
|
-
while (list.length > 0 && usedModules.has(list[list.length - 1])) {
|
|
429
|
-
list.pop();
|
|
430
|
-
} // skip empty lists
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (list.length !== 0) {
|
|
434
|
-
const module = list[list.length - 1];
|
|
435
|
-
const deps = moduleDependencies.get(module); // determine dependencies that are not yet included
|
|
436
|
-
|
|
437
|
-
const failedDeps = Array.from(deps).filter(unusedModulesFilter); // store best match for fallback behavior
|
|
438
|
-
|
|
439
|
-
if (!bestMatchDeps || bestMatchDeps.length > failedDeps.length) {
|
|
440
|
-
bestMatch = list;
|
|
441
|
-
bestMatchDeps = failedDeps;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
if (failedDeps.length === 0) {
|
|
445
|
-
// use this module and remove it from list
|
|
446
|
-
usedModules.add(list.pop());
|
|
447
|
-
success = true;
|
|
448
|
-
break;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
} catch (err) {
|
|
453
|
-
_iterator4.e(err);
|
|
454
|
-
} finally {
|
|
455
|
-
_iterator4.f();
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if (!success) {
|
|
459
|
-
// no module found => there is a conflict
|
|
460
|
-
// use list with fewest failed deps
|
|
461
|
-
// and emit a warning
|
|
462
|
-
const fallbackModule = bestMatch.pop();
|
|
463
|
-
|
|
464
|
-
if (!this.options.ignoreOrder) {
|
|
465
|
-
const reasons = moduleDependenciesReasons.get(fallbackModule);
|
|
466
|
-
compilation.warnings.push(new Error([`chunk ${chunk.name || chunk.id} [${pluginName}]`, 'Conflicting order. Following module has been added:', ` * ${fallbackModule.readableIdentifier(requestShortener)}`, 'despite it was not able to fulfill desired ordering with these modules:', ...bestMatchDeps.map(m => {
|
|
467
|
-
const goodReasonsMap = moduleDependenciesReasons.get(m);
|
|
468
|
-
const goodReasons = goodReasonsMap && goodReasonsMap.get(fallbackModule);
|
|
469
|
-
const failedChunkGroups = Array.from(reasons.get(m), cg => cg.name).join(', ');
|
|
470
|
-
const goodChunkGroups = goodReasons && Array.from(goodReasons, cg => cg.name).join(', ');
|
|
471
|
-
return [` * ${m.readableIdentifier(requestShortener)}`, ` - couldn't fulfill desired order of chunk group(s) ${failedChunkGroups}`, goodChunkGroups && ` - while fulfilling desired order of chunk group(s) ${goodChunkGroups}`].filter(Boolean).join('\n');
|
|
472
|
-
})].join('\n')));
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
usedModules.add(fallbackModule);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
} else {
|
|
479
|
-
// fallback for older webpack versions
|
|
480
|
-
// (to avoid a breaking change)
|
|
481
|
-
// TODO remove this in next major version
|
|
482
|
-
// and increase minimum webpack version to 4.12.0
|
|
483
|
-
modules.sort((a, b) => a.index2 - b.index2);
|
|
484
|
-
usedModules = modules;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
const source = new ConcatSource();
|
|
488
|
-
const externalsSource = new ConcatSource();
|
|
489
|
-
|
|
490
|
-
var _iterator5 = _createForOfIteratorHelper(usedModules),
|
|
491
|
-
_step5;
|
|
492
|
-
|
|
493
|
-
try {
|
|
494
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
495
|
-
const m = _step5.value;
|
|
496
|
-
|
|
497
|
-
if (/^@import url/.test(m.content)) {
|
|
498
|
-
// HACK for IE
|
|
499
|
-
// http://stackoverflow.com/a/14676665/1458162
|
|
500
|
-
let content = m.content;
|
|
501
|
-
|
|
502
|
-
if (m.media) {
|
|
503
|
-
// insert media into the @import
|
|
504
|
-
// this is rar
|
|
505
|
-
// TODO improve this and parse the CSS to support multiple medias
|
|
506
|
-
content = content.replace(/;|\s*$/, m.media);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
externalsSource.add(content);
|
|
510
|
-
externalsSource.add('\n');
|
|
511
|
-
} else {
|
|
512
|
-
if (m.media) {
|
|
513
|
-
source.add(`@media ${m.media} {\n`);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
if (m.sourceMap) {
|
|
517
|
-
source.add(new SourceMapSource(m.content, m.readableIdentifier(requestShortener), m.sourceMap));
|
|
518
|
-
} else {
|
|
519
|
-
source.add(new OriginalSource(m.content, m.readableIdentifier(requestShortener)));
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
source.add('\n');
|
|
523
|
-
|
|
524
|
-
if (m.media) {
|
|
525
|
-
source.add('}\n');
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
} catch (err) {
|
|
530
|
-
_iterator5.e(err);
|
|
531
|
-
} finally {
|
|
532
|
-
_iterator5.f();
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
return new ConcatSource(externalsSource, source);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
MiniCssExtractPlugin.loader = require.resolve('./loader');
|
|
541
|
-
var _default = MiniCssExtractPlugin;
|
|
542
|
-
exports.default = _default;
|