@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/dev.js
CHANGED
|
@@ -1,87 +1,204 @@
|
|
|
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
|
-
var
|
|
12
|
-
|
|
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;
|
|
13
18
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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/dev.ts
|
|
30
|
+
var dev_exports = {};
|
|
31
|
+
__export(dev_exports, {
|
|
32
|
+
dev: () => dev,
|
|
33
|
+
ensureSerializableValue: () => ensureSerializableValue,
|
|
34
|
+
setup: () => setup
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(dev_exports);
|
|
37
|
+
var import_mfsu = require("@umijs/mfsu");
|
|
38
|
+
var import_utils = require("@umijs/utils");
|
|
39
|
+
var import_fs = require("fs");
|
|
40
|
+
var import_path = require("path");
|
|
41
|
+
var import_webpack = __toESM(require("../compiled/webpack"));
|
|
42
|
+
var import_constants = require("./constants");
|
|
43
|
+
var import_server = require("./server/server");
|
|
44
|
+
var import_types = require("./types");
|
|
45
|
+
var configModule = (0, import_utils.importLazy)(
|
|
46
|
+
require.resolve("./config/config")
|
|
47
|
+
);
|
|
48
|
+
function ensureSerializableValue(obj) {
|
|
49
|
+
return JSON.parse(
|
|
50
|
+
JSON.stringify(
|
|
51
|
+
obj,
|
|
52
|
+
(_key, value) => {
|
|
53
|
+
if (typeof value === "function" || import_utils.lodash.isRegExp(value)) {
|
|
54
|
+
return value.toString();
|
|
33
55
|
}
|
|
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
|
-
|
|
56
|
+
return value;
|
|
57
|
+
},
|
|
58
|
+
2
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
async function dev(opts) {
|
|
63
|
+
const { mfsu, webpackConfig } = await setup(opts);
|
|
64
|
+
await (0, import_server.createServer)({
|
|
65
|
+
webpackConfig,
|
|
66
|
+
userConfig: opts.config,
|
|
67
|
+
cwd: opts.cwd,
|
|
68
|
+
beforeMiddlewares: [
|
|
69
|
+
...(mfsu == null ? void 0 : mfsu.getMiddlewares()) || [],
|
|
70
|
+
...opts.beforeMiddlewares || []
|
|
71
|
+
],
|
|
72
|
+
port: opts.port,
|
|
73
|
+
host: opts.host,
|
|
74
|
+
ip: opts.ip,
|
|
75
|
+
afterMiddlewares: [...opts.afterMiddlewares || []],
|
|
76
|
+
onDevCompileDone: opts.onDevCompileDone,
|
|
77
|
+
onProgress: opts.onProgress,
|
|
78
|
+
onBeforeMiddleware: opts.onBeforeMiddleware
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async function setup(opts) {
|
|
82
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
83
|
+
const cacheDirectoryPath = (0, import_path.resolve)(
|
|
84
|
+
opts.rootDir || opts.cwd,
|
|
85
|
+
opts.config.cacheDirectoryPath || "node_modules/.cache"
|
|
86
|
+
);
|
|
87
|
+
const enableMFSU = opts.config.mfsu !== false;
|
|
88
|
+
let mfsu = null;
|
|
89
|
+
if (enableMFSU) {
|
|
90
|
+
mfsu = new import_mfsu.MFSU({
|
|
91
|
+
strategy: opts.mfsuStrategy,
|
|
92
|
+
include: opts.mfsuInclude || [],
|
|
93
|
+
srcCodeCache: opts.srcCodeCache,
|
|
94
|
+
implementor: import_webpack.default,
|
|
95
|
+
buildDepWithESBuild: (_a = opts.config.mfsu) == null ? void 0 : _a.esbuild,
|
|
96
|
+
depBuildConfig: {
|
|
97
|
+
extraPostCSSPlugins: ((_b = opts.config) == null ? void 0 : _b.extraPostCSSPlugins) || []
|
|
98
|
+
},
|
|
99
|
+
mfName: (_c = opts.config.mfsu) == null ? void 0 : _c.mfName,
|
|
100
|
+
runtimePublicPath: opts.config.runtimePublicPath,
|
|
101
|
+
tmpBase: ((_d = opts.config.mfsu) == null ? void 0 : _d.cacheDirectory) || (0, import_path.join)(cacheDirectoryPath, "mfsu"),
|
|
102
|
+
onMFSUProgress: opts.onMFSUProgress,
|
|
103
|
+
unMatchLibs: (_e = opts.config.mfsu) == null ? void 0 : _e.exclude,
|
|
104
|
+
shared: (_f = opts.config.mfsu) == null ? void 0 : _f.shared,
|
|
105
|
+
remoteAliases: (_g = opts.config.mfsu) == null ? void 0 : _g.remoteAliases,
|
|
106
|
+
remoteName: (_h = opts.config.mfsu) == null ? void 0 : _h.remoteName,
|
|
107
|
+
getCacheDependency() {
|
|
108
|
+
return ensureSerializableValue({
|
|
109
|
+
version: require("../package.json").version,
|
|
110
|
+
mfsu: opts.config.mfsu,
|
|
111
|
+
alias: opts.config.alias,
|
|
112
|
+
externals: opts.config.externals,
|
|
113
|
+
theme: opts.config.theme,
|
|
114
|
+
runtimePublicPath: opts.config.runtimePublicPath,
|
|
115
|
+
publicPath: opts.config.publicPath,
|
|
116
|
+
define: opts.config.define
|
|
84
117
|
});
|
|
118
|
+
},
|
|
119
|
+
startBuildWorker: opts.startBuildWorker,
|
|
120
|
+
cwd: opts.cwd
|
|
85
121
|
});
|
|
122
|
+
}
|
|
123
|
+
const webpackConfig = await configModule.getConfig({
|
|
124
|
+
cwd: opts.cwd,
|
|
125
|
+
rootDir: opts.rootDir,
|
|
126
|
+
env: import_types.Env.development,
|
|
127
|
+
entry: opts.entry,
|
|
128
|
+
userConfig: opts.config,
|
|
129
|
+
babelPreset: opts.babelPreset,
|
|
130
|
+
extraBabelPlugins: [
|
|
131
|
+
...opts.beforeBabelPlugins || [],
|
|
132
|
+
...(mfsu == null ? void 0 : mfsu.getBabelPlugins()) || [],
|
|
133
|
+
...opts.extraBabelPlugins || []
|
|
134
|
+
],
|
|
135
|
+
extraBabelPresets: [
|
|
136
|
+
...opts.beforeBabelPresets || [],
|
|
137
|
+
...opts.extraBabelPresets || []
|
|
138
|
+
],
|
|
139
|
+
extraBabelIncludes: opts.config.extraBabelIncludes,
|
|
140
|
+
extraEsbuildLoaderHandler: (mfsu == null ? void 0 : mfsu.getEsbuildLoaderHandler()) || [],
|
|
141
|
+
chainWebpack: opts.chainWebpack,
|
|
142
|
+
modifyWebpackConfig: opts.modifyWebpackConfig,
|
|
143
|
+
hmr: process.env.HMR !== "none",
|
|
144
|
+
analyze: process.env.ANALYZE,
|
|
145
|
+
cache: opts.cache ? {
|
|
146
|
+
...opts.cache,
|
|
147
|
+
cacheDirectory: (0, import_path.join)(
|
|
148
|
+
cacheDirectoryPath,
|
|
149
|
+
opts.mfsuStrategy === "eager" ? "bundler-webpack-eager" : "bundler-webpack"
|
|
150
|
+
)
|
|
151
|
+
} : void 0,
|
|
152
|
+
pkg: opts.pkg,
|
|
153
|
+
disableCopy: opts.disableCopy
|
|
154
|
+
});
|
|
155
|
+
const depConfig = await configModule.getConfig({
|
|
156
|
+
cwd: opts.cwd,
|
|
157
|
+
rootDir: opts.rootDir,
|
|
158
|
+
env: import_types.Env.development,
|
|
159
|
+
entry: opts.entry,
|
|
160
|
+
userConfig: { ...opts.config, forkTSChecker: false },
|
|
161
|
+
disableCopy: true,
|
|
162
|
+
hash: true,
|
|
163
|
+
staticPathPrefix: import_mfsu.MF_DEP_PREFIX,
|
|
164
|
+
name: import_constants.MFSU_NAME,
|
|
165
|
+
chainWebpack: (_i = opts.config.mfsu) == null ? void 0 : _i.chainWebpack,
|
|
166
|
+
extraBabelIncludes: opts.config.extraBabelIncludes,
|
|
167
|
+
cache: {
|
|
168
|
+
buildDependencies: (_j = opts.cache) == null ? void 0 : _j.buildDependencies,
|
|
169
|
+
cacheDirectory: (0, import_path.join)(cacheDirectoryPath, "mfsu-deps")
|
|
170
|
+
},
|
|
171
|
+
pkg: opts.pkg
|
|
172
|
+
});
|
|
173
|
+
(_k = webpackConfig.resolve).alias || (_k.alias = {});
|
|
174
|
+
["@umijs/utils/compiled/strip-ansi", "react-error-overlay"].forEach((dep) => {
|
|
175
|
+
webpackConfig.resolve.alias[dep] = require.resolve(dep);
|
|
176
|
+
});
|
|
177
|
+
await (mfsu == null ? void 0 : mfsu.setWebpackConfig({
|
|
178
|
+
config: webpackConfig,
|
|
179
|
+
depConfig
|
|
180
|
+
}));
|
|
181
|
+
if (mfsu && webpackConfig.cache && typeof webpackConfig.cache === "object" && webpackConfig.cache.type === "filesystem") {
|
|
182
|
+
const webpackCachePath = (0, import_path.join)(
|
|
183
|
+
webpackConfig.cache.cacheDirectory,
|
|
184
|
+
`default-development`,
|
|
185
|
+
"index.pack"
|
|
186
|
+
);
|
|
187
|
+
const mfsuCacheExists = (0, import_fs.existsSync)(mfsu.getCacheFilePath());
|
|
188
|
+
const webpackCacheExists = (0, import_fs.existsSync)(webpackCachePath);
|
|
189
|
+
if (webpackCacheExists && !mfsuCacheExists) {
|
|
190
|
+
import_utils.logger.warn(`Invalidate webpack cache since mfsu cache is missing`);
|
|
191
|
+
import_utils.rimraf.sync(webpackConfig.cache.cacheDirectory);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
mfsu,
|
|
196
|
+
webpackConfig
|
|
197
|
+
};
|
|
86
198
|
}
|
|
87
|
-
|
|
199
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
200
|
+
0 && (module.exports = {
|
|
201
|
+
dev,
|
|
202
|
+
ensureSerializableValue,
|
|
203
|
+
setup
|
|
204
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type webpack from '../compiled/webpack';
|
|
2
|
+
import './requireHook';
|
|
3
|
+
export type { RequestHandler, Express, } from '@umijs/bundler-utils/compiled/express';
|
|
4
|
+
export type { Compiler, Stats } from '../compiled/webpack';
|
|
2
5
|
export * from './build';
|
|
3
6
|
export * from './config/config';
|
|
4
7
|
export * from './dev';
|
|
5
8
|
export * from './schema';
|
|
6
|
-
|
|
9
|
+
export * from './constants';
|
|
10
|
+
export { webpack };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/index.ts
|
|
17
|
+
var src_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(src_exports);
|
|
19
|
+
var import_requireHook = require("./requireHook");
|
|
20
|
+
__reExport(src_exports, require("./build"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./config/config"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./dev"), module.exports);
|
|
23
|
+
__reExport(src_exports, require("./schema"), module.exports);
|
|
24
|
+
__reExport(src_exports, require("./constants"), module.exports);
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
...require("./build"),
|
|
28
|
+
...require("./config/config"),
|
|
29
|
+
...require("./dev"),
|
|
30
|
+
...require("./schema"),
|
|
31
|
+
...require("./constants")
|
|
32
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
};
|
|
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/loader/svgr.ts
|
|
30
|
+
var svgr_exports = {};
|
|
31
|
+
__export(svgr_exports, {
|
|
32
|
+
default: () => svgr_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(svgr_exports);
|
|
35
|
+
var import_core = require("@svgr/core");
|
|
36
|
+
var import_plugin_jsx = __toESM(require("@svgr/plugin-jsx"));
|
|
37
|
+
var import_plugin_svgo = __toESM(require("@svgr/plugin-svgo"));
|
|
38
|
+
var import_esbuild = require("@umijs/bundler-utils/compiled/esbuild");
|
|
39
|
+
var import_path = require("path");
|
|
40
|
+
var import_util = require("util");
|
|
41
|
+
var tranformSvg = (0, import_util.callbackify)(
|
|
42
|
+
async (contents, options, state) => {
|
|
43
|
+
const jsCode = await (0, import_core.transform)(contents, options, state);
|
|
44
|
+
const result = await (0, import_esbuild.transform)(jsCode, {
|
|
45
|
+
loader: "tsx",
|
|
46
|
+
target: "es2015"
|
|
47
|
+
});
|
|
48
|
+
if (!(result == null ? void 0 : result.code)) {
|
|
49
|
+
throw new Error(`Error while transforming using Esbuild`);
|
|
50
|
+
}
|
|
51
|
+
return result.code;
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
function svgrLoader(contents) {
|
|
55
|
+
this.cacheable && this.cacheable();
|
|
56
|
+
const callback = this.async();
|
|
57
|
+
const options = this.getOptions();
|
|
58
|
+
const previousExport = (() => {
|
|
59
|
+
if (contents.startsWith("export "))
|
|
60
|
+
return contents;
|
|
61
|
+
const exportMatches = contents.match(/^module.exports\s*=\s*(.*)/);
|
|
62
|
+
return exportMatches ? `export default ${exportMatches[1]}` : null;
|
|
63
|
+
})();
|
|
64
|
+
const state = {
|
|
65
|
+
caller: {
|
|
66
|
+
name: "svgr-loader",
|
|
67
|
+
previousExport,
|
|
68
|
+
defaultPlugins: [import_plugin_svgo.default, import_plugin_jsx.default]
|
|
69
|
+
},
|
|
70
|
+
filePath: (0, import_path.normalize)(this.resourcePath)
|
|
71
|
+
};
|
|
72
|
+
if (!previousExport) {
|
|
73
|
+
tranformSvg(contents, options, state, callback);
|
|
74
|
+
} else {
|
|
75
|
+
this.fs.readFile(this.resourcePath, (err, result) => {
|
|
76
|
+
if (err) {
|
|
77
|
+
callback(err);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
tranformSvg(String(result), options, state, callback);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
var svgr_default = svgrLoader;
|
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
};
|
|
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/loader/swc.ts
|
|
30
|
+
var swc_exports = {};
|
|
31
|
+
__export(swc_exports, {
|
|
32
|
+
default: () => swc_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(swc_exports);
|
|
35
|
+
var import_core = require("@swc/core");
|
|
36
|
+
var import_types = require("../types");
|
|
37
|
+
var import_utils = require("@umijs/utils");
|
|
38
|
+
function getBaseOpts({ filename }) {
|
|
39
|
+
const isTSFile = filename.endsWith(".ts");
|
|
40
|
+
const isTypeScript = isTSFile || filename.endsWith(".tsx");
|
|
41
|
+
const isDev = process.env.NODE_ENV === import_types.Env.development;
|
|
42
|
+
const swcOpts = {
|
|
43
|
+
module: {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
type: "es6",
|
|
46
|
+
ignoreDynamic: true
|
|
47
|
+
},
|
|
48
|
+
jsc: {
|
|
49
|
+
parser: {
|
|
50
|
+
syntax: isTypeScript ? "typescript" : "ecmascript",
|
|
51
|
+
[isTypeScript ? "tsx" : "jsx"]: !isTSFile,
|
|
52
|
+
dynamicImport: isTypeScript
|
|
53
|
+
},
|
|
54
|
+
target: "es2015",
|
|
55
|
+
transform: {
|
|
56
|
+
react: {
|
|
57
|
+
runtime: "automatic",
|
|
58
|
+
pragma: "React.createElement",
|
|
59
|
+
pragmaFrag: "React.Fragment",
|
|
60
|
+
throwIfNamespace: true,
|
|
61
|
+
development: isDev,
|
|
62
|
+
useBuiltins: true
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return swcOpts;
|
|
68
|
+
}
|
|
69
|
+
function swcLoader(contents, inputSourceMap) {
|
|
70
|
+
const callback = this.async();
|
|
71
|
+
const loaderOpts = this.getOptions();
|
|
72
|
+
if (inputSourceMap && typeof inputSourceMap === "object") {
|
|
73
|
+
inputSourceMap = JSON.stringify(inputSourceMap);
|
|
74
|
+
}
|
|
75
|
+
const {
|
|
76
|
+
sync = false,
|
|
77
|
+
parseMap = false,
|
|
78
|
+
excludeFiles = [],
|
|
79
|
+
enableAutoCssModulesPlugin = false,
|
|
80
|
+
mergeConfigs,
|
|
81
|
+
...otherOpts
|
|
82
|
+
} = loaderOpts;
|
|
83
|
+
const filename = this.resourcePath;
|
|
84
|
+
const isSkip = excludeFiles.some((pattern) => {
|
|
85
|
+
if (typeof pattern === "string") {
|
|
86
|
+
return filename == pattern;
|
|
87
|
+
}
|
|
88
|
+
return pattern.test(filename);
|
|
89
|
+
});
|
|
90
|
+
if (isSkip) {
|
|
91
|
+
return callback(
|
|
92
|
+
null,
|
|
93
|
+
contents,
|
|
94
|
+
parseMap ? JSON.parse(inputSourceMap) : inputSourceMap
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
let swcOpts = {
|
|
98
|
+
...getBaseOpts({
|
|
99
|
+
filename
|
|
100
|
+
}),
|
|
101
|
+
// filename
|
|
102
|
+
filename,
|
|
103
|
+
sourceFileName: filename,
|
|
104
|
+
// source map
|
|
105
|
+
sourceMaps: this.sourceMap,
|
|
106
|
+
...inputSourceMap ? {
|
|
107
|
+
inputSourceMap
|
|
108
|
+
} : {},
|
|
109
|
+
...otherOpts
|
|
110
|
+
};
|
|
111
|
+
if (enableAutoCssModulesPlugin) {
|
|
112
|
+
swcOpts = (0, import_utils.deepmerge)(swcOpts, {
|
|
113
|
+
jsc: {
|
|
114
|
+
experimental: {
|
|
115
|
+
plugins: [[require.resolve("swc-plugin-auto-css-modules"), {}]]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (mergeConfigs) {
|
|
121
|
+
swcOpts = (0, import_utils.deepmerge)(swcOpts, mergeConfigs);
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
if (sync) {
|
|
125
|
+
const output = (0, import_core.transformSync)(contents, swcOpts);
|
|
126
|
+
callback(
|
|
127
|
+
null,
|
|
128
|
+
output.code,
|
|
129
|
+
parseMap ? JSON.parse(output.map) : output.map
|
|
130
|
+
);
|
|
131
|
+
} else {
|
|
132
|
+
(0, import_core.transform)(contents, swcOpts).then(
|
|
133
|
+
(output) => {
|
|
134
|
+
callback(
|
|
135
|
+
null,
|
|
136
|
+
output.code,
|
|
137
|
+
parseMap ? JSON.parse(output.map) : output.map
|
|
138
|
+
);
|
|
139
|
+
},
|
|
140
|
+
(err) => {
|
|
141
|
+
callback(err);
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
} catch (e) {
|
|
146
|
+
callback(e);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
var swc_default = swcLoader;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
};
|
|
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/parcelCSS.ts
|
|
30
|
+
var parcelCSS_exports = {};
|
|
31
|
+
__export(parcelCSS_exports, {
|
|
32
|
+
parcelCSS: () => parcelCSS
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(parcelCSS_exports);
|
|
35
|
+
var parcelCSS = __toESM(require("lightningcss"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
parcelCSS
|
|
39
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Compilation, Compiler, sources } from '../../compiled/webpack';
|
|
2
|
+
export declare class EsbuildMinifyFix {
|
|
3
|
+
private name;
|
|
4
|
+
constructor();
|
|
5
|
+
apply(compiler: Compiler): void;
|
|
6
|
+
private isIIFE;
|
|
7
|
+
minifyFix(compilation: Compilation, assets: Record<string, sources.Source>): Promise<void>;
|
|
8
|
+
}
|