@umijs/bundler-webpack 4.0.0-canary.20230831.1 → 4.0.0-canary.20230927.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/stylus-loader/LICENSE +20 -0
- package/compiled/stylus-loader/index.js +44 -0
- package/compiled/stylus-loader/package.json +1 -0
- package/compiled/webpack/index.js +16216 -7699
- package/compiled/webpack/lazy-compilation-node.js +10 -0
- package/compiled/webpack/lazy-compilation-web.js +9 -0
- package/dist/config/assetRules.js +1 -1
- package/dist/config/cssRules.js +9 -2
- package/dist/config/fastRefreshPlugin.js +1 -1
- package/dist/config/ssrPlugin.js +0 -2
- package/dist/index.js +8 -0
- package/dist/loader/svgr.js +0 -2
- package/dist/loader/swc.js +0 -2
- package/dist/plugins/ProgressPlugin.js +0 -2
- package/dist/plugins/_SamplePlugin.js +0 -2
- package/dist/schema.js +2 -0
- package/dist/swcPlugins/autoCSSModules.js +0 -2
- package/dist/swcPlugins/lockCoreJS.js +0 -2
- package/package.json +12 -9
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
5
|
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
|
|
9
|
+
* @returns {() => void} function to destroy response
|
|
10
|
+
*/
|
|
6
11
|
exports.keepAlive = function (options) {
|
|
7
12
|
var data = options.data;
|
|
8
13
|
var onError = options.onError;
|
|
9
14
|
var active = options.active;
|
|
10
15
|
var module = options.module;
|
|
16
|
+
/** @type {import("http").IncomingMessage} */
|
|
11
17
|
var response;
|
|
12
18
|
var request = (
|
|
13
19
|
urlBase.startsWith("https") ? require("https") : require("http")
|
|
@@ -27,6 +33,10 @@ exports.keepAlive = function (options) {
|
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {Error} err error
|
|
39
|
+
*/
|
|
30
40
|
function errorHandler(err) {
|
|
31
41
|
err.message =
|
|
32
42
|
"Problem communicating active modules to the server: " + err.message;
|
|
@@ -9,6 +9,7 @@ if (typeof EventSource !== "function") {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
|
|
12
|
+
/** @type {EventSource | undefined} */
|
|
12
13
|
var activeEventSource;
|
|
13
14
|
var activeKeys = new Map();
|
|
14
15
|
var errorHandlers = new Set();
|
|
@@ -19,6 +20,10 @@ var updateEventSource = function updateEventSource() {
|
|
|
19
20
|
activeEventSource = new EventSource(
|
|
20
21
|
urlBase + Array.from(activeKeys.keys()).join("@")
|
|
21
22
|
);
|
|
23
|
+
/**
|
|
24
|
+
* @this {EventSource}
|
|
25
|
+
* @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
|
|
26
|
+
*/
|
|
22
27
|
activeEventSource.onerror = function (event) {
|
|
23
28
|
errorHandlers.forEach(function (onError) {
|
|
24
29
|
onError(
|
|
@@ -42,6 +47,10 @@ var updateEventSource = function updateEventSource() {
|
|
|
42
47
|
}
|
|
43
48
|
};
|
|
44
49
|
|
|
50
|
+
/**
|
|
51
|
+
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
|
|
52
|
+
* @returns {() => void} function to destroy response
|
|
53
|
+
*/
|
|
45
54
|
exports.keepAlive = function (options) {
|
|
46
55
|
var data = options.data;
|
|
47
56
|
var onError = options.onError;
|
|
@@ -36,7 +36,7 @@ async function addAssetRules(opts) {
|
|
|
36
36
|
maxSize: inlineLimit
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
const fallback = rule.oneOf("fallback").exclude.add(/^$/).add(/\.(js|mjs|cjs|jsx|ts|tsx)$/).add(/\.(css|less|sass|scss|stylus)$/).add(/\.html$/).add(/\.json$/);
|
|
39
|
+
const fallback = rule.oneOf("fallback").exclude.add(/^$/).add(/\.(js|mjs|cjs|jsx|ts|tsx)$/).add(/\.(css|less|sass|scss|styl|stylus)$/).add(/\.html$/).add(/\.json$/);
|
|
40
40
|
if (userConfig.mdx) {
|
|
41
41
|
fallback.add(/\.mdx?$/);
|
|
42
42
|
}
|
package/dist/config/cssRules.js
CHANGED
|
@@ -55,8 +55,15 @@ async function addCSSRules(opts) {
|
|
|
55
55
|
test: /\.(sass|scss)(\?.*)?$/,
|
|
56
56
|
loader: require.resolve("@umijs/bundler-webpack/compiled/sass-loader"),
|
|
57
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 || {}
|
|
58
64
|
}
|
|
59
65
|
];
|
|
66
|
+
const cssPublicPath = userConfig.cssPublicPath || "./";
|
|
60
67
|
for (const { name, test, loader, loaderOptions } of rulesConfig) {
|
|
61
68
|
const rule = config.module.rule(name);
|
|
62
69
|
const nestRulesConfig = [
|
|
@@ -78,7 +85,7 @@ async function addCSSRules(opts) {
|
|
|
78
85
|
rule2.use("mini-css-extract-plugin").loader(
|
|
79
86
|
require.resolve("@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader")
|
|
80
87
|
).options({
|
|
81
|
-
publicPath:
|
|
88
|
+
publicPath: cssPublicPath,
|
|
82
89
|
emit: true,
|
|
83
90
|
esModule: true
|
|
84
91
|
});
|
|
@@ -134,7 +141,7 @@ async function addCSSRules(opts) {
|
|
|
134
141
|
}
|
|
135
142
|
});
|
|
136
143
|
if (loader) {
|
|
137
|
-
rule2.use(loader).loader(
|
|
144
|
+
rule2.use(`${name}-loader`).loader(loader).options(loaderOptions || {});
|
|
138
145
|
}
|
|
139
146
|
}
|
|
140
147
|
}
|
|
@@ -32,7 +32,7 @@ __export(fastRefreshPlugin_exports, {
|
|
|
32
32
|
addFastRefreshPlugin: () => addFastRefreshPlugin
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(fastRefreshPlugin_exports);
|
|
35
|
-
var import_lib = __toESM(require("@
|
|
35
|
+
var import_lib = __toESM(require("@umijs/react-refresh-webpack-plugin/lib"));
|
|
36
36
|
var import_constants = require("../constants");
|
|
37
37
|
var import_types = require("../types");
|
|
38
38
|
async function addFastRefreshPlugin(opts) {
|
package/dist/config/ssrPlugin.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -22,3 +22,11 @@ __reExport(src_exports, require("./config/config"), module.exports);
|
|
|
22
22
|
__reExport(src_exports, require("./dev"), module.exports);
|
|
23
23
|
__reExport(src_exports, require("./schema"), module.exports);
|
|
24
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
|
+
});
|
package/dist/loader/svgr.js
CHANGED
package/dist/loader/swc.js
CHANGED
package/dist/schema.js
CHANGED
|
@@ -77,6 +77,7 @@ function getSchemas() {
|
|
|
77
77
|
import_types.CSSMinifier.none
|
|
78
78
|
]),
|
|
79
79
|
cssMinifierOptions: ({ zod }) => zod.record(zod.string(), zod.any()),
|
|
80
|
+
cssPublicPath: ({ zod }) => zod.string(),
|
|
80
81
|
deadCode: ({ zod }) => zod.object({
|
|
81
82
|
context: zod.string(),
|
|
82
83
|
detectUnusedExport: zod.boolean(),
|
|
@@ -168,6 +169,7 @@ function getSchemas() {
|
|
|
168
169
|
swc: zod.record(zod.string(), zod.any())
|
|
169
170
|
}).deepPartial(),
|
|
170
171
|
styleLoader: ({ zod }) => zod.record(zod.string(), zod.any()),
|
|
172
|
+
stylusLoader: ({ zod }) => zod.record(zod.string(), zod.any()),
|
|
171
173
|
svgo: ({ zod }) => zod.union([zod.record(zod.string(), zod.any()), zod.boolean()]),
|
|
172
174
|
svgr: ({ zod }) => zod.record(zod.string(), zod.any()),
|
|
173
175
|
targets: ({ zod }) => zod.record(zod.string(), zod.any()),
|
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.20230927.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",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
25
24
|
"@svgr/core": "6.5.1",
|
|
26
25
|
"@svgr/plugin-jsx": "^6.5.1",
|
|
27
26
|
"@svgr/plugin-svgo": "^6.5.1",
|
|
28
27
|
"@types/hapi__joi": "17.1.9",
|
|
29
28
|
"@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
|
|
29
|
+
"@umijs/react-refresh-webpack-plugin": "0.5.11",
|
|
30
30
|
"cors": "^2.8.5",
|
|
31
31
|
"css-loader": "6.7.1",
|
|
32
32
|
"es5-imcompatible-versions": "^0.1.78",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"postcss-preset-env": "7.5.0",
|
|
39
39
|
"react-error-overlay": "6.0.9",
|
|
40
40
|
"react-refresh": "0.14.0",
|
|
41
|
-
"@umijs/babel-preset-umi": "4.0.0-canary.
|
|
42
|
-
"@umijs/bundler-utils": "4.0.0-canary.
|
|
43
|
-
"@umijs/mfsu": "4.0.0-canary.
|
|
44
|
-
"@umijs/utils": "4.0.0-canary.
|
|
41
|
+
"@umijs/babel-preset-umi": "4.0.0-canary.20230927.1",
|
|
42
|
+
"@umijs/bundler-utils": "4.0.0-canary.20230927.1",
|
|
43
|
+
"@umijs/mfsu": "4.0.0-canary.20230927.1",
|
|
44
|
+
"@umijs/utils": "4.0.0-canary.20230927.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@swc/core": "1.3.67",
|
|
@@ -66,12 +66,13 @@
|
|
|
66
66
|
"schema-utils": "4.0.0",
|
|
67
67
|
"speed-measure-webpack-plugin": "1.5.0",
|
|
68
68
|
"style-loader": "3.3.1",
|
|
69
|
+
"stylus-loader": "7.1.3",
|
|
69
70
|
"svgo-loader": "3.0.0",
|
|
70
71
|
"swc-plugin-auto-css-modules": "1.5.0",
|
|
71
72
|
"terser": "5.16.1",
|
|
72
73
|
"terser-webpack-plugin": "5.3.6",
|
|
73
74
|
"url-loader": "4.1.1",
|
|
74
|
-
"webpack": "5.
|
|
75
|
+
"webpack": "5.88.2",
|
|
75
76
|
"webpack-5-chain": "8.0.1",
|
|
76
77
|
"webpack-bundle-analyzer": "4.7.0",
|
|
77
78
|
"webpack-dev-middleware": "6.0.1",
|
|
@@ -117,7 +118,8 @@
|
|
|
117
118
|
"webpack-sources",
|
|
118
119
|
"webpackbar",
|
|
119
120
|
"ws",
|
|
120
|
-
"./bundles/webpack/bundle"
|
|
121
|
+
"./bundles/webpack/bundle",
|
|
122
|
+
"stylus-loader"
|
|
121
123
|
],
|
|
122
124
|
"externals": {
|
|
123
125
|
"@swc/core": "@swc/core",
|
|
@@ -178,7 +180,8 @@
|
|
|
178
180
|
"file-loader",
|
|
179
181
|
"webpack-bundle-analyzer",
|
|
180
182
|
"webpack-dev-middleware",
|
|
181
|
-
"webpack-manifest-plugin"
|
|
183
|
+
"webpack-manifest-plugin",
|
|
184
|
+
"stylus-loader"
|
|
182
185
|
]
|
|
183
186
|
},
|
|
184
187
|
"scripts": {
|