@umijs/bundler-webpack 3.5.20 → 4.0.0-beta.12
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/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 +239 -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 +150 -0
- package/compiled/autoprefixer/postcss/lib/lazy-result.d.ts +176 -0
- package/compiled/autoprefixer/postcss/lib/list.d.ts +51 -0
- package/compiled/autoprefixer/postcss/lib/no-work-result.d.ts +37 -0
- package/compiled/autoprefixer/postcss/lib/node.d.ts +478 -0
- package/compiled/autoprefixer/postcss/lib/postcss.d.ts +473 -0
- package/compiled/autoprefixer/postcss/lib/previous-map.d.ts +72 -0
- package/compiled/autoprefixer/postcss/lib/processor.d.ts +102 -0
- package/compiled/autoprefixer/postcss/lib/result.d.ts +196 -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 +138 -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 +11644 -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 +159 -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/dist/ajv.d.ts +16 -0
- package/compiled/schema-utils/ajv/dist/compile/codegen/code.d.ts +39 -0
- package/compiled/schema-utils/ajv/dist/compile/codegen/index.d.ts +79 -0
- package/compiled/schema-utils/ajv/dist/compile/codegen/scope.d.ts +79 -0
- package/compiled/schema-utils/ajv/dist/compile/errors.d.ts +13 -0
- package/compiled/schema-utils/ajv/dist/compile/index.d.ts +80 -0
- package/compiled/schema-utils/ajv/dist/compile/ref_error.d.ts +5 -0
- package/compiled/schema-utils/ajv/dist/compile/resolve.d.ts +12 -0
- package/compiled/schema-utils/ajv/dist/compile/rules.d.ts +28 -0
- package/compiled/schema-utils/ajv/dist/compile/util.d.ts +40 -0
- package/compiled/schema-utils/ajv/dist/compile/validate/index.d.ts +42 -0
- package/compiled/schema-utils/ajv/dist/compile/validate/subschema.d.ts +47 -0
- package/compiled/schema-utils/ajv/dist/core.d.ts +171 -0
- package/compiled/schema-utils/ajv/dist/runtime/validation_error.d.ts +7 -0
- package/compiled/schema-utils/ajv/dist/types/index.d.ts +177 -0
- package/compiled/schema-utils/ajv/dist/types/json-schema.d.ts +124 -0
- package/compiled/schema-utils/ajv/dist/types/jtd-schema.d.ts +168 -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 +9 -0
- package/compiled/schema-utils/json-schema/index.d.ts +751 -0
- package/compiled/schema-utils/package.json +1 -0
- package/compiled/schema-utils/uri-js/dist/es5/uri.all.d.ts +59 -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 +15019 -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 +143 -0
- package/compiled/terser-webpack-plugin/json-schema/index.d.ts +751 -0
- package/compiled/terser-webpack-plugin/minify.js +48 -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 +102 -0
- package/compiled/terser-webpack-plugin/utils.js +690 -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 +163291 -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 +27 -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 +57 -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 +12 -0
- package/dist/config/svgRules.js +57 -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/loader/svgr.d.ts +4 -0
- package/dist/loader/svgr.js +67 -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/swcPlugins/lockCoreJS.d.ts +6 -0
- package/dist/swcPlugins/lockCoreJS.js +23 -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 +171 -43
- 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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.applyPurgeCSSWebpackPlugin = void 0;
|
|
13
|
+
const types_1 = require("../types");
|
|
14
|
+
function applyPurgeCSSWebpackPlugin(opts) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const { config, userConfig, cwd, env } = opts;
|
|
17
|
+
config;
|
|
18
|
+
userConfig;
|
|
19
|
+
cwd;
|
|
20
|
+
env;
|
|
21
|
+
if (userConfig.purgeCSS && env === types_1.Env.production) {
|
|
22
|
+
config
|
|
23
|
+
.plugin('purgecss-webpack-plugin')
|
|
24
|
+
.use(require('@umijs/bundler-webpack/compiled/purgecss-webpack-plugin'), [
|
|
25
|
+
{
|
|
26
|
+
paths: [],
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.applyPurgeCSSWebpackPlugin = applyPurgeCSSWebpackPlugin;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.addSpeedMeasureWebpackPlugin = void 0;
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
const speed_measure_webpack_plugin_1 = __importDefault(require("@umijs/bundler-webpack/compiled/speed-measure-webpack-plugin"));
|
|
18
|
+
const path_1 = require("path");
|
|
19
|
+
function addSpeedMeasureWebpackPlugin(opts) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
let webpackConfig = opts.webpackConfig;
|
|
22
|
+
if (process.env.SPEED_MEASURE) {
|
|
23
|
+
const smpOption = process.env.SPEED_MEASURE === 'JSON'
|
|
24
|
+
? {
|
|
25
|
+
outputFormat: 'json',
|
|
26
|
+
outputTarget: (0, path_1.join)(process.cwd(), 'SPEED_MEASURE.json'),
|
|
27
|
+
}
|
|
28
|
+
: { outputFormat: 'human', outputTarget: console.log };
|
|
29
|
+
webpackConfig = new speed_measure_webpack_plugin_1.default(smpOption).wrap(webpackConfig);
|
|
30
|
+
}
|
|
31
|
+
return webpackConfig;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.addSpeedMeasureWebpackPlugin = addSpeedMeasureWebpackPlugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
+
import { Env, IConfig } from '../types';
|
|
3
|
+
interface IOpts {
|
|
4
|
+
config: Config;
|
|
5
|
+
userConfig: IConfig;
|
|
6
|
+
cwd: string;
|
|
7
|
+
env: Env;
|
|
8
|
+
browsers: any;
|
|
9
|
+
staticPathPrefix: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function addSVGRules(opts: IOpts): Promise<void>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.addSVGRules = void 0;
|
|
13
|
+
function addSVGRules(opts) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const { config, userConfig } = opts;
|
|
16
|
+
const { svgr, svgo = {} } = userConfig;
|
|
17
|
+
if (svgr) {
|
|
18
|
+
const svgrRule = config.module.rule('svgr');
|
|
19
|
+
svgrRule
|
|
20
|
+
.test(/\.svg$/)
|
|
21
|
+
.issuer(/\.[jt]sx?$/)
|
|
22
|
+
.type('javascript/auto')
|
|
23
|
+
.use('svgr-loader')
|
|
24
|
+
.loader(require.resolve('../loader/svgr'))
|
|
25
|
+
.options(Object.assign(Object.assign({ svgoConfig: Object.assign({ plugins: [
|
|
26
|
+
{
|
|
27
|
+
name: 'preset-default',
|
|
28
|
+
params: {
|
|
29
|
+
overrides: {
|
|
30
|
+
removeTitle: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
] }, svgo) }, svgr), { svgo: !!svgo }))
|
|
35
|
+
.end()
|
|
36
|
+
.use('url-loader')
|
|
37
|
+
.loader(require.resolve('@umijs/bundler-webpack/compiled/url-loader'))
|
|
38
|
+
.end();
|
|
39
|
+
}
|
|
40
|
+
if (svgo === false) {
|
|
41
|
+
const svgRule = config.module.rule('svg');
|
|
42
|
+
svgRule
|
|
43
|
+
.test(/\.svg$/)
|
|
44
|
+
.use('url-loader')
|
|
45
|
+
.loader(require.resolve('@umijs/bundler-webpack/compiled/url-loader'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const svgRule = config.module.rule('svg');
|
|
49
|
+
svgRule
|
|
50
|
+
.test(/\.svg$/)
|
|
51
|
+
.use('svgo-loader')
|
|
52
|
+
.loader(require.resolve('@umijs/bundler-webpack/compiled/svgo-loader'))
|
|
53
|
+
.options(Object.assign({ configFile: false }, svgo))
|
|
54
|
+
.end();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
exports.addSVGRules = addSVGRules;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const DEFAULT_DEVTOOL = "cheap-module-source-map";
|
|
2
|
+
export declare const DEFAULT_OUTPUT_PATH = "dist";
|
|
3
|
+
export declare const MFSU_NAME = "MFSU";
|
|
4
|
+
export declare enum MESSAGE_TYPE {
|
|
5
|
+
ok = "ok",
|
|
6
|
+
warnings = "warnings",
|
|
7
|
+
errors = "errors",
|
|
8
|
+
hash = "hash",
|
|
9
|
+
stillOk = "still-ok",
|
|
10
|
+
invalid = "invalid"
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MESSAGE_TYPE = exports.MFSU_NAME = exports.DEFAULT_OUTPUT_PATH = exports.DEFAULT_DEVTOOL = void 0;
|
|
4
|
+
exports.DEFAULT_DEVTOOL = 'cheap-module-source-map';
|
|
5
|
+
exports.DEFAULT_OUTPUT_PATH = 'dist';
|
|
6
|
+
exports.MFSU_NAME = 'MFSU';
|
|
7
|
+
var MESSAGE_TYPE;
|
|
8
|
+
(function (MESSAGE_TYPE) {
|
|
9
|
+
MESSAGE_TYPE["ok"] = "ok";
|
|
10
|
+
MESSAGE_TYPE["warnings"] = "warnings";
|
|
11
|
+
MESSAGE_TYPE["errors"] = "errors";
|
|
12
|
+
MESSAGE_TYPE["hash"] = "hash";
|
|
13
|
+
MESSAGE_TYPE["stillOk"] = "still-ok";
|
|
14
|
+
MESSAGE_TYPE["invalid"] = "invalid";
|
|
15
|
+
})(MESSAGE_TYPE = exports.MESSAGE_TYPE || (exports.MESSAGE_TYPE = {}));
|
package/dist/dev.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IConfig } from './types';
|
|
2
|
+
interface IOpts {
|
|
3
|
+
afterMiddlewares?: any[];
|
|
4
|
+
beforeMiddlewares?: any[];
|
|
5
|
+
onDevCompileDone?: Function;
|
|
6
|
+
port?: number;
|
|
7
|
+
host?: string;
|
|
8
|
+
chainWebpack?: Function;
|
|
9
|
+
modifyWebpackConfig?: Function;
|
|
10
|
+
beforeBabelPlugins?: any[];
|
|
11
|
+
beforeBabelPresets?: any[];
|
|
12
|
+
extraBabelPlugins?: any[];
|
|
13
|
+
extraBabelPresets?: any[];
|
|
14
|
+
cwd: string;
|
|
15
|
+
config: IConfig;
|
|
16
|
+
entry: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export declare function dev(opts: IOpts): Promise<void>;
|
|
19
|
+
export {};
|
package/dist/dev.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.dev = void 0;
|
|
16
|
+
const mfsu_1 = require("@umijs/mfsu");
|
|
17
|
+
const webpack_1 = __importDefault(require("../compiled/webpack"));
|
|
18
|
+
const config_1 = require("./config/config");
|
|
19
|
+
const constants_1 = require("./constants");
|
|
20
|
+
const server_1 = require("./server/server");
|
|
21
|
+
const types_1 = require("./types");
|
|
22
|
+
function dev(opts) {
|
|
23
|
+
var _a;
|
|
24
|
+
var _b;
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const enableMFSU = opts.config.mfsu !== false;
|
|
27
|
+
let mfsu = null;
|
|
28
|
+
if (enableMFSU) {
|
|
29
|
+
mfsu = new mfsu_1.MFSU({
|
|
30
|
+
implementor: webpack_1.default,
|
|
31
|
+
buildDepWithESBuild: (_a = opts.config.mfsu) === null || _a === void 0 ? void 0 : _a.esbuild,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const webpackConfig = yield (0, config_1.getConfig)({
|
|
35
|
+
cwd: opts.cwd,
|
|
36
|
+
env: types_1.Env.development,
|
|
37
|
+
entry: opts.entry,
|
|
38
|
+
userConfig: opts.config,
|
|
39
|
+
extraBabelPlugins: [
|
|
40
|
+
...(opts.beforeBabelPlugins || []),
|
|
41
|
+
...((mfsu === null || mfsu === void 0 ? void 0 : mfsu.getBabelPlugins()) || []),
|
|
42
|
+
...(opts.extraBabelPlugins || []),
|
|
43
|
+
],
|
|
44
|
+
extraBabelPresets: [
|
|
45
|
+
...(opts.beforeBabelPresets || []),
|
|
46
|
+
...(opts.extraBabelPresets || []),
|
|
47
|
+
],
|
|
48
|
+
chainWebpack: opts.chainWebpack,
|
|
49
|
+
modifyWebpackConfig: opts.modifyWebpackConfig,
|
|
50
|
+
hmr: true,
|
|
51
|
+
analyze: process.env.ANALYZE,
|
|
52
|
+
});
|
|
53
|
+
const depConfig = yield (0, config_1.getConfig)({
|
|
54
|
+
cwd: opts.cwd,
|
|
55
|
+
env: types_1.Env.development,
|
|
56
|
+
entry: opts.entry,
|
|
57
|
+
userConfig: opts.config,
|
|
58
|
+
hash: true,
|
|
59
|
+
staticPathPrefix: mfsu_1.MF_DEP_PREFIX,
|
|
60
|
+
name: constants_1.MFSU_NAME,
|
|
61
|
+
});
|
|
62
|
+
(_b = webpackConfig.resolve).alias || (_b.alias = {});
|
|
63
|
+
// TODO: REMOVE ME
|
|
64
|
+
['@umijs/utils/compiled/strip-ansi', 'react-error-overlay'].forEach((dep) => {
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
webpackConfig.resolve.alias[dep] = require.resolve(dep);
|
|
67
|
+
});
|
|
68
|
+
mfsu === null || mfsu === void 0 ? void 0 : mfsu.setWebpackConfig({
|
|
69
|
+
config: webpackConfig,
|
|
70
|
+
depConfig: depConfig,
|
|
71
|
+
});
|
|
72
|
+
yield (0, server_1.createServer)({
|
|
73
|
+
webpackConfig,
|
|
74
|
+
userConfig: opts.config,
|
|
75
|
+
cwd: opts.cwd,
|
|
76
|
+
beforeMiddlewares: [
|
|
77
|
+
...((mfsu === null || mfsu === void 0 ? void 0 : mfsu.getMiddlewares()) || []),
|
|
78
|
+
...(opts.beforeMiddlewares || []),
|
|
79
|
+
],
|
|
80
|
+
port: opts.port,
|
|
81
|
+
host: opts.host,
|
|
82
|
+
afterMiddlewares: [...(opts.afterMiddlewares || [])],
|
|
83
|
+
onDevCompileDone: opts.onDevCompileDone,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
exports.dev = dev;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./build"), exports);
|
|
14
|
+
__exportStar(require("./config/config"), exports);
|
|
15
|
+
__exportStar(require("./dev"), exports);
|
|
16
|
+
__exportStar(require("./schema"), exports);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
// MIT: https://github.com/gregberge/svgr/blob/main/packages/webpack/src/index.ts
|
|
16
|
+
// TODO: prebuild @svgr/core @svgr/plugin-jsx @svgr/plugin-svgo
|
|
17
|
+
const core_1 = require("@svgr/core");
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const plugin_jsx_1 = __importDefault(require("@svgr/plugin-jsx"));
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
const plugin_svgo_1 = __importDefault(require("@svgr/plugin-svgo"));
|
|
22
|
+
const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
|
|
23
|
+
const path_1 = require("path");
|
|
24
|
+
const util_1 = require("util");
|
|
25
|
+
const tranformSvg = (0, util_1.callbackify)((contents, options, state) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
const jsCode = yield (0, core_1.transform)(contents, options, state);
|
|
27
|
+
const result = yield (0, esbuild_1.transform)(jsCode, {
|
|
28
|
+
loader: 'tsx',
|
|
29
|
+
target: 'es2015',
|
|
30
|
+
});
|
|
31
|
+
if (!(result === null || result === void 0 ? void 0 : result.code)) {
|
|
32
|
+
throw new Error(`Error while transforming using Esbuild`);
|
|
33
|
+
}
|
|
34
|
+
return result.code;
|
|
35
|
+
}));
|
|
36
|
+
function svgrLoader(contents) {
|
|
37
|
+
this.cacheable && this.cacheable();
|
|
38
|
+
const callback = this.async();
|
|
39
|
+
const options = this.getOptions();
|
|
40
|
+
const previousExport = (() => {
|
|
41
|
+
if (contents.startsWith('export '))
|
|
42
|
+
return contents;
|
|
43
|
+
const exportMatches = contents.match(/^module.exports\s*=\s*(.*)/);
|
|
44
|
+
return exportMatches ? `export default ${exportMatches[1]}` : null;
|
|
45
|
+
})();
|
|
46
|
+
const state = {
|
|
47
|
+
caller: {
|
|
48
|
+
name: 'svgr-loader',
|
|
49
|
+
previousExport,
|
|
50
|
+
defaultPlugins: [plugin_svgo_1.default, plugin_jsx_1.default],
|
|
51
|
+
},
|
|
52
|
+
filePath: (0, path_1.normalize)(this.resourcePath),
|
|
53
|
+
};
|
|
54
|
+
if (!previousExport) {
|
|
55
|
+
tranformSvg(contents, options, state, callback);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.fs.readFile(this.resourcePath, (err, result) => {
|
|
59
|
+
if (err) {
|
|
60
|
+
callback(err);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
tranformSvg(String(result), options, state, callback);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.default = svgrLoader;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Compilation, Compiler } from '@umijs/bundler-webpack/compiled/webpack';
|
|
2
|
+
interface IOpts {
|
|
3
|
+
sourcemap?: any;
|
|
4
|
+
}
|
|
5
|
+
declare class ESBuildCSSMinifyPlugin {
|
|
6
|
+
options: IOpts;
|
|
7
|
+
constructor(options?: IOpts);
|
|
8
|
+
apply(compiler: Compiler): void;
|
|
9
|
+
transformAssets(compilation: Compilation): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export default ESBuildCSSMinifyPlugin;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
|
|
13
|
+
const webpack_sources_1 = require("@umijs/bundler-webpack/compiled/webpack-sources");
|
|
14
|
+
const version = require('../../package.json');
|
|
15
|
+
const PLUGIN_NAME = 'ESBuildCSSMinifyPlugin';
|
|
16
|
+
const RE_CSS_FILE = /\.css(\?.*)?$/i;
|
|
17
|
+
class ESBuildCSSMinifyPlugin {
|
|
18
|
+
constructor(options = {}) {
|
|
19
|
+
this.options = options;
|
|
20
|
+
}
|
|
21
|
+
apply(compiler) {
|
|
22
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
23
|
+
compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash) => {
|
|
24
|
+
hash.update(JSON.stringify({
|
|
25
|
+
version,
|
|
26
|
+
options: this.options,
|
|
27
|
+
}));
|
|
28
|
+
});
|
|
29
|
+
compilation.hooks.processAssets.tapPromise({
|
|
30
|
+
name: PLUGIN_NAME,
|
|
31
|
+
stage: 400,
|
|
32
|
+
additionalAssets: true,
|
|
33
|
+
}, () => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
yield this.transformAssets(compilation);
|
|
35
|
+
}));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
transformAssets(compilation) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const { options: { devtool }, } = compilation.compiler;
|
|
41
|
+
const sourcemap = this.options.sourcemap === undefined
|
|
42
|
+
? devtool && devtool
|
|
43
|
+
: this.options.sourcemap;
|
|
44
|
+
const assets = compilation.getAssets().filter((asset) => {
|
|
45
|
+
return !asset.info.minimized && RE_CSS_FILE.test(asset.name);
|
|
46
|
+
});
|
|
47
|
+
yield Promise.all(assets.map((asset) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const { source, map } = asset.source.sourceAndMap();
|
|
49
|
+
const sourceAsString = source.toString();
|
|
50
|
+
const result = yield (0, esbuild_1.transform)(sourceAsString, {
|
|
51
|
+
loader: 'css',
|
|
52
|
+
sourcemap,
|
|
53
|
+
sourcefile: asset.name,
|
|
54
|
+
minify: true,
|
|
55
|
+
});
|
|
56
|
+
compilation.updateAsset(asset.name,
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
sourcemap
|
|
59
|
+
? new webpack_sources_1.SourceMapSource(result.code, asset.name, result.map, sourceAsString, map, true)
|
|
60
|
+
: new webpack_sources_1.RawSource(result.code), Object.assign(Object.assign({}, asset.info), { minimized: true }));
|
|
61
|
+
})));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.default = ESBuildCSSMinifyPlugin;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Compiler, ProgressPlugin } from '@umijs/bundler-webpack/compiled/webpack';
|
|
2
|
+
interface IOpts {
|
|
3
|
+
name?: string;
|
|
4
|
+
}
|
|
5
|
+
declare class UmiProgressPlugin extends ProgressPlugin {
|
|
6
|
+
options: IOpts;
|
|
7
|
+
constructor(options?: IOpts);
|
|
8
|
+
apply(compiler: Compiler): void;
|
|
9
|
+
updateProgress(opts: {
|
|
10
|
+
percent: number;
|
|
11
|
+
message: string;
|
|
12
|
+
details: any[];
|
|
13
|
+
}): void;
|
|
14
|
+
}
|
|
15
|
+
export default UmiProgressPlugin;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
|
|
4
|
+
const utils_1 = require("@umijs/utils");
|
|
5
|
+
const PLUGIN_NAME = 'ProgressPlugin';
|
|
6
|
+
class UmiProgressPlugin extends webpack_1.ProgressPlugin {
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
super({ activeModules: true });
|
|
9
|
+
this.options = options;
|
|
10
|
+
this.handler = (percent, message, ...details) => {
|
|
11
|
+
this.updateProgress({ percent, message, details });
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
apply(compiler) {
|
|
15
|
+
compiler.hooks.invalid.tap(PLUGIN_NAME, () => {
|
|
16
|
+
utils_1.logger.wait('compiling...');
|
|
17
|
+
});
|
|
18
|
+
compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
|
|
19
|
+
const { errors, warnings } = stats.toJson({
|
|
20
|
+
all: false,
|
|
21
|
+
warnings: true,
|
|
22
|
+
errors: true,
|
|
23
|
+
colors: true,
|
|
24
|
+
});
|
|
25
|
+
const hasErrors = !!(errors === null || errors === void 0 ? void 0 : errors.length);
|
|
26
|
+
const hasWarnings = !!(warnings === null || warnings === void 0 ? void 0 : warnings.length);
|
|
27
|
+
hasWarnings;
|
|
28
|
+
if (hasErrors) {
|
|
29
|
+
errors.forEach((error) => {
|
|
30
|
+
utils_1.logger.error(`${error.moduleName}${error.loc ? `:${error.loc}` : ''}`);
|
|
31
|
+
console.log(error.message);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const prefix = this.options.name ? `${this.options.name} ` : '';
|
|
36
|
+
utils_1.logger.event(`${prefix}compiled successfully in ${stats.endTime - stats.startTime} ms (${stats.compilation.modules.size} modules)`);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
updateProgress(opts) {
|
|
41
|
+
opts;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = UmiProgressPlugin;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const PLUGIN_NAME = 'SamplePlugin';
|
|
4
|
+
class _SamplePlugin {
|
|
5
|
+
constructor(options = {}) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
apply(compiler) {
|
|
9
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
10
|
+
compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_) => { });
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.default = _SamplePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// MIT: copy from https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack/require-hook.ts
|
|
3
|
+
// sync injects a hook for webpack and webpack/... requires to use the internal ncc webpack version
|
|
4
|
+
// this is in order for userland plugins to attach to the same webpack instance as umi
|
|
5
|
+
// the individual compiled modules are as defined for the compilation in bundles/webpack/packages/*
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
const deepImports_json_1 = __importDefault(require("@umijs/bundler-webpack/compiled/webpack/deepImports.json"));
|
|
12
|
+
const hookPropertyMap = new Map([
|
|
13
|
+
['webpack', '@umijs/bundler-webpack/compiled/webpack'],
|
|
14
|
+
['webpack/package', '@umijs/bundler-webpack/compiled/webpack/package'],
|
|
15
|
+
['webpack/package.json', '@umijs/bundler-webpack/compiled/webpack/package'],
|
|
16
|
+
['webpack/lib/webpack', '@umijs/bundler-webpack/compiled/webpack'],
|
|
17
|
+
['webpack/lib/webpack.js', '@umijs/bundler-webpack/compiled/webpack'],
|
|
18
|
+
]);
|
|
19
|
+
deepImports_json_1.default.forEach((item) => {
|
|
20
|
+
const name = item.split('/').unshift();
|
|
21
|
+
hookPropertyMap.set(item, `@umijs/bundler-webpack/compiled/webpack/${name}`);
|
|
22
|
+
hookPropertyMap.set(`${item}.js`, `@umijs/bundler-webpack/compiled/webpack/${name}`);
|
|
23
|
+
});
|
|
24
|
+
const mod = require('module');
|
|
25
|
+
const resolveFilename = mod._resolveFilename;
|
|
26
|
+
mod._resolveFilename = function (request, parent, isMain, options) {
|
|
27
|
+
const hookResolved = hookPropertyMap.get(request);
|
|
28
|
+
if (hookResolved)
|
|
29
|
+
request = hookResolved;
|
|
30
|
+
return resolveFilename.call(mod, request, parent, isMain, options);
|
|
31
|
+
};
|
package/dist/schema.d.ts
ADDED
package/dist/schema.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSchemas = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
const options = [
|
|
6
|
+
'cheap-source-map',
|
|
7
|
+
'cheap-eval-source-map',
|
|
8
|
+
'cheap-hidden-source-map',
|
|
9
|
+
'cheap-inline-source-map',
|
|
10
|
+
'cheap-module-source-map',
|
|
11
|
+
'cheap-module-eval-source-map',
|
|
12
|
+
'cheap-module-hidden-source-map',
|
|
13
|
+
'cheap-module-inline-source-map',
|
|
14
|
+
'eval',
|
|
15
|
+
'eval-source-map',
|
|
16
|
+
'source-map',
|
|
17
|
+
'hidden-source-map',
|
|
18
|
+
'inline-source-map',
|
|
19
|
+
];
|
|
20
|
+
const DEVTOOL_REGEX = new RegExp('^' + // start of string
|
|
21
|
+
'(#@|@|#)?' + // maybe one of the pragmas
|
|
22
|
+
`(${options.join('$|')})`);
|
|
23
|
+
function getSchemas() {
|
|
24
|
+
return {
|
|
25
|
+
alias: (Joi) => Joi.object(),
|
|
26
|
+
autoCSSModules: (Joi) => Joi.boolean(),
|
|
27
|
+
chainWebpack: (Joi) => Joi.function(),
|
|
28
|
+
copy: (Joi) => Joi.array().items(Joi.alternatives().try(Joi.object({
|
|
29
|
+
from: Joi.string(),
|
|
30
|
+
to: Joi.string(),
|
|
31
|
+
}), Joi.string())),
|
|
32
|
+
cssLoader: (Joi) => Joi.object(),
|
|
33
|
+
cssLoaderModules: (Joi) => Joi.object(),
|
|
34
|
+
cssMinifier: (Joi) => Joi.string().valid(types_1.CSSMinifier.cssnano, types_1.CSSMinifier.esbuild, types_1.CSSMinifier.none),
|
|
35
|
+
cssMinifierOptions: (Joi) => Joi.object(),
|
|
36
|
+
define: (Joi) => Joi.object(),
|
|
37
|
+
depTranspiler: (Joi) => Joi.string().valid(types_1.Transpiler.babel, types_1.Transpiler.esbuild, types_1.Transpiler.swc, types_1.Transpiler.none),
|
|
38
|
+
devtool: (Joi) => Joi.alternatives().try(Joi.string().regex(DEVTOOL_REGEX), Joi.boolean()),
|
|
39
|
+
externals: (Joi) => Joi.alternatives().try(Joi.object().pattern(/.+/, [
|
|
40
|
+
Joi.string(),
|
|
41
|
+
Joi.boolean(),
|
|
42
|
+
Joi.object().pattern(/.+/, [Joi.string(), Joi.boolean()]),
|
|
43
|
+
]), Joi.string(), Joi.func().arity(3), Joi.object().regex()),
|
|
44
|
+
extraBabelPlugins: (Joi) => Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object()))),
|
|
45
|
+
extraBabelPresets: (Joi) => Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object()))),
|
|
46
|
+
extraPostCSSPlugins: (Joi) => Joi.array(),
|
|
47
|
+
fastRefresh: (Joi) => Joi.boolean(),
|
|
48
|
+
hash: (Joi) => Joi.boolean(),
|
|
49
|
+
ignoreMomentLocale: (Joi) => Joi.boolean(),
|
|
50
|
+
jsMinifier: (Joi) => Joi.string().valid(types_1.JSMinifier.esbuild, types_1.JSMinifier.swc, types_1.JSMinifier.terser, types_1.JSMinifier.uglifyJs, types_1.JSMinifier.none),
|
|
51
|
+
jsMinifierOptions: (Joi) => Joi.object(),
|
|
52
|
+
lessLoader: (Joi) => Joi.object(),
|
|
53
|
+
mfsu: (Joi) => Joi.alternatives(Joi.object({
|
|
54
|
+
esbuild: Joi.boolean(),
|
|
55
|
+
}), Joi.boolean()),
|
|
56
|
+
outputPath: (Joi) => Joi.string(),
|
|
57
|
+
postcssLoader: (Joi) => Joi.object(),
|
|
58
|
+
proxy: (Joi) => Joi.object(),
|
|
59
|
+
publicPath: (Joi) => Joi.string(),
|
|
60
|
+
purgeCSS: (Joi) => Joi.object(),
|
|
61
|
+
sassLoader: (Joi) => Joi.object(),
|
|
62
|
+
srcTranspiler: (Joi) => Joi.string().valid(types_1.Transpiler.babel, types_1.Transpiler.esbuild, types_1.Transpiler.swc, types_1.Transpiler.none),
|
|
63
|
+
styleLoader: (Joi) => Joi.object(),
|
|
64
|
+
svgr: (Joi) => Joi.object(),
|
|
65
|
+
svgo: (Joi) => Joi.alternatives().try(Joi.object(), Joi.boolean()),
|
|
66
|
+
targets: (Joi) => Joi.object(),
|
|
67
|
+
writeToDisk: (Joi) => Joi.boolean(),
|
|
68
|
+
esm: (Joi) => Joi.object(),
|
|
69
|
+
theme: (Joi) => Joi.object(),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
exports.getSchemas = getSchemas;
|