@umijs/bundler-webpack 4.0.0-beta.8 → 4.0.0-canary-20240513.3
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/client/client/client.js +255 -167
- package/client/constants.d.ts +15 -0
- package/client/constants.js +30 -12
- package/client/utils/formatWebpackMessages.d.ts +12 -0
- package/client/utils/formatWebpackMessages.js +87 -86
- package/compiled/autoprefixer/browserslist/index.d.ts +33 -7
- package/compiled/autoprefixer/index.js +3 -3
- package/compiled/autoprefixer/package.json +1 -1
- package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/comment.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/container.d.ts +2 -2
- package/compiled/autoprefixer/postcss/lib/css-syntax-error.d.ts +55 -8
- package/compiled/autoprefixer/postcss/lib/declaration.d.ts +2 -2
- package/compiled/autoprefixer/postcss/lib/input.d.ts +26 -6
- package/compiled/autoprefixer/postcss/lib/lazy-result.d.ts +11 -10
- package/compiled/autoprefixer/postcss/lib/no-work-result.d.ts +37 -0
- package/compiled/autoprefixer/postcss/lib/node.d.ts +38 -4
- package/compiled/autoprefixer/postcss/lib/postcss.d.ts +31 -30
- package/compiled/autoprefixer/postcss/lib/processor.d.ts +6 -5
- package/compiled/autoprefixer/postcss/lib/result.d.ts +3 -2
- package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/warning.d.ts +37 -3
- package/compiled/autoprefixer/source-map-js/source-map.d.ts +99 -82
- package/compiled/babel-loader/index.js +8 -2
- package/compiled/babel-loader/package.json +1 -1
- package/compiled/copy-webpack-plugin/939.index.js +1171 -0
- package/compiled/copy-webpack-plugin/index.js +16 -10
- package/compiled/copy-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/index.js +8 -2
- package/compiled/css-minimizer-webpack-plugin/minify.js +23 -22
- package/compiled/css-minimizer-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/utils.js +305 -54
- package/compiled/cssnano/index.js +12 -11
- package/compiled/cssnano/package.json +1 -1
- package/compiled/express.d.ts +2 -0
- package/compiled/file-loader/index.js +3 -0
- package/compiled/file-loader/package.json +1 -0
- package/compiled/less-loader/index.js +1 -1
- package/compiled/less-loader/package.json +1 -1
- package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +60 -46
- package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +10 -6
- package/compiled/mini-css-extract-plugin/index.js +10669 -10348
- package/compiled/mini-css-extract-plugin/loader.js +159 -100
- package/compiled/mini-css-extract-plugin/package.json +1 -1
- package/compiled/mini-css-extract-plugin/utils.js +88 -44
- package/compiled/postcss-loader/index.js +1 -1
- package/compiled/postcss-loader/package.json +1 -1
- package/compiled/sass-loader/index.js +1 -1
- package/compiled/sass-loader/package.json +1 -1
- package/compiled/sass-loader/sass.default.dart.js +4 -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/declarations/validate.d.ts +4 -4
- package/compiled/schema-utils/index.js +8 -2
- package/compiled/schema-utils/uri-js/dist/es5/uri.all.d.ts +59 -0
- package/compiled/style-loader/index.js +1 -1
- package/compiled/stylus-loader/LICENSE +20 -0
- package/compiled/stylus-loader/index.js +44 -0
- package/compiled/stylus-loader/package.json +1 -0
- package/compiled/terser/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +90 -0
- package/compiled/terser/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +12 -0
- package/compiled/terser/@jridgewell/gen-mapping/dist/types/types.d.ts +35 -0
- package/compiled/terser/@jridgewell/source-map/dist/types/source-map.d.ts +25 -0
- package/compiled/terser/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
- package/compiled/terser/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
- package/compiled/terser/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
- package/compiled/terser/index.js +1 -1
- package/compiled/terser/package.json +1 -1
- package/compiled/terser/tools/terser.d.ts +6 -3
- package/compiled/terser-webpack-plugin/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +16 -0
- package/compiled/terser-webpack-plugin/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +74 -0
- package/compiled/terser-webpack-plugin/@jridgewell/trace-mapping/dist/types/types.d.ts +92 -0
- package/compiled/terser-webpack-plugin/index.js +1390 -3693
- package/compiled/terser-webpack-plugin/jest-worker/build/types.d.ts +1 -0
- package/compiled/terser-webpack-plugin/minify.js +10 -3
- package/compiled/terser-webpack-plugin/package.json +1 -1
- package/compiled/terser-webpack-plugin/types/index.d.ts +186 -152
- package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
- package/compiled/terser-webpack-plugin/types/utils.d.ts +20 -24
- package/compiled/terser-webpack-plugin/utils.js +153 -34
- package/compiled/webpack/BasicEffectRulePlugin.js +1 -0
- package/compiled/webpack/BasicEvaluatedExpression.js +1 -0
- package/compiled/webpack/BasicMatcherRulePlugin.js +1 -0
- package/compiled/webpack/ExternalsPlugin.js +1 -0
- package/compiled/webpack/FetchCompileAsyncWasmPlugin.js +1 -0
- package/compiled/webpack/FetchCompileWasmPlugin.js +1 -0
- package/compiled/webpack/HotModuleReplacement.runtime.js +29 -14
- package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +4 -3
- package/compiled/webpack/LimitChunkCountPlugin.js +1 -0
- package/compiled/webpack/NodeTargetPlugin.js +1 -0
- package/compiled/webpack/NodeTemplatePlugin.js +1 -0
- package/compiled/webpack/ObjectMatcherRulePlugin.js +1 -0
- package/compiled/webpack/RuleSetCompiler.js +1 -0
- package/compiled/webpack/StringXor.js +1 -0
- package/compiled/webpack/UseEffectRulePlugin.js +1 -0
- package/compiled/webpack/WebWorkerTemplatePlugin.js +1 -0
- package/compiled/webpack/deepImports.json +15 -1
- package/compiled/webpack/index.js +26404 -10329
- package/compiled/webpack/json-schema/index.d.ts +8 -1
- package/compiled/webpack/lazy-compilation-node.js +10 -0
- package/compiled/webpack/lazy-compilation-web.js +9 -0
- package/compiled/webpack/types.d.ts +823 -287
- package/compiled/webpack-5-chain/index.js +1 -1
- package/compiled/webpack-5-chain/package.json +1 -1
- package/compiled/webpack-5-chain/types/index.d.ts +76 -20
- package/compiled/webpack-bundle-analyzer/index.js +7 -6
- package/compiled/webpack-bundle-analyzer/package.json +1 -1
- package/compiled/webpack-bundle-analyzer/public/viewer.js +2 -2
- package/compiled/webpack-bundle-analyzer/public/viewer.js.map +1 -1
- package/compiled/webpack-dev-middleware/index.js +12 -5
- package/compiled/webpack-dev-middleware/package.json +1 -1
- package/compiled/{tapable → webpack-manifest-plugin}/LICENSE +2 -2
- package/compiled/webpack-manifest-plugin/index.js +1 -0
- package/compiled/webpack-manifest-plugin/package.json +1 -0
- package/compiled/webpack-sources/index.js +1 -1
- package/compiled/{express → webpackbar}/LICENSE +1 -5
- package/compiled/webpackbar/dist/index.d.ts +121 -0
- package/compiled/webpackbar/index.js +7 -0
- package/compiled/webpackbar/package.json +1 -0
- package/compiled/ws/LICENSE +13 -12
- package/compiled/ws/index.d.ts +74 -35
- package/compiled/ws/index.js +1 -1
- package/compiled/ws/package.json +1 -1
- package/dist/build.d.ts +8 -3
- package/dist/build.js +147 -68
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +84 -81
- package/dist/config/_sampleFeature.js +33 -20
- package/dist/config/assetRules.js +46 -55
- package/dist/config/bundleAnalyzerPlugin.js +41 -28
- package/dist/config/compressPlugin.js +125 -74
- package/dist/config/config.d.ts +11 -2
- package/dist/config/config.js +235 -172
- package/dist/config/copyPlugin.js +61 -47
- package/dist/config/cssRules.js +162 -95
- package/dist/config/definePlugin.d.ts +2 -0
- package/dist/config/definePlugin.js +59 -39
- package/dist/config/detectCssModulesInDependence.d.ts +10 -0
- package/dist/config/detectCssModulesInDependence.js +151 -0
- package/dist/config/detectDeadCode.d.ts +12 -0
- package/dist/config/detectDeadCode.js +191 -0
- package/dist/config/detectDeadCodePlugin.d.ts +9 -0
- package/dist/config/detectDeadCodePlugin.js +82 -0
- package/dist/config/fastRefreshPlugin.js +46 -31
- package/dist/config/forkTSCheckerPlugin.d.ts +11 -0
- package/dist/config/forkTSCheckerPlugin.js +49 -0
- package/dist/config/harmonyLinkingErrorPlugin.d.ts +6 -0
- package/dist/config/harmonyLinkingErrorPlugin.js +53 -0
- package/dist/config/ignorePlugin.js +38 -25
- package/dist/config/javaScriptRules.d.ts +2 -0
- package/dist/config/javaScriptRules.js +186 -150
- package/dist/config/manifestPlugin.d.ts +11 -0
- package/dist/config/manifestPlugin.js +40 -0
- package/dist/config/miniCSSExtractPlugin.d.ts +1 -0
- package/dist/config/miniCSSExtractPlugin.js +52 -31
- package/dist/config/nodePolyfill.js +49 -32
- package/dist/config/nodePrefixPlugin.d.ts +11 -0
- package/dist/config/nodePrefixPlugin.js +38 -0
- package/dist/config/progressPlugin.js +50 -24
- package/dist/config/purgecssWebpackPlugin.js +41 -30
- package/dist/config/speedMeasureWebpackPlugin.js +56 -31
- package/dist/config/ssrPlugin.d.ts +11 -0
- package/dist/config/ssrPlugin.js +98 -0
- package/dist/config/svgRules.d.ts +1 -0
- package/dist/config/svgRules.js +68 -54
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +59 -15
- package/dist/dev.d.ts +23 -3
- package/dist/dev.js +198 -81
- package/dist/index.d.ts +6 -2
- package/dist/index.js +31 -15
- package/dist/loader/svgr.d.ts +4 -0
- package/dist/loader/svgr.js +84 -0
- package/dist/loader/swc.d.ts +4 -0
- package/dist/loader/swc.js +149 -0
- package/dist/parcelCSS.d.ts +2 -0
- package/dist/parcelCSS.js +39 -0
- package/dist/plugins/EsbuildMinifyFix.d.ts +8 -0
- package/dist/plugins/EsbuildMinifyFix.js +136 -0
- package/dist/plugins/ProgressPlugin.js +68 -43
- package/dist/plugins/RuntimePublicPathPlugin.d.ts +4 -0
- package/dist/plugins/RuntimePublicPathPlugin.js +45 -0
- package/dist/plugins/_SamplePlugin.d.ts +1 -1
- package/dist/plugins/_SamplePlugin.js +37 -14
- package/dist/requireHook.js +44 -27
- package/dist/schema.d.ts +4 -3
- package/dist/schema.js +175 -69
- package/dist/server/server.d.ts +4 -3
- package/dist/server/server.js +219 -154
- package/dist/server/ws.d.ts +8 -3
- package/dist/server/ws.js +72 -38
- package/dist/swcPlugins/autoCSSModules.d.ts +11 -2
- package/dist/swcPlugins/autoCSSModules.js +60 -32
- package/dist/swcPlugins/changeImportFromString.d.ts +2 -0
- package/dist/swcPlugins/changeImportFromString.js +32 -0
- package/dist/swcPlugins/lockCoreJS.d.ts +6 -0
- package/dist/swcPlugins/lockCoreJS.js +56 -0
- package/dist/types.d.ts +53 -9
- package/dist/types.js +61 -29
- package/dist/utils/browsersList.js +31 -8
- package/dist/utils/depMatch.js +65 -39
- package/dist/utils/formatWebpackMessages.js +119 -91
- package/dist/utils/getEsBuildTarget.d.ts +7 -0
- package/dist/utils/getEsBuildTarget.js +46 -0
- package/dist/utils/pkgUpContainsName.d.ts +1 -0
- package/dist/utils/pkgUpContainsName.js +50 -0
- package/package.json +89 -81
- package/compiled/@svgr/webpack/.svgo.yml +0 -75
- package/compiled/@svgr/webpack/LICENSE +0 -7
- package/compiled/@svgr/webpack/index.js +0 -343
- package/compiled/@svgr/webpack/package.json +0 -1
- package/compiled/css-loader/api.js +0 -102
- package/compiled/css-loader/getUrl.js +0 -29
- package/compiled/css-loader/index.js +0 -2
- package/compiled/css-loader/noSourceMaps.js +0 -5
- package/compiled/css-loader/package.json +0 -1
- package/compiled/css-loader/sourceMaps.js +0 -22
- package/compiled/express/body-parser/index.d.ts +0 -104
- package/compiled/express/connect/index.d.ts +0 -93
- package/compiled/express/express-serve-static-core/index.d.ts +0 -1252
- package/compiled/express/index.d.ts +0 -133
- package/compiled/express/index.js +0 -338
- package/compiled/express/mime/index.d.ts +0 -35
- package/compiled/express/package.json +0 -1
- package/compiled/express/qs/index.d.ts +0 -62
- package/compiled/express/range-parser/index.d.ts +0 -35
- package/compiled/express/serve-static/index.d.ts +0 -108
- package/compiled/http-proxy-middleware/LICENSE +0 -22
- package/compiled/http-proxy-middleware/dist/index.d.ts +0 -4
- package/compiled/http-proxy-middleware/dist/types.d.ts +0 -54
- package/compiled/http-proxy-middleware/http-proxy/index.d.ts +0 -226
- package/compiled/http-proxy-middleware/index.js +0 -66
- package/compiled/http-proxy-middleware/package.json +0 -1
- package/compiled/less/index.js +0 -31
- package/compiled/less/package.json +0 -1
- package/compiled/react-refresh/index.js +0 -19
- package/compiled/swc-loader/LICENSE +0 -25
- package/compiled/swc-loader/index.js +0 -1
- package/compiled/swc-loader/package.json +0 -1
- package/compiled/tapable/index.js +0 -1
- package/compiled/tapable/package.json +0 -1
- package/compiled/tapable/tapable.d.ts +0 -116
- package/dist/build.d.ts.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js +0 -239
- package/dist/config/_sampleFeature.d.ts.map +0 -1
- package/dist/config/assetRules.d.ts.map +0 -1
- package/dist/config/bundleAnalyzerPlugin.d.ts.map +0 -1
- package/dist/config/compressPlugin.d.ts.map +0 -1
- package/dist/config/config.d.ts.map +0 -1
- package/dist/config/copyPlugin.d.ts.map +0 -1
- package/dist/config/cssRules.d.ts.map +0 -1
- package/dist/config/definePlugin.d.ts.map +0 -1
- package/dist/config/fastRefreshPlugin.d.ts.map +0 -1
- package/dist/config/ignorePlugin.d.ts.map +0 -1
- package/dist/config/javaScriptRules.d.ts.map +0 -1
- package/dist/config/miniCSSExtractPlugin.d.ts.map +0 -1
- package/dist/config/nodePolyfill.d.ts.map +0 -1
- package/dist/config/progressPlugin.d.ts.map +0 -1
- package/dist/config/purgecssWebpackPlugin.d.ts.map +0 -1
- package/dist/config/speedMeasureWebpackPlugin.d.ts.map +0 -1
- package/dist/config/svgRules.d.ts.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/dev.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/plugins/ESBuildCSSMinifyPlugin.d.ts +0 -11
- package/dist/plugins/ESBuildCSSMinifyPlugin.d.ts.map +0 -1
- package/dist/plugins/ESBuildCSSMinifyPlugin.js +0 -65
- package/dist/plugins/ProgressPlugin.d.ts.map +0 -1
- package/dist/plugins/_SamplePlugin.d.ts.map +0 -1
- package/dist/requireHook.d.ts.map +0 -1
- package/dist/schema.d.ts.map +0 -1
- package/dist/server/server.d.ts.map +0 -1
- package/dist/server/ws.d.ts.map +0 -1
- package/dist/swcPlugins/autoCSSModules.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/browsersList.d.ts.map +0 -1
- package/dist/utils/depMatch.d.ts.map +0 -1
- package/dist/utils/formatWebpackMessages.d.ts.map +0 -1
- /package/{dist → client}/client/client.d.ts +0 -0
- /package/compiled/{css-loader → file-loader}/LICENSE +0 -0
package/dist/config/cssRules.js
CHANGED
|
@@ -1,98 +1,165 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/config/cssRules.ts
|
|
30
|
+
var cssRules_exports = {};
|
|
31
|
+
__export(cssRules_exports, {
|
|
32
|
+
addCSSRules: () => addCSSRules
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(cssRules_exports);
|
|
35
|
+
var import_utils = require("@umijs/utils");
|
|
36
|
+
async function addCSSRules(opts) {
|
|
37
|
+
const { config, userConfig } = opts;
|
|
38
|
+
const rulesConfig = [
|
|
39
|
+
{ name: "css", test: /\.css(\?.*)?$/ },
|
|
40
|
+
{
|
|
41
|
+
name: "less",
|
|
42
|
+
test: /\.less(\?.*)?$/,
|
|
43
|
+
loader: require.resolve("@umijs/bundler-webpack/compiled/less-loader"),
|
|
44
|
+
loaderOptions: {
|
|
45
|
+
implementation: require.resolve("@umijs/bundler-utils/compiled/less"),
|
|
46
|
+
lessOptions: {
|
|
47
|
+
modifyVars: userConfig.theme,
|
|
48
|
+
javascriptEnabled: true,
|
|
49
|
+
...userConfig.lessLoader
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "sass",
|
|
55
|
+
test: /\.(sass|scss)(\?.*)?$/,
|
|
56
|
+
loader: require.resolve("@umijs/bundler-webpack/compiled/sass-loader"),
|
|
57
|
+
loaderOptions: userConfig.sassLoader || {}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "stylus",
|
|
61
|
+
test: /\.(styl|stylus)(\?.*)?$/,
|
|
62
|
+
loader: require.resolve("@umijs/bundler-webpack/compiled/stylus-loader"),
|
|
63
|
+
loaderOptions: userConfig.stylusLoader || {}
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
const cssPublicPath = userConfig.cssPublicPath || "./";
|
|
67
|
+
for (const { name, test, loader, loaderOptions } of rulesConfig) {
|
|
68
|
+
const rule = config.module.rule(name);
|
|
69
|
+
const nestRulesConfig = [
|
|
70
|
+
userConfig.autoCSSModules && {
|
|
71
|
+
rule: rule.test(test).oneOf("css-modules").resourceQuery(/modules/),
|
|
72
|
+
isAutoCSSModuleRule: true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
rule: rule.test(test).oneOf("css").sideEffects(true),
|
|
76
|
+
isAutoCSSModuleRule: false
|
|
77
|
+
}
|
|
78
|
+
].filter(Boolean);
|
|
79
|
+
for (const { rule: rule2, isAutoCSSModuleRule } of nestRulesConfig) {
|
|
80
|
+
if (userConfig.styleLoader) {
|
|
81
|
+
rule2.use("style-loader").loader(
|
|
82
|
+
require.resolve("@umijs/bundler-webpack/compiled/style-loader")
|
|
83
|
+
).options({ base: 0, esModule: true, ...userConfig.styleLoader });
|
|
84
|
+
} else {
|
|
85
|
+
rule2.use("mini-css-extract-plugin").loader(
|
|
86
|
+
require.resolve("@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader")
|
|
87
|
+
).options({
|
|
88
|
+
publicPath: cssPublicPath,
|
|
89
|
+
emit: true,
|
|
90
|
+
esModule: true
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const getLocalIdent = userConfig.ssr && userConfig.ssr.compiler === "esbuild" ? getLocalIdentForSSR : void 0;
|
|
94
|
+
const localIdentName = "[local]___[hash:base64:5]";
|
|
95
|
+
let cssLoaderModulesConfig;
|
|
96
|
+
if (isAutoCSSModuleRule) {
|
|
97
|
+
cssLoaderModulesConfig = {
|
|
98
|
+
localIdentName,
|
|
99
|
+
...userConfig.cssLoaderModules,
|
|
100
|
+
getLocalIdent
|
|
101
|
+
};
|
|
102
|
+
} else if (userConfig.normalCSSLoaderModules) {
|
|
103
|
+
cssLoaderModulesConfig = {
|
|
104
|
+
localIdentName,
|
|
105
|
+
auto: true,
|
|
106
|
+
...userConfig.normalCSSLoaderModules,
|
|
107
|
+
getLocalIdent
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
rule2.use("css-loader").loader(require.resolve("css-loader")).options({
|
|
111
|
+
importLoaders: 1,
|
|
112
|
+
esModule: true,
|
|
113
|
+
url: {
|
|
114
|
+
filter: (url) => {
|
|
115
|
+
if (url.startsWith("/"))
|
|
116
|
+
return false;
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
import: true,
|
|
121
|
+
modules: cssLoaderModulesConfig,
|
|
122
|
+
...userConfig.cssLoader
|
|
123
|
+
});
|
|
124
|
+
rule2.use("postcss-loader").loader(
|
|
125
|
+
require.resolve("@umijs/bundler-webpack/compiled/postcss-loader")
|
|
126
|
+
).options({
|
|
127
|
+
postcssOptions: {
|
|
128
|
+
ident: "postcss",
|
|
129
|
+
plugins: [
|
|
130
|
+
require("@umijs/bundler-webpack/compiled/postcss-flexbugs-fixes"),
|
|
131
|
+
require("postcss-preset-env")({
|
|
132
|
+
browsers: opts.browsers,
|
|
133
|
+
autoprefixer: {
|
|
134
|
+
flexbox: "no-2009",
|
|
135
|
+
...userConfig.autoprefixer
|
|
136
|
+
},
|
|
137
|
+
stage: 3
|
|
138
|
+
})
|
|
139
|
+
].concat(userConfig.extraPostCSSPlugins || []),
|
|
140
|
+
...userConfig.postcssLoader
|
|
95
141
|
}
|
|
96
|
-
|
|
142
|
+
});
|
|
143
|
+
if (loader) {
|
|
144
|
+
rule2.use(`${name}-loader`).loader(loader).options(loaderOptions || {});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function ensureLastSlash(path) {
|
|
150
|
+
return path.endsWith("/") ? path : path + "/";
|
|
151
|
+
}
|
|
152
|
+
function getLocalIdentForSSR(context, localIdentName, localName, opt) {
|
|
153
|
+
const classIdent = ((0, import_utils.winPath)(context.resourcePath).replace(
|
|
154
|
+
(0, import_utils.winPath)(ensureLastSlash(opt.context)),
|
|
155
|
+
""
|
|
156
|
+
) + "@" + localName).trim();
|
|
157
|
+
let hash = Buffer.from(classIdent).toString("base64").replace(/=/g, "");
|
|
158
|
+
hash = hash.substring(hash.length - 5);
|
|
159
|
+
const result = localIdentName.replace(/\[local]/g, localName).replace(/\[hash[^\[]*?]/g, hash);
|
|
160
|
+
return result;
|
|
97
161
|
}
|
|
98
|
-
|
|
162
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
163
|
+
0 && (module.exports = {
|
|
164
|
+
addCSSRules
|
|
165
|
+
});
|
|
@@ -8,8 +8,10 @@ interface IOpts {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function resolveDefine(opts: {
|
|
10
10
|
define: any;
|
|
11
|
+
publicPath?: string;
|
|
11
12
|
}): {
|
|
12
13
|
'process.env': Record<string, any>;
|
|
14
|
+
'process.env.SSR_MANIFEST': string;
|
|
13
15
|
};
|
|
14
16
|
export declare function addDefinePlugin(opts: IOpts): Promise<void>;
|
|
15
17
|
export {};
|
|
@@ -1,45 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
8
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/config/definePlugin.ts
|
|
20
|
+
var definePlugin_exports = {};
|
|
21
|
+
__export(definePlugin_exports, {
|
|
22
|
+
addDefinePlugin: () => addDefinePlugin,
|
|
23
|
+
resolveDefine: () => resolveDefine
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(definePlugin_exports);
|
|
26
|
+
var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
|
|
27
|
+
var prefixRE = /^UMI_APP_/;
|
|
28
|
+
var ENV_SHOULD_PASS = ["NODE_ENV", "HMR", "SOCKET_SERVER", "ERROR_OVERLAY"];
|
|
16
29
|
function resolveDefine(opts) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
for (const key in env) {
|
|
24
|
-
env[key] = JSON.stringify(env[key]);
|
|
30
|
+
const env = {};
|
|
31
|
+
Object.keys(process.env).forEach((key) => {
|
|
32
|
+
if (prefixRE.test(key) || ENV_SHOULD_PASS.includes(key)) {
|
|
33
|
+
env[key] = process.env[key];
|
|
25
34
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
});
|
|
36
|
+
env.PUBLIC_PATH = opts.publicPath || "/";
|
|
37
|
+
for (const key in env) {
|
|
38
|
+
env[key] = JSON.stringify(env[key]);
|
|
39
|
+
}
|
|
40
|
+
const define = {};
|
|
41
|
+
if (opts.define) {
|
|
42
|
+
for (const key in opts.define) {
|
|
43
|
+
define[key] = JSON.stringify(opts.define[key]);
|
|
31
44
|
}
|
|
32
|
-
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
"process.env": env,
|
|
48
|
+
"process.env.SSR_MANIFEST": "process.env.SSR_MANIFEST",
|
|
49
|
+
...define
|
|
50
|
+
};
|
|
33
51
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
]);
|
|
43
|
-
});
|
|
52
|
+
async function addDefinePlugin(opts) {
|
|
53
|
+
const { config, userConfig } = opts;
|
|
54
|
+
config.plugin("define").use(import_webpack.DefinePlugin, [
|
|
55
|
+
resolveDefine({
|
|
56
|
+
define: userConfig.define || {},
|
|
57
|
+
publicPath: userConfig.publicPath
|
|
58
|
+
})
|
|
59
|
+
]);
|
|
44
60
|
}
|
|
45
|
-
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
addDefinePlugin,
|
|
64
|
+
resolveDefine
|
|
65
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
+
import { IConfig } from '../types';
|
|
3
|
+
interface IOpts {
|
|
4
|
+
userConfig: IConfig;
|
|
5
|
+
config: Config;
|
|
6
|
+
cwd: string;
|
|
7
|
+
extraBabelIncludes: Array<string | RegExp>;
|
|
8
|
+
}
|
|
9
|
+
export declare function addDependenceCssModulesDetector(opts: IOpts): Promise<void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/config/detectCssModulesInDependence.ts
|
|
20
|
+
var detectCssModulesInDependence_exports = {};
|
|
21
|
+
__export(detectCssModulesInDependence_exports, {
|
|
22
|
+
addDependenceCssModulesDetector: () => addDependenceCssModulesDetector
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(detectCssModulesInDependence_exports);
|
|
25
|
+
var import_utils = require("@umijs/utils");
|
|
26
|
+
var import_path = require("path");
|
|
27
|
+
async function addDependenceCssModulesDetector(opts) {
|
|
28
|
+
const { config, cwd, userConfig } = opts;
|
|
29
|
+
if (!userConfig.checkDepCssModules)
|
|
30
|
+
return;
|
|
31
|
+
const matchers = opts.extraBabelIncludes.map(function(p) {
|
|
32
|
+
if (import_utils.lodash.isRegExp(p)) {
|
|
33
|
+
return p;
|
|
34
|
+
}
|
|
35
|
+
let absPath;
|
|
36
|
+
if ((0, import_path.isAbsolute)(p)) {
|
|
37
|
+
absPath = p;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
if (p.startsWith("./")) {
|
|
41
|
+
absPath = require.resolve(p, { paths: [cwd] });
|
|
42
|
+
}
|
|
43
|
+
absPath = (0, import_path.dirname)(
|
|
44
|
+
import_utils.resolve.sync(`${p}/package.json`, {
|
|
45
|
+
basedir: cwd,
|
|
46
|
+
// same behavior as webpack, to ensure `include` paths matched
|
|
47
|
+
// ref: https://webpack.js.org/configuration/resolve/#resolvesymlinks
|
|
48
|
+
preserveSymlinks: false
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
return toRegExp(absPath);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
if (e.code === "MODULE_NOT_FOUND") {
|
|
54
|
+
throw new Error("Cannot resolve extraBabelIncludes: " + p, {
|
|
55
|
+
cause: e
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
throw e;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
config.plugin("dep-css-modules-detector").use(DetectCSsModulePlugin, [matchers]);
|
|
62
|
+
}
|
|
63
|
+
var _DetectCSsModulePlugin = class {
|
|
64
|
+
constructor(skipMatcher = []) {
|
|
65
|
+
this.skipMatcher = skipMatcher;
|
|
66
|
+
}
|
|
67
|
+
isCallRequireStyle(statement) {
|
|
68
|
+
if (
|
|
69
|
+
// var x= require(...) ?
|
|
70
|
+
statement.type === "CallExpression" && statement.callee.type === "Identifier" && statement.callee.name === "require" && // var x = require('xxxxx')
|
|
71
|
+
statement.arguments.length === 1 && statement.arguments[0].type === "Literal"
|
|
72
|
+
) {
|
|
73
|
+
const requireArg = statement.arguments[0].value;
|
|
74
|
+
if (requireArg.endsWith(".less") || requireArg.endsWith(".css")) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
apply(compiler) {
|
|
81
|
+
compiler.hooks.normalModuleFactory.tap(
|
|
82
|
+
_DetectCSsModulePlugin.PLUGIN_NAME,
|
|
83
|
+
(factory) => {
|
|
84
|
+
factory.hooks.parser.for("javascript/auto").tap("lessDetector", (parser) => {
|
|
85
|
+
parser.hooks.import.tap(
|
|
86
|
+
"lessDetector",
|
|
87
|
+
(statement, source) => {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
const specifiers = statement.specifiers.length;
|
|
90
|
+
if (specifiers > 0 && (source.endsWith(".less") || source.endsWith(".css")) && this.isJSModule(parser)) {
|
|
91
|
+
this.throwError((_b = (_a = parser.state) == null ? void 0 : _a.module) == null ? void 0 : _b.resource, compiler);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
parser.hooks.program.tap(
|
|
96
|
+
_DetectCSsModulePlugin.PLUGIN_NAME,
|
|
97
|
+
(program) => {
|
|
98
|
+
var _a, _b, _c, _d;
|
|
99
|
+
if (this.isJSModule(parser)) {
|
|
100
|
+
for (const statement of program.body) {
|
|
101
|
+
if (statement.type === "AssignmentExpression" && // x= require("x.less") or var x = require(".css") ?
|
|
102
|
+
this.isCallRequireStyle(statement.right)) {
|
|
103
|
+
this.throwError((_b = (_a = parser.state) == null ? void 0 : _a.module) == null ? void 0 : _b.resource, compiler);
|
|
104
|
+
}
|
|
105
|
+
if (statement.type === "VariableDeclarator" && // var x= require("x.less") or var x = require(".css") ?
|
|
106
|
+
this.isCallRequireStyle(statement.init)) {
|
|
107
|
+
this.throwError((_d = (_c = parser.state) == null ? void 0 : _c.module) == null ? void 0 : _d.resource, compiler);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
isJSModule(parser) {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
let res = (_b = (_a = parser.state) == null ? void 0 : _a.module) == null ? void 0 : _b.resource;
|
|
120
|
+
if (res) {
|
|
121
|
+
if (this.skipMatcher.some((r) => r.test(res))) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return res.indexOf("node_modules") >= 0 && (res.endsWith(".js") || res.endsWith(".jsx"));
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
throwError(file, c) {
|
|
129
|
+
const logger = c.getInfrastructureLogger(_DetectCSsModulePlugin.PLUGIN_NAME) || console;
|
|
130
|
+
logger.error(import_utils.chalk.red(`Dependence file ${file} contains css module`));
|
|
131
|
+
logger.error(
|
|
132
|
+
import_utils.chalk.red(
|
|
133
|
+
`Please add the package's name in 'babelExtraIncludes' or use non-css module in dependence`
|
|
134
|
+
)
|
|
135
|
+
);
|
|
136
|
+
throw Error(_DetectCSsModulePlugin.ERROR_NAME);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var DetectCSsModulePlugin = _DetectCSsModulePlugin;
|
|
140
|
+
DetectCSsModulePlugin.PLUGIN_NAME = "depCssModulesDetector";
|
|
141
|
+
DetectCSsModulePlugin.ERROR_NAME = "USE CSS-MODULES IN NODE_MODULES";
|
|
142
|
+
var toRegExp = (test) => {
|
|
143
|
+
if (typeof test === "string") {
|
|
144
|
+
return new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
|
|
145
|
+
}
|
|
146
|
+
return test;
|
|
147
|
+
};
|
|
148
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
149
|
+
0 && (module.exports = {
|
|
150
|
+
addDependenceCssModulesDetector
|
|
151
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Compilation } from '@umijs/bundler-webpack/compiled/webpack';
|
|
2
|
+
import { DeadCodeParams } from '../types';
|
|
3
|
+
export interface Options extends DeadCodeParams {
|
|
4
|
+
patterns: string[];
|
|
5
|
+
exclude: string[];
|
|
6
|
+
failOnHint: boolean;
|
|
7
|
+
detectUnusedFiles: boolean;
|
|
8
|
+
detectUnusedExport: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const ignores: string[];
|
|
11
|
+
declare const detectDeadCode: (compilation: Compilation, options: Options) => void;
|
|
12
|
+
export default detectDeadCode;
|