@umijs/bundler-esbuild 4.0.0-beta.10

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @umijs/bundler-esbuild
2
+
3
+ See our website [umijs](https://umijs.org) for more information.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/cli');
@@ -0,0 +1,19 @@
1
+ import { Format } from '@umijs/bundler-utils/compiled/esbuild';
2
+ import { IBabelPlugin, IConfig } from './types';
3
+ interface IOpts {
4
+ cwd: string;
5
+ entry: Record<string, string>;
6
+ config: IConfig;
7
+ mode?: string;
8
+ onBuildComplete?: Function;
9
+ clean?: boolean;
10
+ format?: Format;
11
+ sourcemap?: boolean | 'inline' | 'external' | 'both';
12
+ beforeBabelPlugins?: any[];
13
+ beforeBabelPresets?: any[];
14
+ extraBabelPlugins?: IBabelPlugin[];
15
+ extraBabelPresets?: IBabelPlugin[];
16
+ inlineStyle?: boolean;
17
+ }
18
+ export declare function build(opts: IOpts): Promise<import("@umijs/bundler-utils/compiled/esbuild").BuildResult>;
19
+ export {};
package/dist/build.js ADDED
@@ -0,0 +1,61 @@
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
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.build = void 0;
16
+ const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
17
+ const utils_1 = require("@umijs/utils");
18
+ const path_1 = require("path");
19
+ const alias_1 = __importDefault(require("./plugins/alias"));
20
+ const externals_1 = __importDefault(require("./plugins/externals"));
21
+ const less_1 = __importDefault(require("./plugins/less"));
22
+ const style_1 = require("./plugins/style");
23
+ function build(opts) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const outputPath = opts.config.outputPath || (0, path_1.join)(opts.cwd, 'dist');
26
+ if (opts.clean) {
27
+ utils_1.rimraf.sync(outputPath);
28
+ }
29
+ return yield (0, esbuild_1.build)({
30
+ entryPoints: opts.entry,
31
+ bundle: true,
32
+ format: opts.format || 'iife',
33
+ logLevel: 'error',
34
+ // splitting: true,
35
+ sourcemap: opts.sourcemap,
36
+ outdir: outputPath,
37
+ metafile: true,
38
+ plugins: [
39
+ (0, less_1.default)(Object.assign({ modifyVars: opts.config.theme, javascriptEnabled: true }, opts.config.lessLoader)),
40
+ opts.config.alias && (0, alias_1.default)(addCwdPrefix(opts.config.alias, opts.cwd)),
41
+ opts.config.externals && (0, externals_1.default)(opts.config.externals),
42
+ opts.inlineStyle && (0, style_1.inlineStyle)(),
43
+ ].filter(Boolean),
44
+ define: {
45
+ // __dirname sham
46
+ __dirname: JSON.stringify('__dirname'),
47
+ 'process.env.NODE_ENV': JSON.stringify(opts.mode || 'development'),
48
+ },
49
+ });
50
+ });
51
+ }
52
+ exports.build = build;
53
+ // TODO: move to api.describe({ config: { format } })
54
+ function addCwdPrefix(obj, cwd) {
55
+ Object.keys(obj).forEach((key) => {
56
+ if (obj[key].startsWith('.')) {
57
+ obj[key] = (0, utils_1.winPath)((0, path_1.join)(cwd, obj[key]));
58
+ }
59
+ });
60
+ return obj;
61
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,72 @@
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
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const esbuild_1 = __importDefault(require("@umijs/bundler-utils/compiled/esbuild"));
16
+ const utils_1 = require("@umijs/utils");
17
+ const assert_1 = __importDefault(require("assert"));
18
+ const fs_1 = require("fs");
19
+ const path_1 = require("path");
20
+ const build_1 = require("./build");
21
+ const args = (0, utils_1.yParser)(process.argv.slice(2), {});
22
+ const command = args._[0];
23
+ const cwd = process.cwd();
24
+ const entry = tryPaths([
25
+ (0, path_1.join)(cwd, 'src/index.tsx'),
26
+ (0, path_1.join)(cwd, 'src/index.ts'),
27
+ (0, path_1.join)(cwd, 'index.tsx'),
28
+ (0, path_1.join)(cwd, 'index.ts'),
29
+ ]);
30
+ let config = {};
31
+ const configFile = (0, path_1.join)(cwd, args.config || 'config.ts');
32
+ utils_1.register.register({
33
+ implementor: esbuild_1.default,
34
+ });
35
+ utils_1.register.clearFiles();
36
+ if ((0, fs_1.existsSync)(configFile)) {
37
+ config = require(configFile).default;
38
+ }
39
+ Object.assign(config, args);
40
+ if (command === 'build') {
41
+ (() => __awaiter(void 0, void 0, void 0, function* () {
42
+ process.env.NODE_ENV = 'production';
43
+ (0, assert_1.default)(entry, `Build failed: entry not found.`);
44
+ try {
45
+ yield (0, build_1.build)({
46
+ config,
47
+ cwd,
48
+ entry: {
49
+ [getEntryKey(entry)]: entry,
50
+ },
51
+ });
52
+ }
53
+ catch (e) {
54
+ console.error(e);
55
+ }
56
+ }))();
57
+ }
58
+ else {
59
+ error(`Unsupported command ${command}.`);
60
+ }
61
+ function error(msg) {
62
+ console.error(utils_1.chalk.red(msg));
63
+ }
64
+ function tryPaths(paths) {
65
+ for (const path of paths) {
66
+ if ((0, fs_1.existsSync)(path))
67
+ return path;
68
+ }
69
+ }
70
+ function getEntryKey(path) {
71
+ return (0, path_1.basename)(path, (0, path_1.extname)(path));
72
+ }
@@ -0,0 +1 @@
1
+ export * from './build';
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./build"), exports);
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '@umijs/bundler-utils/compiled/esbuild';
2
+ export declare function Sample(): Plugin;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sample = void 0;
4
+ function Sample() {
5
+ return { name: '', setup() { } };
6
+ }
7
+ exports.Sample = Sample;
@@ -0,0 +1,3 @@
1
+ import { Plugin } from '@umijs/bundler-utils/compiled/esbuild';
2
+ declare const _default: (options?: Record<string, string>) => Plugin;
3
+ export default _default;
@@ -0,0 +1,72 @@
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
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const enhanced_resolve_1 = __importDefault(require("enhanced-resolve"));
16
+ const fs_1 = require("fs");
17
+ const sortByAffix_1 = require("../utils/sortByAffix");
18
+ const resolver = enhanced_resolve_1.default.create({
19
+ mainFields: ['module', 'browser', 'main'],
20
+ extensions: ['.json', '.js', '.jsx', '.ts', '.tsx', '.cjs', '.mjs'],
21
+ // TODO: support exports
22
+ exportsFields: [],
23
+ });
24
+ function resolve(context, path) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ return new Promise((resolve, reject) => {
27
+ resolver(context, path, (err, result) => err ? reject(err) : resolve(result));
28
+ });
29
+ });
30
+ }
31
+ // https://esbuild.github.io/plugins/#resolve-callbacks
32
+ exports.default = (options = {}) => {
33
+ return {
34
+ name: 'alias',
35
+ setup({ onResolve }) {
36
+ const keys = (0, sortByAffix_1.sortByAffix)({ arr: Object.keys(options), affix: '$' });
37
+ keys.forEach((key) => {
38
+ let value = options[key];
39
+ let filter;
40
+ if (key.endsWith('$')) {
41
+ filter = new RegExp(`^${key}`);
42
+ }
43
+ else {
44
+ filter = new RegExp(`^${key}$`);
45
+ }
46
+ onResolve({ filter: filter }, (args) => __awaiter(this, void 0, void 0, function* () {
47
+ const path = yield resolve(args.importer, args.path.replace(filter, value));
48
+ return {
49
+ path,
50
+ };
51
+ }));
52
+ if (!key.endsWith('/') &&
53
+ (0, fs_1.existsSync)(value) &&
54
+ (0, fs_1.statSync)(value).isDirectory()) {
55
+ const filter = new RegExp(`^${addSlashAffix(key)}`);
56
+ onResolve({ filter }, (args) => __awaiter(this, void 0, void 0, function* () {
57
+ const path = yield resolve(args.importer, args.path.replace(filter, addSlashAffix(value)));
58
+ return {
59
+ path,
60
+ };
61
+ }));
62
+ }
63
+ });
64
+ },
65
+ };
66
+ };
67
+ function addSlashAffix(key) {
68
+ if (key.endsWith('/')) {
69
+ return key;
70
+ }
71
+ return `${key}/`;
72
+ }
@@ -0,0 +1,3 @@
1
+ import { Plugin } from '@umijs/bundler-utils/compiled/esbuild';
2
+ declare const _default: (options?: Record<string, string> | undefined) => Plugin;
3
+ export default _default;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (options) => {
4
+ return {
5
+ name: 'externals',
6
+ setup({ onLoad, onResolve }) {
7
+ if (!options || Object.keys(options).length === 0) {
8
+ return;
9
+ }
10
+ Object.keys(options).forEach((key) => {
11
+ onResolve({ filter: new RegExp(`^${key}$`) }, (args) => ({
12
+ path: args.path,
13
+ namespace: key,
14
+ }));
15
+ onLoad({ filter: /.*/, namespace: key }, () => ({
16
+ contents: `module.export=${options[key]}`,
17
+ loader: 'js',
18
+ }));
19
+ });
20
+ },
21
+ };
22
+ };
@@ -0,0 +1,4 @@
1
+ /// <reference types="less" />
2
+ import { Plugin } from '@umijs/bundler-utils/compiled/esbuild';
3
+ declare const _default: (options?: Less.Options) => Plugin;
4
+ export default _default;
@@ -0,0 +1,53 @@
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
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const fs_1 = require("fs");
16
+ const less_1 = __importDefault(require("less"));
17
+ const path_1 = __importDefault(require("path"));
18
+ exports.default = (options = {}) => {
19
+ return {
20
+ name: 'less',
21
+ setup({ onLoad }) {
22
+ onLoad({ filter: /\.less$/, namespace: 'file' }, (args) => __awaiter(this, void 0, void 0, function* () {
23
+ const content = yield fs_1.promises.readFile(args.path, 'utf-8');
24
+ const dir = path_1.default.dirname(args.path);
25
+ const filename = path_1.default.basename(args.path);
26
+ try {
27
+ const result = yield less_1.default.render(content, Object.assign(Object.assign({ filename, rootpath: dir }, options), { paths: [...(options.paths || []), dir] }));
28
+ return {
29
+ contents: result.css,
30
+ loader: 'css',
31
+ resolveDir: dir,
32
+ };
33
+ }
34
+ catch (error) {
35
+ return {
36
+ errors: [
37
+ {
38
+ text: error.message,
39
+ location: {
40
+ namespace: 'file',
41
+ file: error.filename,
42
+ line: error.line,
43
+ column: error.column,
44
+ },
45
+ },
46
+ ],
47
+ resolveDir: dir,
48
+ };
49
+ }
50
+ }));
51
+ },
52
+ };
53
+ };
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '@umijs/bundler-utils/compiled/esbuild';
2
+ export declare function nodeGlobalsPolyfill(): Plugin;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeGlobalsPolyfill = void 0;
4
+ function nodeGlobalsPolyfill() {
5
+ return {
6
+ name: 'node-globals-polyfill',
7
+ setup({ initialOptions, onResolve, onLoad }) {
8
+ onResolve;
9
+ onLoad;
10
+ initialOptions.inject || (initialOptions.inject = []);
11
+ },
12
+ };
13
+ }
14
+ exports.nodeGlobalsPolyfill = nodeGlobalsPolyfill;
@@ -0,0 +1,14 @@
1
+ import { Charset, Plugin } from '@umijs/bundler-utils/compiled/esbuild';
2
+ export interface StylePluginOptions {
3
+ /**
4
+ * whether to minify the css code.
5
+ * @default true
6
+ */
7
+ minify?: boolean;
8
+ /**
9
+ * css charset.
10
+ * @default 'utf8'
11
+ */
12
+ charset?: Charset;
13
+ }
14
+ export declare function inlineStyle({ minify, charset, }?: StylePluginOptions): Plugin;
@@ -0,0 +1,83 @@
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
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
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)
56
+ }
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
+ }));
80
+ },
81
+ };
82
+ }
83
+ exports.inlineStyle = inlineStyle;
@@ -0,0 +1,52 @@
1
+ import { TransformOptions } from '@umijs/bundler-utils/compiled/esbuild';
2
+ export declare enum Env {
3
+ development = "development",
4
+ production = "production"
5
+ }
6
+ export declare enum JSMinifier {
7
+ terser = "terser",
8
+ esbuild = "esbuild"
9
+ }
10
+ export interface ICopy {
11
+ from: string;
12
+ to: string;
13
+ }
14
+ export declare type IBabelPlugin = string | [string, {
15
+ [key: string]: any;
16
+ }];
17
+ export interface IConfig {
18
+ alias?: Record<string, string>;
19
+ autoCSSModules?: boolean;
20
+ autoprefixer?: any;
21
+ copy?: ICopy[] | string[];
22
+ define?: {
23
+ [key: string]: any;
24
+ };
25
+ extraBabelPlugins?: IBabelPlugin[];
26
+ extraBabelPresets?: IBabelPlugin[];
27
+ extraPostCSSPlugins?: any[];
28
+ extraVitePlugins?: Plugin[];
29
+ hash?: boolean;
30
+ inlineLimit?: number;
31
+ manifest?: boolean;
32
+ jsMinifier?: JSMinifier | boolean;
33
+ jsMinifierOptions?: {
34
+ [key: string]: any;
35
+ };
36
+ lessLoader?: {
37
+ lessOptions: any;
38
+ };
39
+ outputPath?: string;
40
+ polyfill?: {
41
+ imports: string[];
42
+ };
43
+ postcssLoader?: {
44
+ postcssOptions: any;
45
+ };
46
+ publicPath?: string;
47
+ svgr?: TransformOptions;
48
+ targets?: {
49
+ [key: string]: any;
50
+ };
51
+ [key: string]: any;
52
+ }
package/dist/types.js ADDED
@@ -0,0 +1,13 @@
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 = {}));
@@ -0,0 +1,4 @@
1
+ export declare function sortByAffix(opts: {
2
+ arr: string[];
3
+ affix: string;
4
+ }): string[];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortByAffix = void 0;
4
+ 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
+ });
15
+ }
16
+ exports.sortByAffix = sortByAffix;
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@umijs/bundler-esbuild",
3
+ "version": "4.0.0-beta.10",
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",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/umijs/umi-next"
10
+ },
11
+ "license": "MIT",
12
+ "main": "dist/index.js",
13
+ "types": "dist/index.d.ts",
14
+ "bin": {
15
+ "bundler-esbuild": "bin/bundler-esbuild.js"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "build": "pnpm tsc",
22
+ "build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
23
+ "dev": "pnpm build -- --watch"
24
+ },
25
+ "dependencies": {
26
+ "@umijs/bundler-utils": "4.0.0-beta.10",
27
+ "@umijs/utils": "4.0.0-beta.10",
28
+ "enhanced-resolve": "5.8.3",
29
+ "less": "4.1.2"
30
+ },
31
+ "devDependencies": {
32
+ "@types/less": "^3.0.3"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "authors": [
38
+ "chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
39
+ ]
40
+ }