@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.
@@ -1,83 +1,171 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
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 __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.inlineStyle = void 0;
16
- // ref: https://github.com/hyrious/esbuild-plugin-style/blob/main/index.ts
17
- const esbuild_1 = __importDefault(require("@umijs/bundler-utils/compiled/esbuild"));
18
- const fs_1 = __importDefault(require("fs"));
19
- const path_1 = __importDefault(require("path"));
20
- // https://github.com/evanw/esbuild/issues/20#issuecomment-802269745
21
- function inlineStyle({ minify = true, charset = 'utf8', } = {}) {
22
- return {
23
- name: 'style',
24
- setup({ onResolve, onLoad }) {
25
- const cwd = process.cwd();
26
- const opt = {
27
- logLevel: 'silent',
28
- bundle: true,
29
- write: false,
30
- charset,
31
- minify,
32
- };
33
- onResolve({ filter: /\.css$/, namespace: 'file' }, (args) => {
34
- const absPath = path_1.default.join(args.resolveDir, args.path);
35
- const relPath = path_1.default.relative(cwd, absPath);
36
- const resolved = fs_1.default.existsSync(absPath) ? relPath : args.path;
37
- return { path: resolved, namespace: 'style-stub' };
38
- });
39
- onResolve({ filter: /\.css$/, namespace: 'style-stub' }, (args) => {
40
- return { path: args.path, namespace: 'style-content' };
41
- });
42
- onResolve({ filter: /^__style_helper__$/, namespace: 'style-stub' }, (args) => ({
43
- path: args.path,
44
- namespace: 'style-helper',
45
- sideEffects: false,
46
- }));
47
- onLoad({ filter: /.*/, namespace: 'style-helper' }, () => __awaiter(this, void 0, void 0, function* () {
48
- return ({
49
- contents: `
50
- export function injectStyle(text) {
51
- if (typeof document !== 'undefined') {
52
- var style = document.createElement('style')
53
- var node = document.createTextNode(text)
54
- style.appendChild(node)
55
- document.head.appendChild(style)
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
- onLoad({ filter: /.*/, namespace: 'style-stub' }, (args) => __awaiter(this, void 0, void 0, function* () {
62
- return ({
63
- contents: `
64
- import { injectStyle } from "__style_helper__"
65
- import css from ${JSON.stringify(args.path)}
66
- injectStyle(css)
67
- `,
68
- });
69
- }));
70
- onLoad({ filter: /.*/, namespace: 'style-content' }, (args) => __awaiter(this, void 0, void 0, function* () {
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
- exports.inlineStyle = inlineStyle;
168
+ // Annotate the CommonJS export names for ESM import in node:
169
+ 0 && (module.exports = {
170
+ style
171
+ });
@@ -0,0 +1,4 @@
1
+ import type { BuildFailure, BuildResult, Plugin } from '@umijs/bundler-utils/compiled/esbuild';
2
+ export declare function esbuildWatchRebuildPlugin(options: {
3
+ onRebuild: (error: BuildFailure | null, result: BuildResult | null) => void;
4
+ }): Plugin;
@@ -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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JSMinifier = exports.Env = void 0;
4
- var Env;
5
- (function (Env) {
6
- Env["development"] = "development";
7
- Env["production"] = "production";
8
- })(Env = exports.Env || (exports.Env = {}));
9
- var JSMinifier;
10
- (function (JSMinifier) {
11
- JSMinifier["terser"] = "terser";
12
- JSMinifier["esbuild"] = "esbuild";
13
- })(JSMinifier = exports.JSMinifier || (exports.JSMinifier = {}));
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,2 @@
1
+ import { IConfig } from '../types';
2
+ export declare function postcssProcess(config: IConfig, css: string, path: string): Promise<import("postcss").Result>;
@@ -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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortByAffix = void 0;
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
- return opts.arr.sort((a, b) => {
6
- if (a.endsWith(opts.affix) && b.endsWith(opts.affix))
7
- return 0;
8
- if (a.endsWith(opts.affix))
9
- return -1;
10
- if (b.endsWith(opts.affix))
11
- return 1;
12
- else
13
- return 0;
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
- exports.sortByAffix = sortByAffix;
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-beta.9",
3
+ "version": "4.0.0-canary-20240513.3",
4
4
  "description": "@umijs/bundler-esbuild",
5
- "homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-esbuild#readme",
6
- "bugs": "https://github.com/umijs/umi-next/issues",
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-next"
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
- "@umijs/bundler-utils": "4.0.0-beta.9",
27
- "@umijs/utils": "4.0.0-beta.9",
28
- "enhanced-resolve": "5.8.3",
29
- "less": "4.1.2"
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
- "@types/less": "^3.0.3"
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
+ }