@umijs/bundler-webpack 4.0.0-canary.20221221.1 → 4.0.0-canary.20230109.1
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 +12 -6
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +9 -12
- 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 +16 -4
- package/package.json +11 -7
package/dist/dev.js
CHANGED
|
@@ -23,7 +23,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
var dev_exports = {};
|
|
24
24
|
__export(dev_exports, {
|
|
25
25
|
dev: () => dev,
|
|
26
|
-
|
|
26
|
+
ensureSerializableValue: () => ensureSerializableValue
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(dev_exports);
|
|
29
29
|
var import_mfsu = require("@umijs/mfsu");
|
|
@@ -35,13 +35,13 @@ var import_config = require("./config/config");
|
|
|
35
35
|
var import_constants = require("./constants");
|
|
36
36
|
var import_server = require("./server/server");
|
|
37
37
|
var import_types = require("./types");
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
38
|
+
function ensureSerializableValue(obj) {
|
|
39
|
+
return JSON.parse(JSON.stringify(obj, (_key, value) => {
|
|
40
|
+
if (typeof value === "function") {
|
|
41
|
+
return value.toString();
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
return value;
|
|
44
|
+
}, 2));
|
|
45
45
|
}
|
|
46
46
|
async function dev(opts) {
|
|
47
47
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
@@ -49,9 +49,6 @@ async function dev(opts) {
|
|
|
49
49
|
const enableMFSU = opts.config.mfsu !== false;
|
|
50
50
|
let mfsu = null;
|
|
51
51
|
if (enableMFSU) {
|
|
52
|
-
if (opts.config.srcTranspiler === import_types.Transpiler.swc) {
|
|
53
|
-
import_utils.logger.warn(`Swc currently not supported for use with mfsu, recommended you use srcTranspiler: 'esbuild' in dev.`);
|
|
54
|
-
}
|
|
55
52
|
mfsu = new import_mfsu.MFSU({
|
|
56
53
|
strategy: opts.mfsuStrategy,
|
|
57
54
|
include: opts.mfsuInclude || [],
|
|
@@ -70,7 +67,7 @@ async function dev(opts) {
|
|
|
70
67
|
remoteAliases: (_g = opts.config.mfsu) == null ? void 0 : _g.remoteAliases,
|
|
71
68
|
remoteName: (_h = opts.config.mfsu) == null ? void 0 : _h.remoteName,
|
|
72
69
|
getCacheDependency() {
|
|
73
|
-
return
|
|
70
|
+
return ensureSerializableValue({
|
|
74
71
|
version: require("../package.json").version,
|
|
75
72
|
mfsu: opts.config.mfsu,
|
|
76
73
|
alias: opts.config.alias,
|
|
@@ -168,5 +165,5 @@ async function dev(opts) {
|
|
|
168
165
|
// Annotate the CommonJS export names for ESM import in node:
|
|
169
166
|
0 && (module.exports = {
|
|
170
167
|
dev,
|
|
171
|
-
|
|
168
|
+
ensureSerializableValue
|
|
172
169
|
});
|
package/dist/loader/swc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LoaderContext } from '../../compiled/webpack';
|
|
2
|
-
import { SwcOptions } from '../types';
|
|
3
|
-
declare function swcLoader(this: LoaderContext<SwcOptions>, contents: string): void;
|
|
2
|
+
import { type SwcOptions } from '../types';
|
|
3
|
+
declare function swcLoader(this: LoaderContext<SwcOptions>, contents: string, inputSourceMap: string | Record<string, any>): void;
|
|
4
4
|
export default swcLoader;
|
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,9 @@
|
|
|
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';
|
|
6
|
+
import type { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
5
7
|
export declare enum Env {
|
|
6
8
|
development = "development",
|
|
7
9
|
production = "production"
|
|
@@ -102,7 +104,8 @@ export interface IConfig {
|
|
|
102
104
|
sassLoader?: {
|
|
103
105
|
[key: string]: any;
|
|
104
106
|
};
|
|
105
|
-
srcTranspiler?: Transpiler
|
|
107
|
+
srcTranspiler?: `${Transpiler}`;
|
|
108
|
+
srcTranspilerOptions?: ISrcTranspilerOpts;
|
|
106
109
|
styleLoader?: {
|
|
107
110
|
[key: string]: any;
|
|
108
111
|
};
|
|
@@ -117,11 +120,20 @@ export interface IConfig {
|
|
|
117
120
|
};
|
|
118
121
|
writeToDisk?: boolean;
|
|
119
122
|
babelLoaderCustomize?: string;
|
|
120
|
-
analyze?:
|
|
123
|
+
analyze?: BundleAnalyzerPlugin.Options;
|
|
121
124
|
[key: string]: any;
|
|
122
125
|
}
|
|
123
|
-
export interface
|
|
126
|
+
export interface ISrcTranspilerOpts {
|
|
127
|
+
swc?: Partial<SwcConfig>;
|
|
128
|
+
esbuild?: Partial<EsbuildOptions>;
|
|
129
|
+
}
|
|
130
|
+
export interface ISwcPluginOpts {
|
|
131
|
+
enableAutoCssModulesPlugin?: boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface SwcOptions extends SwcConfig, ISwcPluginOpts {
|
|
124
134
|
sync?: boolean;
|
|
125
135
|
parseMap?: boolean;
|
|
136
|
+
excludeFiles?: Array<string | RegExp>;
|
|
137
|
+
mergeConfigs?: Partial<SwcConfig>;
|
|
126
138
|
}
|
|
127
139
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.20230109.1",
|
|
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.0-canary.
|
|
38
|
-
"@umijs/bundler-utils": "4.0.0-canary.
|
|
37
|
+
"@umijs/babel-preset-umi": "4.0.0-canary.20230109.1",
|
|
38
|
+
"@umijs/bundler-utils": "4.0.0-canary.20230109.1",
|
|
39
39
|
"@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
|
|
40
|
-
"@umijs/mfsu": "4.0.0-canary.
|
|
41
|
-
"@umijs/utils": "4.0.0-canary.
|
|
40
|
+
"@umijs/mfsu": "4.0.0-canary.20230109.1",
|
|
41
|
+
"@umijs/utils": "4.0.0-canary.20230109.1",
|
|
42
42
|
"cors": "^2.8.5",
|
|
43
43
|
"css-loader": "6.7.1",
|
|
44
44
|
"es5-imcompatible-versions": "^0.1.73",
|
|
@@ -51,11 +51,12 @@
|
|
|
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
|
+
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
56
57
|
"@types/webpack-sources": "3.2.0",
|
|
57
58
|
"@types/ws": "8.5.3",
|
|
58
|
-
"autoprefixer": "10.4.
|
|
59
|
+
"autoprefixer": "10.4.13",
|
|
59
60
|
"babel-loader": "8.2.4",
|
|
60
61
|
"compression": "1.7.4",
|
|
61
62
|
"connect-history-api-fallback": "1.6.0",
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
"speed-measure-webpack-plugin": "1.5.0",
|
|
73
74
|
"style-loader": "3.3.1",
|
|
74
75
|
"svgo-loader": "3.0.0",
|
|
76
|
+
"swc-plugin-auto-css-modules": "1.3.0",
|
|
75
77
|
"terser": "5.12.1",
|
|
76
78
|
"terser-webpack-plugin": "5.3.1",
|
|
77
79
|
"url-loader": "4.1.1",
|
|
@@ -81,6 +83,7 @@
|
|
|
81
83
|
"webpack-dev-middleware": "5.3.3",
|
|
82
84
|
"webpack-manifest-plugin": "5.0.0",
|
|
83
85
|
"webpack-sources": "3.2.3",
|
|
86
|
+
"webpackbar": "5.0.2",
|
|
84
87
|
"ws": "8.5.0"
|
|
85
88
|
},
|
|
86
89
|
"publishConfig": {
|
|
@@ -117,6 +120,7 @@
|
|
|
117
120
|
"webpack-dev-middleware",
|
|
118
121
|
"webpack-manifest-plugin",
|
|
119
122
|
"webpack-sources",
|
|
123
|
+
"webpackbar",
|
|
120
124
|
"ws",
|
|
121
125
|
"./bundles/webpack/bundle"
|
|
122
126
|
],
|