@umijs/bundler-esbuild 4.0.0-beta.9 → 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/LICENSE +21 -0
- package/dist/build.d.ts +2 -2
- package/dist/build.js +97 -56
- package/dist/cli.js +63 -61
- package/dist/index.js +22 -12
- package/dist/plugins/__sample.js +30 -5
- package/dist/plugins/alias.js +89 -65
- package/dist/plugins/externals.d.ts +1 -1
- package/dist/plugins/externals.js +43 -21
- package/dist/plugins/less-plugin-alias/index.d.ts +9 -0
- package/dist/plugins/less-plugin-alias/index.js +100 -0
- package/dist/plugins/less-plugin-alias/types.d.ts +4 -0
- package/dist/plugins/less-plugin-alias/types.js +17 -0
- package/dist/plugins/less-plugin-alias/utils.d.ts +2 -0
- package/dist/plugins/less-plugin-alias/utils.js +60 -0
- package/dist/plugins/less.d.ts +7 -2
- package/dist/plugins/less.js +203 -49
- package/dist/plugins/nodeGlobalsPolyfill.js +36 -12
- package/dist/plugins/style.d.ts +4 -1
- package/dist/plugins/style.js +166 -78
- package/dist/plugins/watchRebuild.d.ts +4 -0
- package/dist/plugins/watchRebuild.js +67 -0
- package/dist/types.d.ts +11 -3
- package/dist/types.js +40 -13
- package/dist/utils/getBrowserlist.d.ts +1 -0
- package/dist/utils/getBrowserlist.js +33 -0
- package/dist/utils/postcssProcess.d.ts +2 -0
- package/dist/utils/postcssProcess.js +58 -0
- package/dist/utils/sortByAffix.js +38 -14
- package/package.json +19 -16
package/dist/plugins/style.js
CHANGED
|
@@ -1,83 +1,171 @@
|
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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/plugins/style.ts
|
|
30
|
+
var style_exports = {};
|
|
31
|
+
__export(style_exports, {
|
|
32
|
+
style: () => style
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(style_exports);
|
|
35
|
+
var import_esbuild = __toESM(require("@umijs/bundler-utils/compiled/esbuild"));
|
|
36
|
+
var import_utils = require("@umijs/utils");
|
|
37
|
+
var import_fs = __toESM(require("fs"));
|
|
38
|
+
var import_path = __toESM(require("path"));
|
|
39
|
+
var import_postcssProcess = require("../utils/postcssProcess");
|
|
40
|
+
function style({
|
|
41
|
+
minify = true,
|
|
42
|
+
charset = "utf8",
|
|
43
|
+
inlineStyle,
|
|
44
|
+
config
|
|
45
|
+
} = {}) {
|
|
46
|
+
return {
|
|
47
|
+
name: "style",
|
|
48
|
+
setup({ onResolve, onLoad }) {
|
|
49
|
+
const cwd = process.cwd();
|
|
50
|
+
const opt = {
|
|
51
|
+
logLevel: "silent",
|
|
52
|
+
bundle: true,
|
|
53
|
+
write: false,
|
|
54
|
+
charset,
|
|
55
|
+
minify,
|
|
56
|
+
loader: {
|
|
57
|
+
// images
|
|
58
|
+
".svg": "dataurl",
|
|
59
|
+
".png": "dataurl",
|
|
60
|
+
".jpg": "dataurl",
|
|
61
|
+
".jpeg": "dataurl",
|
|
62
|
+
".gif": "dataurl",
|
|
63
|
+
".ico": "dataurl",
|
|
64
|
+
".webp": "dataurl",
|
|
65
|
+
// font
|
|
66
|
+
".ttf": "dataurl",
|
|
67
|
+
".otf": "dataurl",
|
|
68
|
+
".woff": "dataurl",
|
|
69
|
+
".woff2": "dataurl",
|
|
70
|
+
".eot": "dataurl"
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
onResolve({ filter: /\.css$/, namespace: "file" }, (args) => {
|
|
74
|
+
const absPath = import_path.default.resolve(
|
|
75
|
+
cwd,
|
|
76
|
+
import_path.default.relative(cwd, args.resolveDir),
|
|
77
|
+
args.path
|
|
78
|
+
);
|
|
79
|
+
const resolved = import_fs.default.existsSync(absPath) ? absPath : import_utils.resolve.sync(`${args.path}`, {
|
|
80
|
+
basedir: args.resolveDir
|
|
81
|
+
});
|
|
82
|
+
return { path: resolved, namespace: inlineStyle ? "style-stub" : "" };
|
|
83
|
+
});
|
|
84
|
+
if (inlineStyle) {
|
|
85
|
+
onResolve({ filter: /\.css$/, namespace: "style-stub" }, (args) => {
|
|
86
|
+
return { path: args.path, namespace: "style-content" };
|
|
87
|
+
});
|
|
88
|
+
onResolve(
|
|
89
|
+
{ filter: /^__style_helper__$/, namespace: "style-stub" },
|
|
90
|
+
(args) => ({
|
|
91
|
+
path: args.path,
|
|
92
|
+
namespace: "style-helper",
|
|
93
|
+
sideEffects: false
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
onLoad({ filter: /.*/, namespace: "style-helper" }, async () => ({
|
|
97
|
+
contents: `
|
|
98
|
+
export function injectStyle(text) {
|
|
99
|
+
if (typeof document !== 'undefined') {
|
|
100
|
+
var style = document.createElement('style')
|
|
101
|
+
var node = document.createTextNode(text)
|
|
102
|
+
style.appendChild(node)
|
|
103
|
+
document.head.appendChild(style)
|
|
104
|
+
}
|
|
56
105
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const options = Object.assign({ entryPoints: [args.path] }, opt);
|
|
72
|
-
const { errors, warnings, outputFiles } = yield esbuild_1.default.build(options);
|
|
73
|
-
return {
|
|
74
|
-
errors,
|
|
75
|
-
warnings,
|
|
76
|
-
contents: outputFiles[0].text,
|
|
77
|
-
loader: 'text',
|
|
78
|
-
};
|
|
79
|
-
}));
|
|
106
|
+
`
|
|
107
|
+
}));
|
|
108
|
+
onLoad({ filter: /.*/, namespace: "style-stub" }, async (args) => ({
|
|
109
|
+
contents: `
|
|
110
|
+
import { injectStyle } from "__style_helper__"
|
|
111
|
+
import css from ${JSON.stringify(args.path)}
|
|
112
|
+
injectStyle(css)
|
|
113
|
+
`
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
onLoad(
|
|
117
|
+
{
|
|
118
|
+
filter: inlineStyle ? /.*/ : /\.css$/,
|
|
119
|
+
namespace: inlineStyle ? "style-content" : "file"
|
|
80
120
|
},
|
|
81
|
-
|
|
121
|
+
async (args) => {
|
|
122
|
+
const options = { entryPoints: [args.path], ...opt };
|
|
123
|
+
const { errors, warnings, outputFiles } = await import_esbuild.default.build(
|
|
124
|
+
options
|
|
125
|
+
);
|
|
126
|
+
if (errors.length > 0) {
|
|
127
|
+
return {
|
|
128
|
+
errors,
|
|
129
|
+
warnings,
|
|
130
|
+
contents: outputFiles[0].text,
|
|
131
|
+
loader: "text"
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
const dir = import_path.default.dirname(args.path);
|
|
135
|
+
try {
|
|
136
|
+
const result = await (0, import_postcssProcess.postcssProcess)(
|
|
137
|
+
config,
|
|
138
|
+
outputFiles[0].text,
|
|
139
|
+
args.path
|
|
140
|
+
);
|
|
141
|
+
return {
|
|
142
|
+
errors,
|
|
143
|
+
warnings,
|
|
144
|
+
contents: result.css,
|
|
145
|
+
loader: inlineStyle ? "text" : "css"
|
|
146
|
+
};
|
|
147
|
+
} catch (error) {
|
|
148
|
+
return {
|
|
149
|
+
errors: [
|
|
150
|
+
{
|
|
151
|
+
text: error.message,
|
|
152
|
+
location: {
|
|
153
|
+
namespace: "file",
|
|
154
|
+
file: error.filename,
|
|
155
|
+
line: error.line,
|
|
156
|
+
column: error.column
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
resolveDir: dir
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
82
167
|
}
|
|
83
|
-
|
|
168
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
169
|
+
0 && (module.exports = {
|
|
170
|
+
style
|
|
171
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
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/plugins/watchRebuild.ts
|
|
20
|
+
var watchRebuild_exports = {};
|
|
21
|
+
__export(watchRebuild_exports, {
|
|
22
|
+
esbuildWatchRebuildPlugin: () => esbuildWatchRebuildPlugin
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(watchRebuild_exports);
|
|
25
|
+
function failureErrorWithLog(text, errors, warnings) {
|
|
26
|
+
let limit = 5;
|
|
27
|
+
let summary = errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e, i) => {
|
|
28
|
+
if (i === limit)
|
|
29
|
+
return "\n...";
|
|
30
|
+
if (!e.location)
|
|
31
|
+
return `
|
|
32
|
+
error: ${e.text}`;
|
|
33
|
+
let { file, line, column } = e.location;
|
|
34
|
+
let pluginText = e.pluginName ? `[plugin: ${e.pluginName}] ` : "";
|
|
35
|
+
return `
|
|
36
|
+
${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
|
|
37
|
+
}).join("");
|
|
38
|
+
let error = new Error(`${text}${summary}`);
|
|
39
|
+
error.errors = errors;
|
|
40
|
+
error.warnings = warnings;
|
|
41
|
+
return error;
|
|
42
|
+
}
|
|
43
|
+
function esbuildWatchRebuildPlugin(options) {
|
|
44
|
+
return {
|
|
45
|
+
name: "watch-rebuild-plugin",
|
|
46
|
+
setup(build) {
|
|
47
|
+
let count = 0;
|
|
48
|
+
build.onEnd((result) => {
|
|
49
|
+
if (count++ === 0) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (result.errors.length > 0) {
|
|
53
|
+
options.onRebuild(
|
|
54
|
+
failureErrorWithLog("Build failed", result.errors, result.warnings),
|
|
55
|
+
null
|
|
56
|
+
);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
options.onRebuild(null, result);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
esbuildWatchRebuildPlugin
|
|
67
|
+
});
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TransformOptions } from '@umijs/bundler-utils/compiled/esbuild';
|
|
1
|
+
import { BuildOptions, TransformOptions } from '@umijs/bundler-utils/compiled/esbuild';
|
|
2
|
+
import type { Plugin } from '@umijs/bundler-vite/compiled/vite';
|
|
2
3
|
export declare enum Env {
|
|
3
4
|
development = "development",
|
|
4
5
|
production = "production"
|
|
@@ -11,9 +12,11 @@ export interface ICopy {
|
|
|
11
12
|
from: string;
|
|
12
13
|
to: string;
|
|
13
14
|
}
|
|
14
|
-
export declare type IBabelPlugin = string | [string, {
|
|
15
|
+
export declare type IBabelPlugin = Function | string | [string, {
|
|
15
16
|
[key: string]: any;
|
|
16
|
-
}]
|
|
17
|
+
}] | [string, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}, string];
|
|
17
20
|
export interface IConfig {
|
|
18
21
|
alias?: Record<string, string>;
|
|
19
22
|
autoCSSModules?: boolean;
|
|
@@ -29,6 +32,9 @@ export interface IConfig {
|
|
|
29
32
|
hash?: boolean;
|
|
30
33
|
inlineLimit?: number;
|
|
31
34
|
manifest?: boolean;
|
|
35
|
+
normalCSSLoaderModules?: {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
};
|
|
32
38
|
jsMinifier?: JSMinifier | boolean;
|
|
33
39
|
jsMinifierOptions?: {
|
|
34
40
|
[key: string]: any;
|
|
@@ -48,5 +54,7 @@ export interface IConfig {
|
|
|
48
54
|
targets?: {
|
|
49
55
|
[key: string]: any;
|
|
50
56
|
};
|
|
57
|
+
loader?: BuildOptions['loader'];
|
|
58
|
+
modifyConfig?: (config: BuildOptions) => void | Promise<void>;
|
|
51
59
|
[key: string]: any;
|
|
52
60
|
}
|
package/dist/types.js
CHANGED
|
@@ -1,13 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
var
|
|
10
|
-
(function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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/types.ts
|
|
20
|
+
var types_exports = {};
|
|
21
|
+
__export(types_exports, {
|
|
22
|
+
Env: () => Env,
|
|
23
|
+
JSMinifier: () => JSMinifier
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(types_exports);
|
|
26
|
+
var Env = /* @__PURE__ */ ((Env2) => {
|
|
27
|
+
Env2["development"] = "development";
|
|
28
|
+
Env2["production"] = "production";
|
|
29
|
+
return Env2;
|
|
30
|
+
})(Env || {});
|
|
31
|
+
var JSMinifier = /* @__PURE__ */ ((JSMinifier2) => {
|
|
32
|
+
JSMinifier2["terser"] = "terser";
|
|
33
|
+
JSMinifier2["esbuild"] = "esbuild";
|
|
34
|
+
return JSMinifier2;
|
|
35
|
+
})(JSMinifier || {});
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
Env,
|
|
39
|
+
JSMinifier
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getBrowserlist(targets: Record<string, string | boolean>): string | true | string[];
|
|
@@ -0,0 +1,33 @@
|
|
|
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/utils/getBrowserlist.ts
|
|
20
|
+
var getBrowserlist_exports = {};
|
|
21
|
+
__export(getBrowserlist_exports, {
|
|
22
|
+
getBrowserlist: () => getBrowserlist
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(getBrowserlist_exports);
|
|
25
|
+
function getBrowserlist(targets) {
|
|
26
|
+
return targets.browsers || Object.keys(targets).map((key) => {
|
|
27
|
+
return `${key} >= ${targets[key] === true ? "0" : targets[key]}`;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
getBrowserlist
|
|
33
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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/utils/postcssProcess.ts
|
|
30
|
+
var postcssProcess_exports = {};
|
|
31
|
+
__export(postcssProcess_exports, {
|
|
32
|
+
postcssProcess: () => postcssProcess
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(postcssProcess_exports);
|
|
35
|
+
var import_postcss = __toESM(require("postcss"));
|
|
36
|
+
var import_getBrowserlist = require("./getBrowserlist");
|
|
37
|
+
async function postcssProcess(config, css, path) {
|
|
38
|
+
return await (0, import_postcss.default)(
|
|
39
|
+
[
|
|
40
|
+
require("postcss-flexbugs-fixes"),
|
|
41
|
+
require("postcss-preset-env")({
|
|
42
|
+
browsers: (0, import_getBrowserlist.getBrowserlist)((config == null ? void 0 : config.targets) || {}),
|
|
43
|
+
autoprefixer: {
|
|
44
|
+
flexbox: "no-2009",
|
|
45
|
+
...config == null ? void 0 : config.autoprefixer
|
|
46
|
+
},
|
|
47
|
+
stage: 3
|
|
48
|
+
})
|
|
49
|
+
].concat((config == null ? void 0 : config.extraPostCSSPlugins) || [])
|
|
50
|
+
).process(css, {
|
|
51
|
+
from: path,
|
|
52
|
+
to: path
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
postcssProcess
|
|
58
|
+
});
|
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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/utils/sortByAffix.ts
|
|
20
|
+
var sortByAffix_exports = {};
|
|
21
|
+
__export(sortByAffix_exports, {
|
|
22
|
+
sortByAffix: () => sortByAffix
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(sortByAffix_exports);
|
|
4
25
|
function sortByAffix(opts) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
return opts.arr.sort((a, b) => {
|
|
27
|
+
if (a.endsWith(opts.affix) && b.endsWith(opts.affix))
|
|
28
|
+
return 0;
|
|
29
|
+
if (a.endsWith(opts.affix))
|
|
30
|
+
return -1;
|
|
31
|
+
if (b.endsWith(opts.affix))
|
|
32
|
+
return 1;
|
|
33
|
+
else
|
|
34
|
+
return 0;
|
|
35
|
+
});
|
|
15
36
|
}
|
|
16
|
-
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
sortByAffix
|
|
40
|
+
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-esbuild",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-canary-20240513.3",
|
|
4
4
|
"description": "@umijs/bundler-esbuild",
|
|
5
|
-
"homepage": "https://github.com/umijs/umi
|
|
6
|
-
"bugs": "https://github.com/umijs/umi
|
|
5
|
+
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-esbuild#readme",
|
|
6
|
+
"bugs": "https://github.com/umijs/umi/issues",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/umijs/umi
|
|
9
|
+
"url": "https://github.com/umijs/umi"
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"main": "dist/index.js",
|
|
@@ -17,24 +17,27 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "pnpm tsc",
|
|
22
|
-
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
|
|
23
|
-
"dev": "pnpm build -- --watch"
|
|
24
|
-
},
|
|
25
20
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
21
|
+
"enhanced-resolve": "5.9.3",
|
|
22
|
+
"postcss": "^8.4.21",
|
|
23
|
+
"postcss-flexbugs-fixes": "5.0.2",
|
|
24
|
+
"postcss-preset-env": "7.5.0",
|
|
25
|
+
"@umijs/bundler-utils": "4.0.0-canary-20240513.3",
|
|
26
|
+
"@umijs/utils": "4.0.0-canary-20240513.3"
|
|
30
27
|
},
|
|
31
28
|
"devDependencies": {
|
|
32
|
-
"@
|
|
29
|
+
"@alitajs/postcss-plugin-px2rem": "^0.0.1"
|
|
33
30
|
},
|
|
34
31
|
"publishConfig": {
|
|
35
32
|
"access": "public"
|
|
36
33
|
},
|
|
37
34
|
"authors": [
|
|
38
35
|
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
39
|
-
]
|
|
40
|
-
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "umi-scripts father build",
|
|
39
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
40
|
+
"dev": "umi-scripts father dev",
|
|
41
|
+
"test": "umi-scripts jest-turbo"
|
|
42
|
+
}
|
|
43
|
+
}
|