@doracli/esbuild 0.0.1 → 0.0.2
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/lib/cjs/index.js +592 -1
- package/lib/esm/index.js +573 -1
- package/lib/type/index.d.ts +348 -16
- package/package.json +6 -6
package/lib/type/index.d.ts
CHANGED
|
@@ -1,10 +1,277 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
|
-
import { BuildOptions } from 'esbuild';
|
|
2
|
+
import { BuildOptions, BuildResult, ServeResult, WatchOptions, ServeOptions } from 'esbuild';
|
|
3
|
+
export { BuildOptions } from 'esbuild';
|
|
4
|
+
import { CompilerBase, ConfigCtx } from '@doracli/helper';
|
|
3
5
|
import { TCdn, TDoraConfig } from '@doracli/type';
|
|
4
|
-
import { ConfigCtx } from '@doracli/helper';
|
|
5
6
|
|
|
6
7
|
declare const builder: (config: BuildOptions) => Promise<esbuild.BuildResult<BuildOptions>>;
|
|
7
8
|
|
|
9
|
+
declare class Compiler extends CompilerBase<BuildOptions, {
|
|
10
|
+
build: Promise<BuildResult<BuildOptions>>;
|
|
11
|
+
watch: Promise<void>;
|
|
12
|
+
server: Promise<ServeResult>;
|
|
13
|
+
}> {
|
|
14
|
+
constructor(config: Partial<BuildOptions>);
|
|
15
|
+
inOutMap: (inputOutputMap: Record<string, string>) => Promise<BuildResult<{
|
|
16
|
+
bundle?: boolean;
|
|
17
|
+
splitting?: boolean;
|
|
18
|
+
preserveSymlinks?: boolean;
|
|
19
|
+
outfile?: string;
|
|
20
|
+
metafile?: boolean;
|
|
21
|
+
outdir?: string;
|
|
22
|
+
outbase?: string;
|
|
23
|
+
external?: string[];
|
|
24
|
+
packages?: "bundle" | "external";
|
|
25
|
+
alias?: Record<string, string>;
|
|
26
|
+
loader?: {
|
|
27
|
+
[ext: string]: esbuild.Loader;
|
|
28
|
+
};
|
|
29
|
+
resolveExtensions?: string[];
|
|
30
|
+
mainFields?: string[];
|
|
31
|
+
conditions?: string[];
|
|
32
|
+
write?: boolean;
|
|
33
|
+
allowOverwrite?: boolean;
|
|
34
|
+
tsconfig?: string;
|
|
35
|
+
outExtension?: {
|
|
36
|
+
[ext: string]: string;
|
|
37
|
+
};
|
|
38
|
+
publicPath?: string;
|
|
39
|
+
entryNames?: string;
|
|
40
|
+
chunkNames?: string;
|
|
41
|
+
assetNames?: string;
|
|
42
|
+
inject?: string[];
|
|
43
|
+
banner?: {
|
|
44
|
+
[type: string]: string;
|
|
45
|
+
};
|
|
46
|
+
footer?: {
|
|
47
|
+
[type: string]: string;
|
|
48
|
+
};
|
|
49
|
+
entryPoints?: (string | {
|
|
50
|
+
in: string;
|
|
51
|
+
out: string;
|
|
52
|
+
})[] | Record<string, string>;
|
|
53
|
+
stdin?: esbuild.StdinOptions;
|
|
54
|
+
plugins?: esbuild.Plugin[];
|
|
55
|
+
absWorkingDir?: string;
|
|
56
|
+
nodePaths?: string[];
|
|
57
|
+
sourcemap?: boolean | "linked" | "inline" | "external" | "both";
|
|
58
|
+
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
59
|
+
sourceRoot?: string;
|
|
60
|
+
sourcesContent?: boolean;
|
|
61
|
+
format?: esbuild.Format;
|
|
62
|
+
globalName?: string;
|
|
63
|
+
target?: string | string[];
|
|
64
|
+
supported?: Record<string, boolean>;
|
|
65
|
+
platform?: esbuild.Platform;
|
|
66
|
+
mangleProps?: RegExp;
|
|
67
|
+
reserveProps?: RegExp;
|
|
68
|
+
mangleQuoted?: boolean;
|
|
69
|
+
mangleCache?: Record<string, string | false>;
|
|
70
|
+
drop?: esbuild.Drop[];
|
|
71
|
+
dropLabels?: string[];
|
|
72
|
+
minify?: boolean;
|
|
73
|
+
minifyWhitespace?: boolean;
|
|
74
|
+
minifyIdentifiers?: boolean;
|
|
75
|
+
minifySyntax?: boolean;
|
|
76
|
+
lineLimit?: number;
|
|
77
|
+
charset?: esbuild.Charset;
|
|
78
|
+
treeShaking?: boolean;
|
|
79
|
+
ignoreAnnotations?: boolean;
|
|
80
|
+
jsx?: "transform" | "preserve" | "automatic";
|
|
81
|
+
jsxFactory?: string;
|
|
82
|
+
jsxFragment?: string;
|
|
83
|
+
jsxImportSource?: string;
|
|
84
|
+
jsxDev?: boolean;
|
|
85
|
+
jsxSideEffects?: boolean;
|
|
86
|
+
define?: {
|
|
87
|
+
[key: string]: string;
|
|
88
|
+
};
|
|
89
|
+
pure?: string[];
|
|
90
|
+
keepNames?: boolean;
|
|
91
|
+
absPaths?: esbuild.AbsPaths[];
|
|
92
|
+
color?: boolean;
|
|
93
|
+
logLevel?: esbuild.LogLevel;
|
|
94
|
+
logLimit?: number;
|
|
95
|
+
logOverride?: Record<string, esbuild.LogLevel>;
|
|
96
|
+
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
97
|
+
}>>;
|
|
98
|
+
context: (opt: BuildOptions) => Promise<{
|
|
99
|
+
rebuild: () => Promise<BuildResult<{
|
|
100
|
+
bundle?: boolean;
|
|
101
|
+
splitting?: boolean;
|
|
102
|
+
preserveSymlinks?: boolean;
|
|
103
|
+
outfile?: string;
|
|
104
|
+
metafile?: boolean;
|
|
105
|
+
outdir?: string;
|
|
106
|
+
outbase?: string;
|
|
107
|
+
external?: string[];
|
|
108
|
+
packages?: "bundle" | "external";
|
|
109
|
+
alias?: Record<string, string>;
|
|
110
|
+
loader?: {
|
|
111
|
+
[ext: string]: esbuild.Loader;
|
|
112
|
+
};
|
|
113
|
+
resolveExtensions?: string[];
|
|
114
|
+
mainFields?: string[];
|
|
115
|
+
conditions?: string[];
|
|
116
|
+
write?: boolean;
|
|
117
|
+
allowOverwrite?: boolean;
|
|
118
|
+
tsconfig?: string;
|
|
119
|
+
outExtension?: {
|
|
120
|
+
[ext: string]: string;
|
|
121
|
+
};
|
|
122
|
+
publicPath?: string;
|
|
123
|
+
entryNames?: string;
|
|
124
|
+
chunkNames?: string;
|
|
125
|
+
assetNames?: string;
|
|
126
|
+
inject?: string[];
|
|
127
|
+
banner?: {
|
|
128
|
+
[type: string]: string;
|
|
129
|
+
};
|
|
130
|
+
footer?: {
|
|
131
|
+
[type: string]: string;
|
|
132
|
+
};
|
|
133
|
+
entryPoints?: (string | {
|
|
134
|
+
in: string;
|
|
135
|
+
out: string;
|
|
136
|
+
})[] | Record<string, string>;
|
|
137
|
+
stdin?: esbuild.StdinOptions;
|
|
138
|
+
plugins?: esbuild.Plugin[];
|
|
139
|
+
absWorkingDir?: string;
|
|
140
|
+
nodePaths?: string[];
|
|
141
|
+
sourcemap?: boolean | "linked" | "inline" | "external" | "both";
|
|
142
|
+
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
143
|
+
sourceRoot?: string;
|
|
144
|
+
sourcesContent?: boolean;
|
|
145
|
+
format?: esbuild.Format;
|
|
146
|
+
globalName?: string;
|
|
147
|
+
target?: string | string[];
|
|
148
|
+
supported?: Record<string, boolean>;
|
|
149
|
+
platform?: esbuild.Platform;
|
|
150
|
+
mangleProps?: RegExp;
|
|
151
|
+
reserveProps?: RegExp;
|
|
152
|
+
mangleQuoted?: boolean;
|
|
153
|
+
mangleCache?: Record<string, string | false>;
|
|
154
|
+
drop?: esbuild.Drop[];
|
|
155
|
+
dropLabels?: string[];
|
|
156
|
+
minify?: boolean;
|
|
157
|
+
minifyWhitespace?: boolean;
|
|
158
|
+
minifyIdentifiers?: boolean;
|
|
159
|
+
minifySyntax?: boolean;
|
|
160
|
+
lineLimit?: number;
|
|
161
|
+
charset?: esbuild.Charset;
|
|
162
|
+
treeShaking?: boolean;
|
|
163
|
+
ignoreAnnotations?: boolean;
|
|
164
|
+
jsx?: "transform" | "preserve" | "automatic";
|
|
165
|
+
jsxFactory?: string;
|
|
166
|
+
jsxFragment?: string;
|
|
167
|
+
jsxImportSource?: string;
|
|
168
|
+
jsxDev?: boolean;
|
|
169
|
+
jsxSideEffects?: boolean;
|
|
170
|
+
define?: {
|
|
171
|
+
[key: string]: string;
|
|
172
|
+
};
|
|
173
|
+
pure?: string[];
|
|
174
|
+
keepNames?: boolean;
|
|
175
|
+
absPaths?: esbuild.AbsPaths[];
|
|
176
|
+
color?: boolean;
|
|
177
|
+
logLevel?: esbuild.LogLevel;
|
|
178
|
+
logLimit?: number;
|
|
179
|
+
logOverride?: Record<string, esbuild.LogLevel>;
|
|
180
|
+
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
181
|
+
}>>;
|
|
182
|
+
cancel: () => Promise<void>;
|
|
183
|
+
}>;
|
|
184
|
+
input: (input: string | string[]) => {
|
|
185
|
+
output: (outputConfig: any) => Promise<BuildResult<BuildOptions>>;
|
|
186
|
+
};
|
|
187
|
+
build: (options: BuildOptions) => Promise<BuildResult<{
|
|
188
|
+
bundle?: boolean;
|
|
189
|
+
splitting?: boolean;
|
|
190
|
+
preserveSymlinks?: boolean;
|
|
191
|
+
outfile?: string;
|
|
192
|
+
metafile?: boolean;
|
|
193
|
+
outdir?: string;
|
|
194
|
+
outbase?: string;
|
|
195
|
+
external?: string[];
|
|
196
|
+
packages?: "bundle" | "external";
|
|
197
|
+
alias?: Record<string, string>;
|
|
198
|
+
loader?: {
|
|
199
|
+
[ext: string]: esbuild.Loader;
|
|
200
|
+
};
|
|
201
|
+
resolveExtensions?: string[];
|
|
202
|
+
mainFields?: string[];
|
|
203
|
+
conditions?: string[];
|
|
204
|
+
write?: boolean;
|
|
205
|
+
allowOverwrite?: boolean;
|
|
206
|
+
tsconfig?: string;
|
|
207
|
+
outExtension?: {
|
|
208
|
+
[ext: string]: string;
|
|
209
|
+
};
|
|
210
|
+
publicPath?: string;
|
|
211
|
+
entryNames?: string;
|
|
212
|
+
chunkNames?: string;
|
|
213
|
+
assetNames?: string;
|
|
214
|
+
inject?: string[];
|
|
215
|
+
banner?: {
|
|
216
|
+
[type: string]: string;
|
|
217
|
+
};
|
|
218
|
+
footer?: {
|
|
219
|
+
[type: string]: string;
|
|
220
|
+
};
|
|
221
|
+
entryPoints?: (string | {
|
|
222
|
+
in: string;
|
|
223
|
+
out: string;
|
|
224
|
+
})[] | Record<string, string>;
|
|
225
|
+
stdin?: esbuild.StdinOptions;
|
|
226
|
+
plugins?: esbuild.Plugin[];
|
|
227
|
+
absWorkingDir?: string;
|
|
228
|
+
nodePaths?: string[];
|
|
229
|
+
sourcemap?: boolean | "linked" | "inline" | "external" | "both";
|
|
230
|
+
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
231
|
+
sourceRoot?: string;
|
|
232
|
+
sourcesContent?: boolean;
|
|
233
|
+
format?: esbuild.Format;
|
|
234
|
+
globalName?: string;
|
|
235
|
+
target?: string | string[];
|
|
236
|
+
supported?: Record<string, boolean>;
|
|
237
|
+
platform?: esbuild.Platform;
|
|
238
|
+
mangleProps?: RegExp;
|
|
239
|
+
reserveProps?: RegExp;
|
|
240
|
+
mangleQuoted?: boolean;
|
|
241
|
+
mangleCache?: Record<string, string | false>;
|
|
242
|
+
drop?: esbuild.Drop[];
|
|
243
|
+
dropLabels?: string[];
|
|
244
|
+
minify?: boolean;
|
|
245
|
+
minifyWhitespace?: boolean;
|
|
246
|
+
minifyIdentifiers?: boolean;
|
|
247
|
+
minifySyntax?: boolean;
|
|
248
|
+
lineLimit?: number;
|
|
249
|
+
charset?: esbuild.Charset;
|
|
250
|
+
treeShaking?: boolean;
|
|
251
|
+
ignoreAnnotations?: boolean;
|
|
252
|
+
jsx?: "transform" | "preserve" | "automatic";
|
|
253
|
+
jsxFactory?: string;
|
|
254
|
+
jsxFragment?: string;
|
|
255
|
+
jsxImportSource?: string;
|
|
256
|
+
jsxDev?: boolean;
|
|
257
|
+
jsxSideEffects?: boolean;
|
|
258
|
+
define?: {
|
|
259
|
+
[key: string]: string;
|
|
260
|
+
};
|
|
261
|
+
pure?: string[];
|
|
262
|
+
keepNames?: boolean;
|
|
263
|
+
absPaths?: esbuild.AbsPaths[];
|
|
264
|
+
color?: boolean;
|
|
265
|
+
logLevel?: esbuild.LogLevel;
|
|
266
|
+
logLimit?: number;
|
|
267
|
+
logOverride?: Record<string, esbuild.LogLevel>;
|
|
268
|
+
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
269
|
+
}>>;
|
|
270
|
+
watch: (options: WatchOptions) => Promise<void>;
|
|
271
|
+
server: (serverConfig: ServeOptions) => Promise<ServeResult>;
|
|
272
|
+
}
|
|
273
|
+
declare const createCompiler: (baseConfig: any) => Compiler;
|
|
274
|
+
|
|
8
275
|
declare const getDefine: (params: {
|
|
9
276
|
NODE_ENV: string;
|
|
10
277
|
}) => {
|
|
@@ -56,23 +323,88 @@ declare const getPostCssPlugin: () => any;
|
|
|
56
323
|
|
|
57
324
|
declare const getSassPlugin: () => esbuild.Plugin;
|
|
58
325
|
|
|
59
|
-
declare const getNodeBuildConfigPreset: () => {
|
|
60
|
-
entryPoints: string[];
|
|
61
|
-
outdir: string;
|
|
326
|
+
declare const getNodeBuildConfigPreset: (options?: BuildOptions) => {
|
|
62
327
|
bundle: boolean;
|
|
328
|
+
splitting?: boolean;
|
|
329
|
+
preserveSymlinks?: boolean;
|
|
330
|
+
outfile?: string;
|
|
331
|
+
metafile?: boolean;
|
|
332
|
+
outdir?: string;
|
|
333
|
+
outbase?: string;
|
|
334
|
+
external?: string[];
|
|
335
|
+
packages?: "bundle" | "external";
|
|
336
|
+
alias?: Record<string, string>;
|
|
337
|
+
loader: {
|
|
338
|
+
[ext: string]: esbuild.Loader;
|
|
339
|
+
};
|
|
340
|
+
resolveExtensions?: string[];
|
|
341
|
+
mainFields?: string[];
|
|
342
|
+
conditions?: string[];
|
|
343
|
+
write?: boolean;
|
|
344
|
+
allowOverwrite?: boolean;
|
|
345
|
+
tsconfig?: string;
|
|
346
|
+
outExtension?: {
|
|
347
|
+
[ext: string]: string;
|
|
348
|
+
};
|
|
349
|
+
publicPath?: string;
|
|
350
|
+
entryNames?: string;
|
|
351
|
+
chunkNames?: string;
|
|
352
|
+
assetNames?: string;
|
|
353
|
+
inject?: string[];
|
|
354
|
+
banner?: {
|
|
355
|
+
[type: string]: string;
|
|
356
|
+
};
|
|
357
|
+
footer?: {
|
|
358
|
+
[type: string]: string;
|
|
359
|
+
};
|
|
360
|
+
entryPoints?: (string | {
|
|
361
|
+
in: string;
|
|
362
|
+
out: string;
|
|
363
|
+
})[] | Record<string, string>;
|
|
364
|
+
stdin?: esbuild.StdinOptions;
|
|
365
|
+
plugins: esbuild.Plugin[];
|
|
366
|
+
absWorkingDir?: string;
|
|
367
|
+
nodePaths?: string[];
|
|
368
|
+
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
369
|
+
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
370
|
+
sourceRoot?: string;
|
|
371
|
+
sourcesContent?: boolean;
|
|
372
|
+
format?: esbuild.Format;
|
|
373
|
+
globalName?: string;
|
|
374
|
+
target: string | string[];
|
|
375
|
+
supported?: Record<string, boolean>;
|
|
376
|
+
platform: esbuild.Platform;
|
|
377
|
+
mangleProps?: RegExp;
|
|
378
|
+
reserveProps?: RegExp;
|
|
379
|
+
mangleQuoted?: boolean;
|
|
380
|
+
mangleCache?: Record<string, string | false>;
|
|
381
|
+
drop?: esbuild.Drop[];
|
|
382
|
+
dropLabels?: string[];
|
|
63
383
|
minify: boolean;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
384
|
+
minifyWhitespace?: boolean;
|
|
385
|
+
minifyIdentifiers?: boolean;
|
|
386
|
+
minifySyntax?: boolean;
|
|
387
|
+
lineLimit?: number;
|
|
388
|
+
charset?: esbuild.Charset;
|
|
389
|
+
treeShaking?: boolean;
|
|
390
|
+
ignoreAnnotations?: boolean;
|
|
391
|
+
jsx?: "transform" | "preserve" | "automatic";
|
|
392
|
+
jsxFactory?: string;
|
|
393
|
+
jsxFragment?: string;
|
|
394
|
+
jsxImportSource?: string;
|
|
395
|
+
jsxDev?: boolean;
|
|
396
|
+
jsxSideEffects?: boolean;
|
|
68
397
|
define: {
|
|
69
|
-
|
|
398
|
+
[key: string]: string;
|
|
70
399
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
400
|
+
pure?: string[];
|
|
401
|
+
keepNames?: boolean;
|
|
402
|
+
absPaths?: esbuild.AbsPaths[];
|
|
403
|
+
color?: boolean;
|
|
404
|
+
logLevel?: esbuild.LogLevel;
|
|
405
|
+
logLimit?: number;
|
|
406
|
+
logOverride?: Record<string, esbuild.LogLevel>;
|
|
407
|
+
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
76
408
|
};
|
|
77
409
|
|
|
78
410
|
declare const getReactBuildConfigPreset: () => {
|
|
@@ -109,5 +441,5 @@ declare class Ctx {
|
|
|
109
441
|
|
|
110
442
|
declare const extractEntry: (entryPoints: TEntryPoints) => string[];
|
|
111
443
|
|
|
112
|
-
export { Ctx, builder, createContext, extractEntry, getDefine, getEntryPoints, getEsbuildPluginHtml, getLessPlugin, getNodeBuildConfigPreset, getNodeLoaderPreset, getPostCssPlugin, getReactBuildConfigPreset, getReactLoaderPreset, getSassPlugin, inputFileDirList, inputFileTypeList };
|
|
444
|
+
export { Compiler, Ctx, builder, createCompiler, createContext, extractEntry, getDefine, getEntryPoints, getEsbuildPluginHtml, getLessPlugin, getNodeBuildConfigPreset, getNodeLoaderPreset, getPostCssPlugin, getReactBuildConfigPreset, getReactLoaderPreset, getSassPlugin, inputFileDirList, inputFileTypeList };
|
|
113
445
|
export type { TBundle, TDefine, TEntryPoints, TEnvParams, TLoader, TMinify, TOutdir, TOutfile, TPlugins, TSourcemap, TTarget };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doracli/esbuild",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "package by esbuild",
|
|
5
5
|
"author": "cclr <18843152354@163.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"@cclr/utils": "^0.1.28",
|
|
33
33
|
"@craftamap/esbuild-plugin-html": "^0.9.0",
|
|
34
34
|
"@dorabag/file-pro": "^1.0.10",
|
|
35
|
-
"@doracli/commander": "^0.0.
|
|
36
|
-
"@doracli/helper": "^0.0.
|
|
37
|
-
"@doracli/type": "^0.0.
|
|
38
|
-
"@doracli/webpack": "^0.0.
|
|
35
|
+
"@doracli/commander": "^0.0.2",
|
|
36
|
+
"@doracli/helper": "^0.0.2",
|
|
37
|
+
"@doracli/type": "^0.0.2",
|
|
38
|
+
"@doracli/webpack": "^0.0.2",
|
|
39
39
|
"autoprefixer": "10.4.21",
|
|
40
40
|
"esbuild": "0.25.10",
|
|
41
41
|
"esbuild-plugin-less": "1.3.27",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"esbuild-plugin-sass": "1.0.1",
|
|
44
44
|
"postcss": "8.5.6"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "912cb44292b64679630a799974d18c22b2e69738"
|
|
47
47
|
}
|