@umijs/bundler-webpack 3.5.19 → 4.0.0-beta.11
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/LICENSE +7 -0
- package/compiled/@svgr/webpack/index.js +266 -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 +162861 -0
- package/compiled/webpack/json-schema/index.d.ts +751 -0
- package/compiled/webpack/lazy-compilation-node.js +40 -0
- package/compiled/webpack/lazy-compilation-web.js +74 -0
- package/compiled/webpack/package.json +5 -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 +12664 -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 +17 -0
- package/dist/build.js +72 -0
- package/{lib → dist}/cli.d.ts +0 -0
- package/dist/cli.js +93 -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 +69 -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 +20 -0
- package/dist/config/config.js +178 -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 +14 -0
- package/dist/config/javaScriptRules.js +155 -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 +43 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +15 -0
- package/dist/dev.d.ts +19 -0
- package/dist/dev.js +87 -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 +72 -0
- package/dist/server/server.d.ts +16 -0
- package/dist/server/server.js +158 -0
- package/dist/server/ws.d.ts +8 -0
- package/dist/server/ws.js +42 -0
- package/dist/swcPlugins/autoCSSModules.d.ts +8 -0
- package/dist/swcPlugins/autoCSSModules.js +35 -0
- package/dist/types.d.ts +100 -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 +170 -42
- 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,197 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _react() {
|
|
4
|
-
const data = _interopRequireDefault(require("react"));
|
|
5
|
-
|
|
6
|
-
_react = function _react() {
|
|
7
|
-
return data;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
return data;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
|
-
|
|
17
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
18
|
-
|
|
19
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
-
|
|
21
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
22
|
-
|
|
23
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
-
|
|
25
|
-
const _require = require('terser'),
|
|
26
|
-
terserMinify = _require.minify;
|
|
27
|
-
|
|
28
|
-
const buildTerserOptions = ({
|
|
29
|
-
ecma,
|
|
30
|
-
parse = {},
|
|
31
|
-
compress = {},
|
|
32
|
-
mangle,
|
|
33
|
-
module,
|
|
34
|
-
output,
|
|
35
|
-
toplevel,
|
|
36
|
-
nameCache,
|
|
37
|
-
ie8,
|
|
38
|
-
|
|
39
|
-
/* eslint-disable camelcase */
|
|
40
|
-
keep_classnames,
|
|
41
|
-
keep_fnames,
|
|
42
|
-
|
|
43
|
-
/* eslint-enable camelcase */
|
|
44
|
-
safari10
|
|
45
|
-
} = {}) => ({
|
|
46
|
-
parse: _objectSpread({}, parse),
|
|
47
|
-
compress: typeof compress === 'boolean' ? compress : _objectSpread({}, compress),
|
|
48
|
-
// eslint-disable-next-line no-nested-ternary
|
|
49
|
-
mangle: mangle == null ? true : typeof mangle === 'boolean' ? mangle : _objectSpread({}, mangle),
|
|
50
|
-
output: _objectSpread({
|
|
51
|
-
beautify: false
|
|
52
|
-
}, output),
|
|
53
|
-
// Ignoring sourceMap from options
|
|
54
|
-
sourceMap: null,
|
|
55
|
-
ecma,
|
|
56
|
-
keep_classnames,
|
|
57
|
-
keep_fnames,
|
|
58
|
-
ie8,
|
|
59
|
-
module,
|
|
60
|
-
nameCache,
|
|
61
|
-
safari10,
|
|
62
|
-
toplevel
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
function isObject(value) {
|
|
66
|
-
const type = typeof value;
|
|
67
|
-
return value != null && (type === 'object' || type === 'function');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const buildComments = (extractComments, terserOptions, extractedComments) => {
|
|
71
|
-
const condition = {};
|
|
72
|
-
const comments = terserOptions.output.comments;
|
|
73
|
-
condition.preserve = typeof comments !== 'undefined' ? comments : false;
|
|
74
|
-
|
|
75
|
-
if (typeof extractComments === 'boolean' && extractComments) {
|
|
76
|
-
condition.extract = 'some';
|
|
77
|
-
} else if (typeof extractComments === 'string' || extractComments instanceof RegExp) {
|
|
78
|
-
condition.extract = extractComments;
|
|
79
|
-
} else if (typeof extractComments === 'function') {
|
|
80
|
-
condition.extract = extractComments;
|
|
81
|
-
} else if (isObject(extractComments)) {
|
|
82
|
-
condition.extract = typeof extractComments.condition === 'boolean' && extractComments.condition ? 'some' : typeof extractComments.condition !== 'undefined' ? extractComments.condition : 'some';
|
|
83
|
-
} else {
|
|
84
|
-
// No extract
|
|
85
|
-
// Preserve using "commentsOpts" or "some"
|
|
86
|
-
condition.preserve = typeof comments !== 'undefined' ? comments : 'some';
|
|
87
|
-
condition.extract = false;
|
|
88
|
-
} // Ensure that both conditions are functions
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
['preserve', 'extract'].forEach(key => {
|
|
92
|
-
let regexStr;
|
|
93
|
-
let regex;
|
|
94
|
-
|
|
95
|
-
switch (typeof condition[key]) {
|
|
96
|
-
case 'boolean':
|
|
97
|
-
condition[key] = condition[key] ? () => true : () => false;
|
|
98
|
-
break;
|
|
99
|
-
|
|
100
|
-
case 'function':
|
|
101
|
-
break;
|
|
102
|
-
|
|
103
|
-
case 'string':
|
|
104
|
-
if (condition[key] === 'all') {
|
|
105
|
-
condition[key] = () => true;
|
|
106
|
-
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (condition[key] === 'some') {
|
|
111
|
-
condition[key] = (astNode, comment) => {
|
|
112
|
-
return (comment.type === 'comment2' || comment.type === 'comment1') && /@preserve|@lic|@cc_on|^\**!/i.test(comment.value);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
regexStr = condition[key];
|
|
119
|
-
|
|
120
|
-
condition[key] = (astNode, comment) => {
|
|
121
|
-
return new RegExp(regexStr).test(comment.value);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
break;
|
|
125
|
-
|
|
126
|
-
default:
|
|
127
|
-
regex = condition[key];
|
|
128
|
-
|
|
129
|
-
condition[key] = (astNode, comment) => regex.test(comment.value);
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
}); // Redefine the comments function to extract and preserve
|
|
133
|
-
// comments according to the two conditions
|
|
134
|
-
|
|
135
|
-
return (astNode, comment) => {
|
|
136
|
-
if (condition.extract(astNode, comment)) {
|
|
137
|
-
const commentText = comment.type === 'comment2' ? `/*${comment.value}*/` : `//${comment.value}`; // Don't include duplicate comments
|
|
138
|
-
|
|
139
|
-
if (!extractedComments.includes(commentText)) {
|
|
140
|
-
extractedComments.push(commentText);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return condition.preserve(astNode, comment);
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
function minify(_x) {
|
|
149
|
-
return _minify.apply(this, arguments);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function _minify() {
|
|
153
|
-
_minify = _asyncToGenerator(function* (options) {
|
|
154
|
-
const name = options.name,
|
|
155
|
-
input = options.input,
|
|
156
|
-
inputSourceMap = options.inputSourceMap,
|
|
157
|
-
minifyFn = options.minify,
|
|
158
|
-
minimizerOptions = options.minimizerOptions;
|
|
159
|
-
|
|
160
|
-
if (minifyFn) {
|
|
161
|
-
return minifyFn({
|
|
162
|
-
[name]: input
|
|
163
|
-
}, inputSourceMap, minimizerOptions);
|
|
164
|
-
} // Copy terser options
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const terserOptions = buildTerserOptions(minimizerOptions); // Let terser generate a SourceMap
|
|
168
|
-
|
|
169
|
-
if (inputSourceMap) {
|
|
170
|
-
terserOptions.sourceMap = {
|
|
171
|
-
asObject: true
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const extractedComments = [];
|
|
176
|
-
const extractComments = options.extractComments;
|
|
177
|
-
terserOptions.output.comments = buildComments(extractComments, terserOptions, extractedComments);
|
|
178
|
-
const result = yield terserMinify({
|
|
179
|
-
[name]: input
|
|
180
|
-
}, terserOptions);
|
|
181
|
-
return _objectSpread(_objectSpread({}, result), {}, {
|
|
182
|
-
extractedComments
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
return _minify.apply(this, arguments);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function transform(options) {
|
|
189
|
-
// 'use strict' => this === undefined (Clean Scope)
|
|
190
|
-
// Safer for possible security issues, albeit not critical at all here
|
|
191
|
-
// eslint-disable-next-line no-new-func, no-param-reassign
|
|
192
|
-
options = new Function('exports', 'require', 'module', '__filename', '__dirname', `'use strict'\nreturn ${options}`)(exports, require, module, __filename, __dirname);
|
|
193
|
-
return minify(options);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
module.exports.minify = minify;
|
|
197
|
-
module.exports.transform = transform;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _react() {
|
|
4
|
-
const data = _interopRequireDefault(require("react"));
|
|
5
|
-
|
|
6
|
-
_react = function _react() {
|
|
7
|
-
return data;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
return data;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
module.exports = require('./terser-webpack-plugin/src').default;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
declare function formatWebpackMessages(json: any): {
|
|
8
|
-
errors: any;
|
|
9
|
-
warnings: any;
|
|
10
|
-
};
|
|
11
|
-
export default formatWebpackMessages;
|
|
@@ -1,127 +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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/
|
|
26
|
-
// WARNING: this code is untranspiled and is used in browser too.
|
|
27
|
-
// Please make sure any changes are in ES5 or contribute a Babel compile step.
|
|
28
|
-
// Some custom utilities to prettify Webpack output.
|
|
29
|
-
// This is quite hacky and hopefully won't be needed when Webpack fixes this.
|
|
30
|
-
// https://github.com/webpack/webpack/issues/2878
|
|
31
|
-
const friendlySyntaxErrorLabel = 'Syntax error:';
|
|
32
|
-
|
|
33
|
-
function isLikelyASyntaxError(message) {
|
|
34
|
-
return message.includes(friendlySyntaxErrorLabel);
|
|
35
|
-
} // Cleans up webpack error messages.
|
|
36
|
-
// eslint-disable-next-line no-unused-vars
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function formatMessage(message, isError) {
|
|
40
|
-
if (typeof message !== 'string') {
|
|
41
|
-
message = message.message;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
let lines = message.split('\n');
|
|
45
|
-
|
|
46
|
-
if (lines.length > 2 && lines[1] === '') {
|
|
47
|
-
// Remove extra newline.
|
|
48
|
-
lines.splice(1, 1);
|
|
49
|
-
} // Remove webpack-specific loader notation from filename.
|
|
50
|
-
// Before:
|
|
51
|
-
// ./~/css-loader!./~/postcss-loader!./src/App.css
|
|
52
|
-
// After:
|
|
53
|
-
// ./src/App.css
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (lines[0].includes('!')) {
|
|
57
|
-
lines[0] = lines[0].substr(lines[0].lastIndexOf('!') + 1);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
lines = lines.filter(line => {
|
|
61
|
-
// Webpack adds a list of entry points to warning messages:
|
|
62
|
-
// @ ./src/index.js
|
|
63
|
-
// @ multi react-scripts/~/react-dev-utils/webpackHotDevClient.js ...
|
|
64
|
-
// It is misleading (and unrelated to the warnings) so we clean it up.
|
|
65
|
-
// It is only useful for syntax errors but we have beautiful frames for them.
|
|
66
|
-
return line.indexOf(' @ ') !== 0;
|
|
67
|
-
}); // line #0 is filename
|
|
68
|
-
// line #1 is the main error message
|
|
69
|
-
|
|
70
|
-
if (!lines[0] || !lines[1]) {
|
|
71
|
-
return lines.join('\n');
|
|
72
|
-
} // Cleans up verbose "module not found" messages for files and packages.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (lines[1].indexOf('Module not found: ') === 0) {
|
|
76
|
-
lines = [lines[0], // Clean up message because "Module not found: " is descriptive enough.
|
|
77
|
-
lines[1].replace("Cannot resolve 'file' or 'directory' ", '').replace('Cannot resolve module ', '').replace('Error: ', '').replace('[CaseSensitivePathsPlugin] ', '')];
|
|
78
|
-
} // Cleans up syntax error messages.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (lines[1].indexOf('Module build failed: ') === 0) {
|
|
82
|
-
lines[1] = lines[1].replace('Module build failed: SyntaxError:', friendlySyntaxErrorLabel);
|
|
83
|
-
} // Clean up export errors.
|
|
84
|
-
// TODO: we should really send a PR to Webpack for this.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const exportError = /\s*(.+?)\s*(")?export '(.+?)' was not found in '(.+?)'/;
|
|
88
|
-
|
|
89
|
-
if (lines[1].match(exportError)) {
|
|
90
|
-
lines[1] = lines[1].replace(exportError, "$1 '$4' does not contain an export named '$3'.");
|
|
91
|
-
} // Reassemble the message.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
message = lines.join('\n'); // Internal stacks are generally useless so we strip them... with the
|
|
95
|
-
// exception of stacks containing `webpack:` because they're normally
|
|
96
|
-
// from user code generated by WebPack. For more information see
|
|
97
|
-
// https://github.com/facebookincubator/create-react-app/pull/1050
|
|
98
|
-
|
|
99
|
-
message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
|
|
100
|
-
|
|
101
|
-
return message.trim();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function formatWebpackMessages(json) {
|
|
105
|
-
const formattedErrors = json.errors.map(message => {
|
|
106
|
-
return formatMessage(message, true);
|
|
107
|
-
});
|
|
108
|
-
const formattedWarnings = json.warnings.map(message => {
|
|
109
|
-
return formatMessage(message, false);
|
|
110
|
-
});
|
|
111
|
-
const result = {
|
|
112
|
-
errors: formattedErrors,
|
|
113
|
-
warnings: formattedWarnings
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
if (result.errors.some(isLikelyASyntaxError)) {
|
|
117
|
-
// If there are any syntax errors, show just them.
|
|
118
|
-
// This prevents a confusing ESLint parsing error
|
|
119
|
-
// preceding a much more useful Babel syntax error.
|
|
120
|
-
result.errors = result.errors.filter(isLikelyASyntaxError);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
var _default = formatWebpackMessages;
|
|
127
|
-
exports.default = _default;
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _react() {
|
|
4
|
-
const data = _interopRequireDefault(require("react"));
|
|
5
|
-
|
|
6
|
-
_react = function _react() {
|
|
7
|
-
return data;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
return data;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function ErrorOverlay() {
|
|
14
|
-
const data = _interopRequireWildcard(require("react-error-overlay"));
|
|
15
|
-
|
|
16
|
-
ErrorOverlay = function ErrorOverlay() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return data;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function _sockjsClient() {
|
|
24
|
-
const data = _interopRequireDefault(require("sockjs-client"));
|
|
25
|
-
|
|
26
|
-
_sockjsClient = function _sockjsClient() {
|
|
27
|
-
return data;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function _stripAnsi() {
|
|
34
|
-
const data = _interopRequireDefault(require("strip-ansi"));
|
|
35
|
-
|
|
36
|
-
_stripAnsi = function _stripAnsi() {
|
|
37
|
-
return data;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return data;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function _url() {
|
|
44
|
-
const data = _interopRequireDefault(require("url"));
|
|
45
|
-
|
|
46
|
-
_url = function _url() {
|
|
47
|
-
return data;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return data;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var _formatWebpackMessages = _interopRequireDefault(require("./formatWebpackMessages"));
|
|
54
|
-
|
|
55
|
-
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); }
|
|
56
|
-
|
|
57
|
-
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; }
|
|
58
|
-
|
|
59
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
60
|
-
|
|
61
|
-
// @ts-ignore
|
|
62
|
-
let hadRuntimeError = false;
|
|
63
|
-
ErrorOverlay().startReportingRuntimeErrors({
|
|
64
|
-
onError: function onError() {
|
|
65
|
-
hadRuntimeError = true;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
let isFirstCompilation = true;
|
|
69
|
-
let mostRecentCompilationHash = null;
|
|
70
|
-
let hasCompileErrors = false;
|
|
71
|
-
|
|
72
|
-
function handleHashChange(hash) {
|
|
73
|
-
mostRecentCompilationHash = hash;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function handleSuccess(data) {
|
|
77
|
-
if (data && data.reload) {
|
|
78
|
-
window.location.reload();
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const isHotUpdate = !isFirstCompilation;
|
|
83
|
-
isFirstCompilation = false;
|
|
84
|
-
hasCompileErrors = false;
|
|
85
|
-
|
|
86
|
-
if (isHotUpdate) {
|
|
87
|
-
tryApplyUpdates(() => {
|
|
88
|
-
ErrorOverlay().dismissBuildError();
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function handleWarnings(warnings) {
|
|
94
|
-
var isHotUpdate = !isFirstCompilation;
|
|
95
|
-
isFirstCompilation = false;
|
|
96
|
-
hasCompileErrors = false;
|
|
97
|
-
|
|
98
|
-
function printWarnings() {
|
|
99
|
-
const formatted = (0, _formatWebpackMessages.default)({
|
|
100
|
-
warnings,
|
|
101
|
-
errors: []
|
|
102
|
-
});
|
|
103
|
-
formatted.warnings.forEach(warning => {
|
|
104
|
-
console.warn((0, _stripAnsi().default)(warning));
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (isHotUpdate) {
|
|
109
|
-
tryApplyUpdates(() => {
|
|
110
|
-
printWarnings();
|
|
111
|
-
ErrorOverlay().dismissBuildError();
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
printWarnings();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function handleErrors(errors) {
|
|
119
|
-
isFirstCompilation = false;
|
|
120
|
-
hasCompileErrors = true;
|
|
121
|
-
const formatted = (0, _formatWebpackMessages.default)({
|
|
122
|
-
errors,
|
|
123
|
-
warnings: []
|
|
124
|
-
});
|
|
125
|
-
ErrorOverlay().reportBuildError(formatted.errors[0]);
|
|
126
|
-
formatted.errors.forEach(error => {
|
|
127
|
-
console.error((0, _stripAnsi().default)(error));
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
let tryApplyUpdates = null; // function tryApplyUpdates(onHotUpdateSuccess?: Function) {
|
|
132
|
-
// // @ts-ignore
|
|
133
|
-
// if (!module.hot) {
|
|
134
|
-
// window.location.reload();
|
|
135
|
-
// return;
|
|
136
|
-
// }
|
|
137
|
-
//
|
|
138
|
-
// function isUpdateAvailable() {
|
|
139
|
-
// // @ts-ignore
|
|
140
|
-
// return mostRecentCompilationHash !== __webpack_hash__;
|
|
141
|
-
// }
|
|
142
|
-
//
|
|
143
|
-
// // TODO: is update available?
|
|
144
|
-
// // @ts-ignore
|
|
145
|
-
// if (!isUpdateAvailable() || module.hot.status() !== 'idle') {
|
|
146
|
-
// return;
|
|
147
|
-
// }
|
|
148
|
-
//
|
|
149
|
-
// function handleApplyUpdates(err: Error | null, updatedModules: any) {
|
|
150
|
-
// if (err || !updatedModules || hadRuntimeError) {
|
|
151
|
-
// window.location.reload();
|
|
152
|
-
// return;
|
|
153
|
-
// }
|
|
154
|
-
//
|
|
155
|
-
// onHotUpdateSuccess?.();
|
|
156
|
-
//
|
|
157
|
-
// if (isUpdateAvailable()) {
|
|
158
|
-
// // While we were updating, there was a new update! Do it again.
|
|
159
|
-
// tryApplyUpdates();
|
|
160
|
-
// }
|
|
161
|
-
// }
|
|
162
|
-
//
|
|
163
|
-
// // @ts-ignore
|
|
164
|
-
// module.hot.check(true).then(
|
|
165
|
-
// function (updatedModules: any) {
|
|
166
|
-
// handleApplyUpdates(null, updatedModules);
|
|
167
|
-
// },
|
|
168
|
-
// function (err: Error) {
|
|
169
|
-
// handleApplyUpdates(err, null);
|
|
170
|
-
// },
|
|
171
|
-
// );
|
|
172
|
-
// }
|
|
173
|
-
|
|
174
|
-
const showPending = () => {
|
|
175
|
-
const el = document.createElement('div');
|
|
176
|
-
el.style.position = 'absolute';
|
|
177
|
-
el.style.left = '0px';
|
|
178
|
-
el.style.top = '0px';
|
|
179
|
-
el.style.width = '100%';
|
|
180
|
-
el.style.background = '#fff1b8';
|
|
181
|
-
el.style.zIndex = '2147483647000000';
|
|
182
|
-
el.style.color = '#613400';
|
|
183
|
-
el.style.textAlign = 'center';
|
|
184
|
-
el.style.fontSize = '18px';
|
|
185
|
-
el.style.fontFamily = 'Consolas, Menlo, Courier, monospace';
|
|
186
|
-
el.style.padding = '8px 0';
|
|
187
|
-
el.style.boxShadow = '0px 4px 8px rgba(0, 0, 0, 0.1)';
|
|
188
|
-
el.innerHTML = 'Disconnected from the devServer, trying to reconnect...';
|
|
189
|
-
document.body.appendChild(el);
|
|
190
|
-
return el;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
let sock;
|
|
194
|
-
let retries = 0;
|
|
195
|
-
let pending;
|
|
196
|
-
|
|
197
|
-
function stripLastSlash(url) {
|
|
198
|
-
if (url.slice(-1) === '/') {
|
|
199
|
-
return url.slice(0, -1);
|
|
200
|
-
} else {
|
|
201
|
-
return url;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function getSocketHost() {
|
|
206
|
-
var _document$body, _document$body$queryS;
|
|
207
|
-
|
|
208
|
-
if (process.env.SOCKET_SERVER) {
|
|
209
|
-
return stripLastSlash(process.env.SOCKET_SERVER);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
let host, protocol;
|
|
213
|
-
const scripts = ((_document$body = document.body) === null || _document$body === void 0 ? void 0 : (_document$body$queryS = _document$body.querySelectorAll) === null || _document$body$queryS === void 0 ? void 0 : _document$body$queryS.call(_document$body, 'script')) || [];
|
|
214
|
-
const dataFromSrc = scripts[scripts.length - 1] ? scripts[scripts.length - 1].getAttribute('src') : '';
|
|
215
|
-
|
|
216
|
-
if (dataFromSrc && dataFromSrc.includes('umi.js')) {
|
|
217
|
-
const urlParsed = _url().default.parse(dataFromSrc);
|
|
218
|
-
|
|
219
|
-
host = urlParsed.host;
|
|
220
|
-
protocol = urlParsed.protocol;
|
|
221
|
-
} else {
|
|
222
|
-
// 某些场景可能没有 umi.js,比如微前端的场景
|
|
223
|
-
host = location.host;
|
|
224
|
-
protocol = location.protocol;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return host && protocol ? _url().default.format({
|
|
228
|
-
host,
|
|
229
|
-
protocol
|
|
230
|
-
}) : '';
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function initSocket() {
|
|
234
|
-
const host = getSocketHost();
|
|
235
|
-
sock = new (_sockjsClient().default)(`${host}/dev-server`);
|
|
236
|
-
|
|
237
|
-
sock.onopen = () => {
|
|
238
|
-
var _pending, _pending$parentElemen;
|
|
239
|
-
|
|
240
|
-
retries = 0;
|
|
241
|
-
(_pending = pending) === null || _pending === void 0 ? void 0 : (_pending$parentElemen = _pending.parentElement) === null || _pending$parentElemen === void 0 ? void 0 : _pending$parentElemen.removeChild(pending);
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
sock.onmessage = e => {
|
|
245
|
-
const message = JSON.parse(e.data);
|
|
246
|
-
|
|
247
|
-
switch (message.type) {
|
|
248
|
-
case 'hash':
|
|
249
|
-
handleHashChange(message.data);
|
|
250
|
-
break;
|
|
251
|
-
|
|
252
|
-
case 'still-ok':
|
|
253
|
-
case 'ok':
|
|
254
|
-
handleSuccess(message.data);
|
|
255
|
-
break;
|
|
256
|
-
|
|
257
|
-
case 'warnings':
|
|
258
|
-
handleWarnings(message.data);
|
|
259
|
-
break;
|
|
260
|
-
|
|
261
|
-
case 'errors':
|
|
262
|
-
handleErrors(message.data);
|
|
263
|
-
break;
|
|
264
|
-
|
|
265
|
-
default:
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
sock.onclose = e => {
|
|
271
|
-
if (retries === 0) {
|
|
272
|
-
var _console;
|
|
273
|
-
|
|
274
|
-
if (typeof ((_console = console) === null || _console === void 0 ? void 0 : _console.info) === 'function') {
|
|
275
|
-
console.info('The development server has disconnected.\nRefresh the page if necessary.');
|
|
276
|
-
}
|
|
277
|
-
} // @ts-ignore
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
sock = null;
|
|
281
|
-
|
|
282
|
-
if (!pending) {
|
|
283
|
-
pending = showPending();
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (retries <= 10) {
|
|
287
|
-
const retryInMs = 1000 * Math.pow(2, retries) + Math.random() * 100;
|
|
288
|
-
retries += 1;
|
|
289
|
-
setTimeout(() => {
|
|
290
|
-
initSocket();
|
|
291
|
-
}, retryInMs);
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
} // TODO: improve this
|
|
295
|
-
// @ts-ignore
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
window.g_initWebpackHotDevClient = function (opts) {
|
|
299
|
-
tryApplyUpdates = opts.tryApplyUpdates;
|
|
300
|
-
initSocket();
|
|
301
|
-
}; // @ts-ignore
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
window.g_getMostRecentCompilationHash = () => {
|
|
305
|
-
return mostRecentCompilationHash;
|
|
306
|
-
}; // @ts-ignore
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
window.g_getHadRuntimeError = () => {
|
|
310
|
-
return hadRuntimeError;
|
|
311
|
-
};
|