@umijs/bundler-webpack 4.0.41 → 4.0.42
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/compiled/autoprefixer/browserslist/index.d.ts +21 -1
- package/compiled/autoprefixer/index.js +2 -2
- package/compiled/autoprefixer/package.json +1 -1
- package/compiled/autoprefixer/postcss/lib/processor.d.ts +1 -1
- package/compiled/webpackbar/LICENSE +20 -0
- package/compiled/webpackbar/dist/index.d.ts +121 -0
- package/compiled/webpackbar/index.js +7 -0
- package/compiled/webpackbar/package.json +1 -0
- package/dist/config/javaScriptRules.js +11 -4
- package/dist/config/progressPlugin.js +9 -7
- package/dist/dev.js +0 -3
- package/dist/loader/swc.d.ts +2 -2
- package/dist/loader/swc.js +42 -4
- package/dist/schema.js +4 -0
- package/dist/swcPlugins/autoCSSModules.d.ts +5 -1
- package/dist/types.d.ts +13 -2
- package/package.json +10 -7
package/dist/loader/swc.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
17
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
21
|
|
|
19
22
|
// src/loader/swc.ts
|
|
@@ -24,6 +27,7 @@ __export(swc_exports, {
|
|
|
24
27
|
module.exports = __toCommonJS(swc_exports);
|
|
25
28
|
var import_core = require("@swc/core");
|
|
26
29
|
var import_types = require("../types");
|
|
30
|
+
var import_utils = require("@umijs/utils");
|
|
27
31
|
function getBaseOpts({ filename }) {
|
|
28
32
|
const isTSFile = filename.endsWith(".ts");
|
|
29
33
|
const isTypeScript = isTSFile || filename.endsWith(".tsx");
|
|
@@ -54,20 +58,54 @@ function getBaseOpts({ filename }) {
|
|
|
54
58
|
};
|
|
55
59
|
return swcOpts;
|
|
56
60
|
}
|
|
57
|
-
function swcLoader(contents) {
|
|
61
|
+
function swcLoader(contents, inputSourceMap) {
|
|
58
62
|
const callback = this.async();
|
|
59
63
|
const loaderOpts = this.getOptions();
|
|
60
|
-
|
|
64
|
+
if (inputSourceMap && typeof inputSourceMap === "object") {
|
|
65
|
+
inputSourceMap = JSON.stringify(inputSourceMap);
|
|
66
|
+
}
|
|
67
|
+
const {
|
|
68
|
+
sync = false,
|
|
69
|
+
parseMap = false,
|
|
70
|
+
excludeFiles = [],
|
|
71
|
+
enableAutoCssModulesPlugin = false,
|
|
72
|
+
mergeConfigs,
|
|
73
|
+
...otherOpts
|
|
74
|
+
} = loaderOpts;
|
|
61
75
|
const filename = this.resourcePath;
|
|
62
|
-
const
|
|
76
|
+
const isSkip = excludeFiles.some((pattern) => {
|
|
77
|
+
if (typeof pattern === "string") {
|
|
78
|
+
return filename == pattern;
|
|
79
|
+
}
|
|
80
|
+
return pattern.test(filename);
|
|
81
|
+
});
|
|
82
|
+
if (isSkip) {
|
|
83
|
+
return callback(null, contents, parseMap ? JSON.parse(inputSourceMap) : inputSourceMap);
|
|
84
|
+
}
|
|
85
|
+
let swcOpts = {
|
|
63
86
|
...getBaseOpts({
|
|
64
87
|
filename
|
|
65
88
|
}),
|
|
66
89
|
filename,
|
|
67
|
-
sourceMaps: this.sourceMap,
|
|
68
90
|
sourceFileName: filename,
|
|
91
|
+
sourceMaps: this.sourceMap,
|
|
92
|
+
...inputSourceMap ? {
|
|
93
|
+
inputSourceMap
|
|
94
|
+
} : {},
|
|
69
95
|
...otherOpts
|
|
70
96
|
};
|
|
97
|
+
if (enableAutoCssModulesPlugin) {
|
|
98
|
+
swcOpts = (0, import_utils.deepmerge)(swcOpts, {
|
|
99
|
+
jsc: {
|
|
100
|
+
experimental: {
|
|
101
|
+
plugins: [[require.resolve("swc-plugin-auto-css-modules"), {}]]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (mergeConfigs) {
|
|
107
|
+
swcOpts = (0, import_utils.deepmerge)(swcOpts, mergeConfigs);
|
|
108
|
+
}
|
|
71
109
|
try {
|
|
72
110
|
if (sync) {
|
|
73
111
|
const output = (0, import_core.transformSync)(contents, swcOpts);
|
package/dist/schema.js
CHANGED
|
@@ -112,6 +112,10 @@ function getSchemas() {
|
|
|
112
112
|
runtimePublicPath: (Joi) => Joi.object(),
|
|
113
113
|
sassLoader: (Joi) => Joi.object(),
|
|
114
114
|
srcTranspiler: (Joi) => Joi.string().valid(import_types.Transpiler.babel, import_types.Transpiler.esbuild, import_types.Transpiler.swc, import_types.Transpiler.none),
|
|
115
|
+
srcTranspilerOptions: (Joi) => Joi.object({
|
|
116
|
+
esbuild: Joi.object(),
|
|
117
|
+
swc: Joi.object()
|
|
118
|
+
}),
|
|
115
119
|
styleLoader: (Joi) => Joi.object(),
|
|
116
120
|
svgo: (Joi) => Joi.alternatives().try(Joi.object(), Joi.boolean()),
|
|
117
121
|
svgr: (Joi) => Joi.object(),
|
|
@@ -7,7 +7,11 @@ declare class AutoCSSModule extends Visitor {
|
|
|
7
7
|
* visitProgram -> visitModule -> visitModuleItems -> visitModuleItem -> visitImportDeclaration
|
|
8
8
|
* @see https://github.com/swc-project/swc/blob/main/node-swc/src/Visitor.ts#L189
|
|
9
9
|
*/
|
|
10
|
-
visitModuleItem(n: ModuleItem): ImportDeclaration | import("@swc/core").ExportDeclaration | import("@swc/core").ExportNamedDeclaration | import("@swc/core").ExportDefaultDeclaration | import("@swc/core").ExportDefaultExpression | import("@swc/core").ExportAllDeclaration | import("@swc/core").TsImportEqualsDeclaration | import("@swc/core").TsExportAssignment | import("@swc/core").TsNamespaceExportDeclaration | import("@swc/core").
|
|
10
|
+
visitModuleItem(n: ModuleItem): ImportDeclaration | import("@swc/core").ExportDeclaration | import("@swc/core").ExportNamedDeclaration | import("@swc/core").ExportDefaultDeclaration | import("@swc/core").ExportDefaultExpression | import("@swc/core").ExportAllDeclaration | import("@swc/core").TsImportEqualsDeclaration | import("@swc/core").TsExportAssignment | import("@swc/core").TsNamespaceExportDeclaration | import("@swc/core").BlockStatement | import("@swc/core").EmptyStatement | import("@swc/core").DebuggerStatement | import("@swc/core").WithStatement | import("@swc/core").ReturnStatement | import("@swc/core").LabeledStatement | import("@swc/core").BreakStatement | import("@swc/core").ContinueStatement | import("@swc/core").IfStatement | import("@swc/core").SwitchStatement | import("@swc/core").ThrowStatement | import("@swc/core").TryStatement | import("@swc/core").WhileStatement | import("@swc/core").DoWhileStatement | import("@swc/core").ForStatement | import("@swc/core").ForInStatement | import("@swc/core").ForOfStatement | import("@swc/core").ClassDeclaration | import("@swc/core").FunctionDeclaration | import("@swc/core").VariableDeclaration | import("@swc/core").TsInterfaceDeclaration | import("@swc/core").TsTypeAliasDeclaration | import("@swc/core").TsEnumDeclaration | import("@swc/core").TsModuleDeclaration | import("@swc/core").ExpressionStatement;
|
|
11
11
|
visitImportDeclaration(expression: ImportDeclaration): ImportDeclaration;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Swc will not support js plugin in the future.
|
|
15
|
+
* See https://github.com/swc-project/website/commit/fde42ad5371c1a16ca9729fe17bcfd3489841ac1
|
|
16
|
+
*/
|
|
13
17
|
export default AutoCSSModule;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Options as SwcConfig } from '@swc/core';
|
|
2
2
|
import type { HttpsServerOptions, ProxyOptions } from '@umijs/bundler-utils';
|
|
3
3
|
import webpack, { Configuration } from '../compiled/webpack';
|
|
4
4
|
import Config from '../compiled/webpack-5-chain';
|
|
5
|
+
import type { TransformOptions as EsbuildOptions } from '@umijs/bundler-utils/compiled/esbuild';
|
|
5
6
|
export declare enum Env {
|
|
6
7
|
development = "development",
|
|
7
8
|
production = "production"
|
|
@@ -103,6 +104,7 @@ export interface IConfig {
|
|
|
103
104
|
[key: string]: any;
|
|
104
105
|
};
|
|
105
106
|
srcTranspiler?: `${Transpiler}`;
|
|
107
|
+
srcTranspilerOptions?: ISrcTranspilerOpts;
|
|
106
108
|
styleLoader?: {
|
|
107
109
|
[key: string]: any;
|
|
108
110
|
};
|
|
@@ -120,8 +122,17 @@ export interface IConfig {
|
|
|
120
122
|
analyze?: Record<string, any>;
|
|
121
123
|
[key: string]: any;
|
|
122
124
|
}
|
|
123
|
-
export interface
|
|
125
|
+
export interface ISrcTranspilerOpts {
|
|
126
|
+
swc?: Partial<SwcConfig>;
|
|
127
|
+
esbuild?: Partial<EsbuildOptions>;
|
|
128
|
+
}
|
|
129
|
+
export interface ISwcPluginOpts {
|
|
130
|
+
enableAutoCssModulesPlugin?: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface SwcOptions extends SwcConfig, ISwcPluginOpts {
|
|
124
133
|
sync?: boolean;
|
|
125
134
|
parseMap?: boolean;
|
|
135
|
+
excludeFiles?: Array<string | RegExp>;
|
|
136
|
+
mergeConfigs?: Partial<SwcConfig>;
|
|
126
137
|
}
|
|
127
138
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.42",
|
|
4
4
|
"description": "@umijs/bundler-webpack",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-webpack#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"@svgr/plugin-jsx": "^6.2.1",
|
|
35
35
|
"@svgr/plugin-svgo": "^6.2.0",
|
|
36
36
|
"@types/hapi__joi": "17.1.8",
|
|
37
|
-
"@umijs/babel-preset-umi": "4.0.
|
|
38
|
-
"@umijs/bundler-utils": "4.0.
|
|
37
|
+
"@umijs/babel-preset-umi": "4.0.42",
|
|
38
|
+
"@umijs/bundler-utils": "4.0.42",
|
|
39
39
|
"@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
|
|
40
|
-
"@umijs/mfsu": "4.0.
|
|
41
|
-
"@umijs/utils": "4.0.
|
|
40
|
+
"@umijs/mfsu": "4.0.42",
|
|
41
|
+
"@umijs/utils": "4.0.42",
|
|
42
42
|
"cors": "^2.8.5",
|
|
43
43
|
"css-loader": "6.7.1",
|
|
44
44
|
"es5-imcompatible-versions": "^0.1.73",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"react-refresh": "0.14.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@swc/core": "1.
|
|
54
|
+
"@swc/core": "1.3.24",
|
|
55
55
|
"@types/cors": "^2.8.12",
|
|
56
56
|
"@types/webpack-sources": "3.2.0",
|
|
57
57
|
"@types/ws": "8.5.3",
|
|
58
|
-
"autoprefixer": "10.4.
|
|
58
|
+
"autoprefixer": "10.4.13",
|
|
59
59
|
"babel-loader": "8.2.4",
|
|
60
60
|
"compression": "1.7.4",
|
|
61
61
|
"connect-history-api-fallback": "1.6.0",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"speed-measure-webpack-plugin": "1.5.0",
|
|
73
73
|
"style-loader": "3.3.1",
|
|
74
74
|
"svgo-loader": "3.0.0",
|
|
75
|
+
"swc-plugin-auto-css-modules": "1.3.0",
|
|
75
76
|
"terser": "5.12.1",
|
|
76
77
|
"terser-webpack-plugin": "5.3.1",
|
|
77
78
|
"url-loader": "4.1.1",
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
"webpack-dev-middleware": "5.3.3",
|
|
82
83
|
"webpack-manifest-plugin": "5.0.0",
|
|
83
84
|
"webpack-sources": "3.2.3",
|
|
85
|
+
"webpackbar": "5.0.2",
|
|
84
86
|
"ws": "8.5.0"
|
|
85
87
|
},
|
|
86
88
|
"publishConfig": {
|
|
@@ -117,6 +119,7 @@
|
|
|
117
119
|
"webpack-dev-middleware",
|
|
118
120
|
"webpack-manifest-plugin",
|
|
119
121
|
"webpack-sources",
|
|
122
|
+
"webpackbar",
|
|
120
123
|
"ws",
|
|
121
124
|
"./bundles/webpack/bundle"
|
|
122
125
|
],
|