esbuild 0.17.0 → 0.17.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/bin/esbuild +1 -1
- package/install.js +4 -4
- package/lib/main.d.ts +247 -218
- package/lib/main.js +57 -17
- package/package.json +23 -23
package/bin/esbuild
CHANGED
|
@@ -198,7 +198,7 @@ for your current platform.`);
|
|
|
198
198
|
"node_modules",
|
|
199
199
|
".cache",
|
|
200
200
|
"esbuild",
|
|
201
|
-
`pnpapi-${pkg.replace("/", "-")}-${"0.17.
|
|
201
|
+
`pnpapi-${pkg.replace("/", "-")}-${"0.17.2"}-${path.basename(subpath)}`
|
|
202
202
|
);
|
|
203
203
|
if (!fs.existsSync(binTargetPath)) {
|
|
204
204
|
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
package/install.js
CHANGED
|
@@ -126,8 +126,8 @@ which means the "esbuild" binary executable can't be run. You can either:
|
|
|
126
126
|
}
|
|
127
127
|
throw err;
|
|
128
128
|
}
|
|
129
|
-
if (stdout !== "0.17.
|
|
130
|
-
throw new Error(`Expected ${JSON.stringify("0.17.
|
|
129
|
+
if (stdout !== "0.17.2") {
|
|
130
|
+
throw new Error(`Expected ${JSON.stringify("0.17.2")} but got ${JSON.stringify(stdout)}`);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
function isYarn() {
|
|
@@ -179,7 +179,7 @@ function installUsingNPM(pkg, subpath, binPath) {
|
|
|
179
179
|
try {
|
|
180
180
|
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
|
181
181
|
child_process.execSync(
|
|
182
|
-
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.17.
|
|
182
|
+
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.17.2"}`,
|
|
183
183
|
{ cwd: installDir, stdio: "pipe", env }
|
|
184
184
|
);
|
|
185
185
|
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
|
@@ -230,7 +230,7 @@ function maybeOptimizePackage(binPath) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
|
233
|
-
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${"0.17.
|
|
233
|
+
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${"0.17.2"}.tgz`;
|
|
234
234
|
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
|
235
235
|
try {
|
|
236
236
|
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
package/lib/main.d.ts
CHANGED
|
@@ -1,235 +1,235 @@
|
|
|
1
|
-
export type Platform = 'browser' | 'node' | 'neutral'
|
|
2
|
-
export type Format = 'iife' | 'cjs' | 'esm'
|
|
3
|
-
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'text' | 'ts' | 'tsx'
|
|
4
|
-
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
|
5
|
-
export type Charset = 'ascii' | 'utf8'
|
|
6
|
-
export type Drop = 'console' | 'debugger'
|
|
1
|
+
export type Platform = 'browser' | 'node' | 'neutral'
|
|
2
|
+
export type Format = 'iife' | 'cjs' | 'esm'
|
|
3
|
+
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'text' | 'ts' | 'tsx'
|
|
4
|
+
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
|
5
|
+
export type Charset = 'ascii' | 'utf8'
|
|
6
|
+
export type Drop = 'console' | 'debugger'
|
|
7
7
|
|
|
8
8
|
interface CommonOptions {
|
|
9
9
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
|
10
|
-
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
|
10
|
+
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
|
11
11
|
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
|
12
|
-
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
|
12
|
+
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
|
13
13
|
/** Documentation: https://esbuild.github.io/api/#source-root */
|
|
14
|
-
sourceRoot?: string
|
|
14
|
+
sourceRoot?: string
|
|
15
15
|
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
|
16
|
-
sourcesContent?: boolean
|
|
16
|
+
sourcesContent?: boolean
|
|
17
17
|
|
|
18
18
|
/** Documentation: https://esbuild.github.io/api/#format */
|
|
19
|
-
format?: Format
|
|
19
|
+
format?: Format
|
|
20
20
|
/** Documentation: https://esbuild.github.io/api/#global-name */
|
|
21
|
-
globalName?: string
|
|
21
|
+
globalName?: string
|
|
22
22
|
/** Documentation: https://esbuild.github.io/api/#target */
|
|
23
|
-
target?: string | string[]
|
|
23
|
+
target?: string | string[]
|
|
24
24
|
/** Documentation: https://esbuild.github.io/api/#supported */
|
|
25
|
-
supported?: Record<string, boolean
|
|
25
|
+
supported?: Record<string, boolean>
|
|
26
26
|
/** Documentation: https://esbuild.github.io/api/#platform */
|
|
27
|
-
platform?: Platform
|
|
27
|
+
platform?: Platform
|
|
28
28
|
|
|
29
29
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
30
|
-
mangleProps?: RegExp
|
|
30
|
+
mangleProps?: RegExp
|
|
31
31
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
32
|
-
reserveProps?: RegExp
|
|
32
|
+
reserveProps?: RegExp
|
|
33
33
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
34
|
-
mangleQuoted?: boolean
|
|
34
|
+
mangleQuoted?: boolean
|
|
35
35
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
36
|
-
mangleCache?: Record<string, string | false
|
|
36
|
+
mangleCache?: Record<string, string | false>
|
|
37
37
|
/** Documentation: https://esbuild.github.io/api/#drop */
|
|
38
|
-
drop?: Drop[]
|
|
38
|
+
drop?: Drop[]
|
|
39
39
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
40
|
-
minify?: boolean
|
|
40
|
+
minify?: boolean
|
|
41
41
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
42
|
-
minifyWhitespace?: boolean
|
|
42
|
+
minifyWhitespace?: boolean
|
|
43
43
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
44
|
-
minifyIdentifiers?: boolean
|
|
44
|
+
minifyIdentifiers?: boolean
|
|
45
45
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
46
|
-
minifySyntax?: boolean
|
|
46
|
+
minifySyntax?: boolean
|
|
47
47
|
/** Documentation: https://esbuild.github.io/api/#charset */
|
|
48
|
-
charset?: Charset
|
|
48
|
+
charset?: Charset
|
|
49
49
|
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
|
50
|
-
treeShaking?: boolean
|
|
50
|
+
treeShaking?: boolean
|
|
51
51
|
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
|
52
|
-
ignoreAnnotations?: boolean
|
|
52
|
+
ignoreAnnotations?: boolean
|
|
53
53
|
|
|
54
54
|
/** Documentation: https://esbuild.github.io/api/#jsx */
|
|
55
|
-
jsx?: 'transform' | 'preserve' | 'automatic'
|
|
55
|
+
jsx?: 'transform' | 'preserve' | 'automatic'
|
|
56
56
|
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
|
57
|
-
jsxFactory?: string
|
|
57
|
+
jsxFactory?: string
|
|
58
58
|
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
|
59
|
-
jsxFragment?: string
|
|
59
|
+
jsxFragment?: string
|
|
60
60
|
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
|
61
|
-
jsxImportSource?: string
|
|
61
|
+
jsxImportSource?: string
|
|
62
62
|
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
|
63
|
-
jsxDev?: boolean
|
|
63
|
+
jsxDev?: boolean
|
|
64
64
|
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
|
65
|
-
jsxSideEffects?: boolean
|
|
65
|
+
jsxSideEffects?: boolean
|
|
66
66
|
|
|
67
67
|
/** Documentation: https://esbuild.github.io/api/#define */
|
|
68
|
-
define?: { [key: string]: string }
|
|
68
|
+
define?: { [key: string]: string }
|
|
69
69
|
/** Documentation: https://esbuild.github.io/api/#pure */
|
|
70
|
-
pure?: string[]
|
|
70
|
+
pure?: string[]
|
|
71
71
|
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
|
72
|
-
keepNames?: boolean
|
|
72
|
+
keepNames?: boolean
|
|
73
73
|
|
|
74
74
|
/** Documentation: https://esbuild.github.io/api/#color */
|
|
75
|
-
color?: boolean
|
|
75
|
+
color?: boolean
|
|
76
76
|
/** Documentation: https://esbuild.github.io/api/#log-level */
|
|
77
|
-
logLevel?: LogLevel
|
|
77
|
+
logLevel?: LogLevel
|
|
78
78
|
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
|
79
|
-
logLimit?: number
|
|
79
|
+
logLimit?: number
|
|
80
80
|
/** Documentation: https://esbuild.github.io/api/#log-override */
|
|
81
|
-
logOverride?: Record<string, LogLevel
|
|
81
|
+
logOverride?: Record<string, LogLevel>
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export interface BuildOptions extends CommonOptions {
|
|
85
85
|
/** Documentation: https://esbuild.github.io/api/#bundle */
|
|
86
|
-
bundle?: boolean
|
|
86
|
+
bundle?: boolean
|
|
87
87
|
/** Documentation: https://esbuild.github.io/api/#splitting */
|
|
88
|
-
splitting?: boolean
|
|
88
|
+
splitting?: boolean
|
|
89
89
|
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
|
90
|
-
preserveSymlinks?: boolean
|
|
90
|
+
preserveSymlinks?: boolean
|
|
91
91
|
/** Documentation: https://esbuild.github.io/api/#outfile */
|
|
92
|
-
outfile?: string
|
|
92
|
+
outfile?: string
|
|
93
93
|
/** Documentation: https://esbuild.github.io/api/#metafile */
|
|
94
|
-
metafile?: boolean
|
|
94
|
+
metafile?: boolean
|
|
95
95
|
/** Documentation: https://esbuild.github.io/api/#outdir */
|
|
96
|
-
outdir?: string
|
|
96
|
+
outdir?: string
|
|
97
97
|
/** Documentation: https://esbuild.github.io/api/#outbase */
|
|
98
|
-
outbase?: string
|
|
98
|
+
outbase?: string
|
|
99
99
|
/** Documentation: https://esbuild.github.io/api/#external */
|
|
100
|
-
external?: string[]
|
|
100
|
+
external?: string[]
|
|
101
101
|
/** Documentation: https://esbuild.github.io/api/#packages */
|
|
102
|
-
packages?: 'external'
|
|
102
|
+
packages?: 'external'
|
|
103
103
|
/** Documentation: https://esbuild.github.io/api/#alias */
|
|
104
|
-
alias?: Record<string, string
|
|
104
|
+
alias?: Record<string, string>
|
|
105
105
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
|
106
|
-
loader?: { [ext: string]: Loader }
|
|
106
|
+
loader?: { [ext: string]: Loader }
|
|
107
107
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
|
108
|
-
resolveExtensions?: string[]
|
|
108
|
+
resolveExtensions?: string[]
|
|
109
109
|
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
|
110
|
-
mainFields?: string[]
|
|
110
|
+
mainFields?: string[]
|
|
111
111
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
|
112
|
-
conditions?: string[]
|
|
112
|
+
conditions?: string[]
|
|
113
113
|
/** Documentation: https://esbuild.github.io/api/#write */
|
|
114
|
-
write?: boolean
|
|
114
|
+
write?: boolean
|
|
115
115
|
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
|
116
|
-
allowOverwrite?: boolean
|
|
116
|
+
allowOverwrite?: boolean
|
|
117
117
|
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
|
118
|
-
tsconfig?: string
|
|
118
|
+
tsconfig?: string
|
|
119
119
|
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
|
120
|
-
outExtension?: { [ext: string]: string }
|
|
120
|
+
outExtension?: { [ext: string]: string }
|
|
121
121
|
/** Documentation: https://esbuild.github.io/api/#public-path */
|
|
122
|
-
publicPath?: string
|
|
122
|
+
publicPath?: string
|
|
123
123
|
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
|
124
|
-
entryNames?: string
|
|
124
|
+
entryNames?: string
|
|
125
125
|
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
|
126
|
-
chunkNames?: string
|
|
126
|
+
chunkNames?: string
|
|
127
127
|
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
|
128
|
-
assetNames?: string
|
|
128
|
+
assetNames?: string
|
|
129
129
|
/** Documentation: https://esbuild.github.io/api/#inject */
|
|
130
|
-
inject?: string[]
|
|
130
|
+
inject?: string[]
|
|
131
131
|
/** Documentation: https://esbuild.github.io/api/#banner */
|
|
132
|
-
banner?: { [type: string]: string }
|
|
132
|
+
banner?: { [type: string]: string }
|
|
133
133
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
|
134
|
-
footer?: { [type: string]: string }
|
|
134
|
+
footer?: { [type: string]: string }
|
|
135
135
|
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
|
136
|
-
entryPoints?: string[] | Record<string, string
|
|
136
|
+
entryPoints?: string[] | Record<string, string> | { in: string, out: string }[]
|
|
137
137
|
/** Documentation: https://esbuild.github.io/api/#stdin */
|
|
138
|
-
stdin?: StdinOptions
|
|
138
|
+
stdin?: StdinOptions
|
|
139
139
|
/** Documentation: https://esbuild.github.io/plugins/ */
|
|
140
|
-
plugins?: Plugin[]
|
|
140
|
+
plugins?: Plugin[]
|
|
141
141
|
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
|
142
|
-
absWorkingDir?: string
|
|
142
|
+
absWorkingDir?: string
|
|
143
143
|
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
|
144
144
|
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
export interface StdinOptions {
|
|
148
|
-
contents: string | Uint8Array
|
|
149
|
-
resolveDir?: string
|
|
150
|
-
sourcefile?: string
|
|
151
|
-
loader?: Loader
|
|
148
|
+
contents: string | Uint8Array
|
|
149
|
+
resolveDir?: string
|
|
150
|
+
sourcefile?: string
|
|
151
|
+
loader?: Loader
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
export interface Message {
|
|
155
|
-
id: string
|
|
156
|
-
pluginName: string
|
|
157
|
-
text: string
|
|
158
|
-
location: Location | null
|
|
159
|
-
notes: Note[]
|
|
155
|
+
id: string
|
|
156
|
+
pluginName: string
|
|
157
|
+
text: string
|
|
158
|
+
location: Location | null
|
|
159
|
+
notes: Note[]
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* Optional user-specified data that is passed through unmodified. You can
|
|
163
163
|
* use this to stash the original error, for example.
|
|
164
164
|
*/
|
|
165
|
-
detail: any
|
|
165
|
+
detail: any
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
export interface Note {
|
|
169
|
-
text: string
|
|
170
|
-
location: Location | null
|
|
169
|
+
text: string
|
|
170
|
+
location: Location | null
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
export interface Location {
|
|
174
|
-
file: string
|
|
175
|
-
namespace: string
|
|
174
|
+
file: string
|
|
175
|
+
namespace: string
|
|
176
176
|
/** 1-based */
|
|
177
|
-
line: number
|
|
177
|
+
line: number
|
|
178
178
|
/** 0-based, in bytes */
|
|
179
|
-
column: number
|
|
179
|
+
column: number
|
|
180
180
|
/** in bytes */
|
|
181
|
-
length: number
|
|
182
|
-
lineText: string
|
|
183
|
-
suggestion: string
|
|
181
|
+
length: number
|
|
182
|
+
lineText: string
|
|
183
|
+
suggestion: string
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
export interface OutputFile {
|
|
187
|
-
path: string
|
|
187
|
+
path: string
|
|
188
188
|
/** "text" as bytes */
|
|
189
|
-
contents: Uint8Array
|
|
189
|
+
contents: Uint8Array
|
|
190
190
|
/** "contents" as text (changes automatically with "contents") */
|
|
191
|
-
readonly text: string
|
|
191
|
+
readonly text: string
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
export interface BuildResult<SpecificOptions extends BuildOptions = BuildOptions> {
|
|
195
|
-
errors: Message[]
|
|
196
|
-
warnings: Message[]
|
|
195
|
+
errors: Message[]
|
|
196
|
+
warnings: Message[]
|
|
197
197
|
/** Only when "write: false" */
|
|
198
|
-
outputFiles: OutputFile[] | (SpecificOptions['write'] extends false ? never : undefined)
|
|
198
|
+
outputFiles: OutputFile[] | (SpecificOptions['write'] extends false ? never : undefined)
|
|
199
199
|
/** Only when "metafile: true" */
|
|
200
|
-
metafile: Metafile | (SpecificOptions['metafile'] extends true ? never : undefined)
|
|
200
|
+
metafile: Metafile | (SpecificOptions['metafile'] extends true ? never : undefined)
|
|
201
201
|
/** Only when "mangleCache" is present */
|
|
202
|
-
mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined)
|
|
202
|
+
mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined)
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
export interface BuildFailure extends Error {
|
|
206
|
-
errors: Message[]
|
|
207
|
-
warnings: Message[]
|
|
206
|
+
errors: Message[]
|
|
207
|
+
warnings: Message[]
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
|
211
211
|
export interface ServeOptions {
|
|
212
|
-
port?: number
|
|
213
|
-
host?: string
|
|
214
|
-
servedir?: string
|
|
212
|
+
port?: number
|
|
213
|
+
host?: string
|
|
214
|
+
servedir?: string
|
|
215
215
|
keyfile?: string
|
|
216
216
|
certfile?: string
|
|
217
|
-
onRequest?: (args: ServeOnRequestArgs) => void
|
|
217
|
+
onRequest?: (args: ServeOnRequestArgs) => void
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
export interface ServeOnRequestArgs {
|
|
221
|
-
remoteAddress: string
|
|
222
|
-
method: string
|
|
223
|
-
path: string
|
|
224
|
-
status: number
|
|
221
|
+
remoteAddress: string
|
|
222
|
+
method: string
|
|
223
|
+
path: string
|
|
224
|
+
status: number
|
|
225
225
|
/** The time to generate the response, not to send it */
|
|
226
|
-
timeInMS: number
|
|
226
|
+
timeInMS: number
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
|
230
230
|
export interface ServeResult {
|
|
231
|
-
port: number
|
|
232
|
-
host: string
|
|
231
|
+
port: number
|
|
232
|
+
host: string
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
export interface TransformOptions extends CommonOptions {
|
|
@@ -245,46 +245,59 @@ export interface TransformOptions extends CommonOptions {
|
|
|
245
245
|
target?: string,
|
|
246
246
|
useDefineForClassFields?: boolean,
|
|
247
247
|
},
|
|
248
|
-
}
|
|
248
|
+
}
|
|
249
249
|
|
|
250
|
-
sourcefile?: string
|
|
251
|
-
loader?: Loader
|
|
252
|
-
banner?: string
|
|
253
|
-
footer?: string
|
|
250
|
+
sourcefile?: string
|
|
251
|
+
loader?: Loader
|
|
252
|
+
banner?: string
|
|
253
|
+
footer?: string
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
export interface TransformResult<SpecificOptions extends TransformOptions = TransformOptions> {
|
|
257
|
-
code: string
|
|
258
|
-
map: string
|
|
259
|
-
warnings: Message[]
|
|
257
|
+
code: string
|
|
258
|
+
map: string
|
|
259
|
+
warnings: Message[]
|
|
260
260
|
/** Only when "mangleCache" is present */
|
|
261
|
-
mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined)
|
|
261
|
+
mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined)
|
|
262
262
|
/** Only when "legalComments" is "external" */
|
|
263
|
-
legalComments: string | (SpecificOptions['legalComments'] extends 'external' ? never : undefined)
|
|
263
|
+
legalComments: string | (SpecificOptions['legalComments'] extends 'external' ? never : undefined)
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
export interface TransformFailure extends Error {
|
|
267
|
-
errors: Message[]
|
|
268
|
-
warnings: Message[]
|
|
267
|
+
errors: Message[]
|
|
268
|
+
warnings: Message[]
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
export interface Plugin {
|
|
272
|
-
name: string
|
|
273
|
-
setup: (build: PluginBuild) => (void | Promise<void>)
|
|
272
|
+
name: string
|
|
273
|
+
setup: (build: PluginBuild) => (void | Promise<void>)
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
export interface PluginBuild {
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
/** Documentation: https://esbuild.github.io/plugins/#build-options */
|
|
278
|
+
initialOptions: BuildOptions
|
|
279
|
+
|
|
280
|
+
/** Documentation: https://esbuild.github.io/plugins/#resolve */
|
|
281
|
+
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
|
|
279
282
|
|
|
283
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-start */
|
|
280
284
|
onStart(callback: () =>
|
|
281
|
-
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
|
285
|
+
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
|
286
|
+
|
|
287
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-end */
|
|
282
288
|
onEnd(callback: (result: BuildResult) =>
|
|
283
|
-
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
|
289
|
+
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
|
290
|
+
|
|
291
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
|
|
284
292
|
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
|
285
|
-
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
|
293
|
+
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
|
294
|
+
|
|
295
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load */
|
|
286
296
|
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
|
287
|
-
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
|
297
|
+
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
|
298
|
+
|
|
299
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
|
|
300
|
+
onDispose(callback: () => void): void
|
|
288
301
|
|
|
289
302
|
// This is a full copy of the esbuild library in case you need it
|
|
290
303
|
esbuild: {
|
|
@@ -299,52 +312,56 @@ export interface PluginBuild {
|
|
|
299
312
|
analyzeMetafileSync: typeof analyzeMetafileSync,
|
|
300
313
|
initialize: typeof initialize,
|
|
301
314
|
version: typeof version,
|
|
302
|
-
}
|
|
315
|
+
}
|
|
303
316
|
}
|
|
304
317
|
|
|
318
|
+
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
|
|
305
319
|
export interface ResolveOptions {
|
|
306
|
-
pluginName?: string
|
|
307
|
-
importer?: string
|
|
308
|
-
namespace?: string
|
|
309
|
-
resolveDir?: string
|
|
310
|
-
kind?: ImportKind
|
|
311
|
-
pluginData?: any
|
|
320
|
+
pluginName?: string
|
|
321
|
+
importer?: string
|
|
322
|
+
namespace?: string
|
|
323
|
+
resolveDir?: string
|
|
324
|
+
kind?: ImportKind
|
|
325
|
+
pluginData?: any
|
|
312
326
|
}
|
|
313
327
|
|
|
328
|
+
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
|
314
329
|
export interface ResolveResult {
|
|
315
|
-
errors: Message[]
|
|
316
|
-
warnings: Message[]
|
|
330
|
+
errors: Message[]
|
|
331
|
+
warnings: Message[]
|
|
317
332
|
|
|
318
|
-
path: string
|
|
319
|
-
external: boolean
|
|
320
|
-
sideEffects: boolean
|
|
321
|
-
namespace: string
|
|
322
|
-
suffix: string
|
|
323
|
-
pluginData: any
|
|
333
|
+
path: string
|
|
334
|
+
external: boolean
|
|
335
|
+
sideEffects: boolean
|
|
336
|
+
namespace: string
|
|
337
|
+
suffix: string
|
|
338
|
+
pluginData: any
|
|
324
339
|
}
|
|
325
340
|
|
|
326
341
|
export interface OnStartResult {
|
|
327
|
-
errors?: PartialMessage[]
|
|
328
|
-
warnings?: PartialMessage[]
|
|
342
|
+
errors?: PartialMessage[]
|
|
343
|
+
warnings?: PartialMessage[]
|
|
329
344
|
}
|
|
330
345
|
|
|
331
346
|
export interface OnEndResult {
|
|
332
|
-
errors?: PartialMessage[]
|
|
333
|
-
warnings?: PartialMessage[]
|
|
347
|
+
errors?: PartialMessage[]
|
|
348
|
+
warnings?: PartialMessage[]
|
|
334
349
|
}
|
|
335
350
|
|
|
351
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
|
|
336
352
|
export interface OnResolveOptions {
|
|
337
|
-
filter: RegExp
|
|
338
|
-
namespace?: string
|
|
353
|
+
filter: RegExp
|
|
354
|
+
namespace?: string
|
|
339
355
|
}
|
|
340
356
|
|
|
357
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
|
|
341
358
|
export interface OnResolveArgs {
|
|
342
|
-
path: string
|
|
343
|
-
importer: string
|
|
344
|
-
namespace: string
|
|
345
|
-
resolveDir: string
|
|
346
|
-
kind: ImportKind
|
|
347
|
-
pluginData: any
|
|
359
|
+
path: string
|
|
360
|
+
importer: string
|
|
361
|
+
namespace: string
|
|
362
|
+
resolveDir: string
|
|
363
|
+
kind: ImportKind
|
|
364
|
+
pluginData: any
|
|
348
365
|
}
|
|
349
366
|
|
|
350
367
|
export type ImportKind =
|
|
@@ -360,64 +377,69 @@ export type ImportKind =
|
|
|
360
377
|
| 'import-rule'
|
|
361
378
|
| 'url-token'
|
|
362
379
|
|
|
380
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
|
|
363
381
|
export interface OnResolveResult {
|
|
364
|
-
pluginName?: string
|
|
382
|
+
pluginName?: string
|
|
365
383
|
|
|
366
|
-
errors?: PartialMessage[]
|
|
367
|
-
warnings?: PartialMessage[]
|
|
384
|
+
errors?: PartialMessage[]
|
|
385
|
+
warnings?: PartialMessage[]
|
|
368
386
|
|
|
369
|
-
path?: string
|
|
370
|
-
external?: boolean
|
|
371
|
-
sideEffects?: boolean
|
|
372
|
-
namespace?: string
|
|
373
|
-
suffix?: string
|
|
374
|
-
pluginData?: any
|
|
387
|
+
path?: string
|
|
388
|
+
external?: boolean
|
|
389
|
+
sideEffects?: boolean
|
|
390
|
+
namespace?: string
|
|
391
|
+
suffix?: string
|
|
392
|
+
pluginData?: any
|
|
375
393
|
|
|
376
|
-
watchFiles?: string[]
|
|
377
|
-
watchDirs?: string[]
|
|
394
|
+
watchFiles?: string[]
|
|
395
|
+
watchDirs?: string[]
|
|
378
396
|
}
|
|
379
397
|
|
|
398
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
|
|
380
399
|
export interface OnLoadOptions {
|
|
381
|
-
filter: RegExp
|
|
382
|
-
namespace?: string
|
|
400
|
+
filter: RegExp
|
|
401
|
+
namespace?: string
|
|
383
402
|
}
|
|
384
403
|
|
|
404
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
|
|
385
405
|
export interface OnLoadArgs {
|
|
386
|
-
path: string
|
|
387
|
-
namespace: string
|
|
388
|
-
suffix: string
|
|
389
|
-
pluginData: any
|
|
406
|
+
path: string
|
|
407
|
+
namespace: string
|
|
408
|
+
suffix: string
|
|
409
|
+
pluginData: any
|
|
390
410
|
}
|
|
391
411
|
|
|
412
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
|
|
392
413
|
export interface OnLoadResult {
|
|
393
|
-
pluginName?: string
|
|
414
|
+
pluginName?: string
|
|
394
415
|
|
|
395
|
-
errors?: PartialMessage[]
|
|
396
|
-
warnings?: PartialMessage[]
|
|
416
|
+
errors?: PartialMessage[]
|
|
417
|
+
warnings?: PartialMessage[]
|
|
397
418
|
|
|
398
|
-
contents?: string | Uint8Array
|
|
399
|
-
resolveDir?: string
|
|
400
|
-
loader?: Loader
|
|
401
|
-
pluginData?: any
|
|
419
|
+
contents?: string | Uint8Array
|
|
420
|
+
resolveDir?: string
|
|
421
|
+
loader?: Loader
|
|
422
|
+
pluginData?: any
|
|
402
423
|
|
|
403
|
-
watchFiles?: string[]
|
|
404
|
-
watchDirs?: string[]
|
|
424
|
+
watchFiles?: string[]
|
|
425
|
+
watchDirs?: string[]
|
|
405
426
|
}
|
|
406
427
|
|
|
407
428
|
export interface PartialMessage {
|
|
408
|
-
id?: string
|
|
409
|
-
pluginName?: string
|
|
410
|
-
text?: string
|
|
411
|
-
location?: Partial<Location> | null
|
|
412
|
-
notes?: PartialNote[]
|
|
413
|
-
detail?: any
|
|
429
|
+
id?: string
|
|
430
|
+
pluginName?: string
|
|
431
|
+
text?: string
|
|
432
|
+
location?: Partial<Location> | null
|
|
433
|
+
notes?: PartialNote[]
|
|
434
|
+
detail?: any
|
|
414
435
|
}
|
|
415
436
|
|
|
416
437
|
export interface PartialNote {
|
|
417
|
-
text?: string
|
|
418
|
-
location?: Partial<Location> | null
|
|
438
|
+
text?: string
|
|
439
|
+
location?: Partial<Location> | null
|
|
419
440
|
}
|
|
420
441
|
|
|
442
|
+
/** Documentation: https://esbuild.github.io/api/#metafile */
|
|
421
443
|
export interface Metafile {
|
|
422
444
|
inputs: {
|
|
423
445
|
[path: string]: {
|
|
@@ -452,23 +474,30 @@ export interface Metafile {
|
|
|
452
474
|
}
|
|
453
475
|
|
|
454
476
|
export interface FormatMessagesOptions {
|
|
455
|
-
kind: 'error' | 'warning'
|
|
456
|
-
color?: boolean
|
|
457
|
-
terminalWidth?: number
|
|
477
|
+
kind: 'error' | 'warning'
|
|
478
|
+
color?: boolean
|
|
479
|
+
terminalWidth?: number
|
|
458
480
|
}
|
|
459
481
|
|
|
460
482
|
export interface AnalyzeMetafileOptions {
|
|
461
|
-
color?: boolean
|
|
462
|
-
verbose?: boolean
|
|
483
|
+
color?: boolean
|
|
484
|
+
verbose?: boolean
|
|
463
485
|
}
|
|
464
486
|
|
|
465
487
|
export interface WatchOptions {
|
|
466
488
|
}
|
|
467
489
|
|
|
468
490
|
export interface BuildContext<SpecificOptions extends BuildOptions = BuildOptions> {
|
|
491
|
+
/** Documentation: https://esbuild.github.io/api/#rebuild */
|
|
469
492
|
rebuild(): Promise<BuildResult<SpecificOptions>>
|
|
470
|
-
|
|
493
|
+
|
|
494
|
+
/** Documentation: https://esbuild.github.io/api/#watch */
|
|
495
|
+
watch(options?: WatchOptions): Promise<void>
|
|
496
|
+
|
|
497
|
+
/** Documentation: https://esbuild.github.io/api/#serve */
|
|
471
498
|
serve(options?: ServeOptions): Promise<ServeResult>
|
|
499
|
+
|
|
500
|
+
cancel(): Promise<void>
|
|
472
501
|
dispose(): Promise<void>
|
|
473
502
|
}
|
|
474
503
|
|
|
@@ -480,10 +509,10 @@ export interface BuildContext<SpecificOptions extends BuildOptions = BuildOption
|
|
|
480
509
|
* - Works in node: yes
|
|
481
510
|
* - Works in browser: yes
|
|
482
511
|
*
|
|
483
|
-
* Documentation: https://esbuild.github.io/api/#build
|
|
512
|
+
* Documentation: https://esbuild.github.io/api/#build
|
|
484
513
|
*/
|
|
485
|
-
export declare function build<SpecificOptions extends BuildOptions>(options: SpecificOptions): Promise<BuildResult<SpecificOptions
|
|
486
|
-
export declare function build(options: BuildOptions): Promise<BuildResult
|
|
514
|
+
export declare function build<SpecificOptions extends BuildOptions>(options: SpecificOptions): Promise<BuildResult<SpecificOptions>>
|
|
515
|
+
export declare function build(options: BuildOptions): Promise<BuildResult>
|
|
487
516
|
|
|
488
517
|
/**
|
|
489
518
|
* This is the advanced long-running form of "build" that supports additional
|
|
@@ -492,10 +521,10 @@ export declare function build(options: BuildOptions): Promise<BuildResult>;
|
|
|
492
521
|
* - Works in node: yes
|
|
493
522
|
* - Works in browser: no
|
|
494
523
|
*
|
|
495
|
-
* Documentation: https://esbuild.github.io/api/#
|
|
524
|
+
* Documentation: https://esbuild.github.io/api/#build
|
|
496
525
|
*/
|
|
497
|
-
export declare function context<T extends BuildOptions>(options: T): Promise<BuildContext<T
|
|
498
|
-
export declare function context(options: BuildOptions): Promise<BuildContext
|
|
526
|
+
export declare function context<T extends BuildOptions>(options: T): Promise<BuildContext<T>>
|
|
527
|
+
export declare function context(options: BuildOptions): Promise<BuildContext>
|
|
499
528
|
|
|
500
529
|
/**
|
|
501
530
|
* This function transforms a single JavaScript file. It can be used to minify
|
|
@@ -506,10 +535,10 @@ export declare function context(options: BuildOptions): Promise<BuildContext>;
|
|
|
506
535
|
* - Works in node: yes
|
|
507
536
|
* - Works in browser: yes
|
|
508
537
|
*
|
|
509
|
-
* Documentation: https://esbuild.github.io/api/#transform
|
|
538
|
+
* Documentation: https://esbuild.github.io/api/#transform
|
|
510
539
|
*/
|
|
511
|
-
export declare function transform<SpecificOptions extends TransformOptions>(input: string | Uint8Array, options?: SpecificOptions): Promise<TransformResult<SpecificOptions
|
|
512
|
-
export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult
|
|
540
|
+
export declare function transform<SpecificOptions extends TransformOptions>(input: string | Uint8Array, options?: SpecificOptions): Promise<TransformResult<SpecificOptions>>
|
|
541
|
+
export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>
|
|
513
542
|
|
|
514
543
|
/**
|
|
515
544
|
* Converts log messages to formatted message strings suitable for printing in
|
|
@@ -519,7 +548,7 @@ export declare function transform(input: string | Uint8Array, options?: Transfor
|
|
|
519
548
|
* - Works in node: yes
|
|
520
549
|
* - Works in browser: yes
|
|
521
550
|
*/
|
|
522
|
-
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]
|
|
551
|
+
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
|
|
523
552
|
|
|
524
553
|
/**
|
|
525
554
|
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
|
@@ -531,7 +560,7 @@ export declare function formatMessages(messages: PartialMessage[], options: Form
|
|
|
531
560
|
*
|
|
532
561
|
* Documentation: https://esbuild.github.io/api/#analyze
|
|
533
562
|
*/
|
|
534
|
-
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string
|
|
563
|
+
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
|
|
535
564
|
|
|
536
565
|
/**
|
|
537
566
|
* A synchronous version of "build".
|
|
@@ -539,10 +568,10 @@ export declare function analyzeMetafile(metafile: Metafile | string, options?: A
|
|
|
539
568
|
* - Works in node: yes
|
|
540
569
|
* - Works in browser: no
|
|
541
570
|
*
|
|
542
|
-
* Documentation: https://esbuild.github.io/api/#build
|
|
571
|
+
* Documentation: https://esbuild.github.io/api/#build
|
|
543
572
|
*/
|
|
544
|
-
export declare function buildSync<SpecificOptions extends BuildOptions>(options: SpecificOptions): BuildResult<SpecificOptions
|
|
545
|
-
export declare function buildSync(options: BuildOptions): BuildResult
|
|
573
|
+
export declare function buildSync<SpecificOptions extends BuildOptions>(options: SpecificOptions): BuildResult<SpecificOptions>
|
|
574
|
+
export declare function buildSync(options: BuildOptions): BuildResult
|
|
546
575
|
|
|
547
576
|
/**
|
|
548
577
|
* A synchronous version of "transform".
|
|
@@ -550,10 +579,10 @@ export declare function buildSync(options: BuildOptions): BuildResult;
|
|
|
550
579
|
* - Works in node: yes
|
|
551
580
|
* - Works in browser: no
|
|
552
581
|
*
|
|
553
|
-
* Documentation: https://esbuild.github.io/api/#transform
|
|
582
|
+
* Documentation: https://esbuild.github.io/api/#transform
|
|
554
583
|
*/
|
|
555
|
-
export declare function transformSync<SpecificOptions extends TransformOptions>(input: string, options?: SpecificOptions): TransformResult<SpecificOptions
|
|
556
|
-
export declare function transformSync(input: string | Uint8Array, options?: TransformOptions): TransformResult
|
|
584
|
+
export declare function transformSync<SpecificOptions extends TransformOptions>(input: string, options?: SpecificOptions): TransformResult<SpecificOptions>
|
|
585
|
+
export declare function transformSync(input: string | Uint8Array, options?: TransformOptions): TransformResult
|
|
557
586
|
|
|
558
587
|
/**
|
|
559
588
|
* A synchronous version of "formatMessages".
|
|
@@ -561,7 +590,7 @@ export declare function transformSync(input: string | Uint8Array, options?: Tran
|
|
|
561
590
|
* - Works in node: yes
|
|
562
591
|
* - Works in browser: no
|
|
563
592
|
*/
|
|
564
|
-
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
|
593
|
+
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
|
565
594
|
|
|
566
595
|
/**
|
|
567
596
|
* A synchronous version of "analyzeMetafile".
|
|
@@ -571,7 +600,7 @@ export declare function formatMessagesSync(messages: PartialMessage[], options:
|
|
|
571
600
|
*
|
|
572
601
|
* Documentation: https://esbuild.github.io/api/#analyze
|
|
573
602
|
*/
|
|
574
|
-
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
|
603
|
+
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
|
575
604
|
|
|
576
605
|
/**
|
|
577
606
|
* This configures the browser-based version of esbuild. It is necessary to
|
|
@@ -581,9 +610,9 @@ export declare function analyzeMetafileSync(metafile: Metafile | string, options
|
|
|
581
610
|
* - Works in node: yes
|
|
582
611
|
* - Works in browser: yes ("options" is required)
|
|
583
612
|
*
|
|
584
|
-
* Documentation: https://esbuild.github.io/api/#
|
|
613
|
+
* Documentation: https://esbuild.github.io/api/#browser
|
|
585
614
|
*/
|
|
586
|
-
export declare function initialize(options: InitializeOptions): Promise<void
|
|
615
|
+
export declare function initialize(options: InitializeOptions): Promise<void>
|
|
587
616
|
|
|
588
617
|
export interface InitializeOptions {
|
|
589
618
|
/**
|
|
@@ -610,4 +639,4 @@ export interface InitializeOptions {
|
|
|
610
639
|
worker?: boolean
|
|
611
640
|
}
|
|
612
641
|
|
|
613
|
-
export let version: string
|
|
642
|
+
export let version: string
|
package/lib/main.js
CHANGED
|
@@ -231,8 +231,8 @@ var mustBeInteger = (value) => typeof value === "number" && value === (value | 0
|
|
|
231
231
|
var mustBeFunction = (value) => typeof value === "function" ? null : "a function";
|
|
232
232
|
var mustBeArray = (value) => Array.isArray(value) ? null : "an array";
|
|
233
233
|
var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object";
|
|
234
|
+
var mustBeEntryPoints = (value) => typeof value === "object" && value !== null ? null : "an array or an object";
|
|
234
235
|
var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module";
|
|
235
|
-
var mustBeArrayOrRecord = (value) => typeof value === "object" && value !== null ? null : "an array or an object";
|
|
236
236
|
var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null";
|
|
237
237
|
var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean";
|
|
238
238
|
var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object";
|
|
@@ -447,7 +447,7 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
|
|
|
447
447
|
let inject = getFlag(options, keys, "inject", mustBeArray);
|
|
448
448
|
let banner = getFlag(options, keys, "banner", mustBeObject);
|
|
449
449
|
let footer = getFlag(options, keys, "footer", mustBeObject);
|
|
450
|
-
let entryPoints = getFlag(options, keys, "entryPoints",
|
|
450
|
+
let entryPoints = getFlag(options, keys, "entryPoints", mustBeEntryPoints);
|
|
451
451
|
let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString);
|
|
452
452
|
let stdin = getFlag(options, keys, "stdin", mustBeObject);
|
|
453
453
|
let write = (_a2 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a2 : writeDefault;
|
|
@@ -558,8 +558,21 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
|
|
|
558
558
|
}
|
|
559
559
|
if (entryPoints) {
|
|
560
560
|
if (Array.isArray(entryPoints)) {
|
|
561
|
-
for (let
|
|
562
|
-
|
|
561
|
+
for (let i = 0, n = entryPoints.length; i < n; i++) {
|
|
562
|
+
let entryPoint = entryPoints[i];
|
|
563
|
+
if (typeof entryPoint === "object" && entryPoint !== null) {
|
|
564
|
+
let entryPointKeys = /* @__PURE__ */ Object.create(null);
|
|
565
|
+
let input = getFlag(entryPoint, entryPointKeys, "in", mustBeString);
|
|
566
|
+
let output = getFlag(entryPoint, entryPointKeys, "out", mustBeString);
|
|
567
|
+
checkForInvalidFlags(entryPoint, entryPointKeys, "in entry point at index " + i);
|
|
568
|
+
if (input === void 0)
|
|
569
|
+
throw new Error('Missing property "in" for entry point at index ' + i);
|
|
570
|
+
if (output === void 0)
|
|
571
|
+
throw new Error('Missing property "out" for entry point at index ' + i);
|
|
572
|
+
entries.push([output, input]);
|
|
573
|
+
} else {
|
|
574
|
+
entries.push(["", validateStringValue(entryPoint, "entry point at index " + i)]);
|
|
575
|
+
}
|
|
563
576
|
}
|
|
564
577
|
} else {
|
|
565
578
|
for (let key in entryPoints) {
|
|
@@ -722,8 +735,8 @@ function createChannel(streamIn) {
|
|
|
722
735
|
if (isFirstPacket) {
|
|
723
736
|
isFirstPacket = false;
|
|
724
737
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
725
|
-
if (binaryVersion !== "0.17.
|
|
726
|
-
throw new Error(`Cannot start service: Host version "${"0.17.
|
|
738
|
+
if (binaryVersion !== "0.17.2") {
|
|
739
|
+
throw new Error(`Cannot start service: Host version "${"0.17.2"}" does not match binary version ${quote(binaryVersion)}`);
|
|
727
740
|
}
|
|
728
741
|
return;
|
|
729
742
|
}
|
|
@@ -967,7 +980,7 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
|
|
|
967
980
|
if (!result.ok)
|
|
968
981
|
return handleError(result.error, result.pluginName);
|
|
969
982
|
try {
|
|
970
|
-
buildOrContextContinue(result.requestPlugins, result.runOnEndCallbacks);
|
|
983
|
+
buildOrContextContinue(result.requestPlugins, result.runOnEndCallbacks, result.scheduleOnDisposeCallbacks);
|
|
971
984
|
} catch (e) {
|
|
972
985
|
handleError(e, "");
|
|
973
986
|
}
|
|
@@ -977,11 +990,12 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
|
|
|
977
990
|
return;
|
|
978
991
|
}
|
|
979
992
|
try {
|
|
980
|
-
buildOrContextContinue(null, (result, done) => done([], []))
|
|
993
|
+
buildOrContextContinue(null, (result, done) => done([], []), () => {
|
|
994
|
+
});
|
|
981
995
|
} catch (e) {
|
|
982
996
|
handleError(e, "");
|
|
983
997
|
}
|
|
984
|
-
function buildOrContextContinue(requestPlugins, runOnEndCallbacks) {
|
|
998
|
+
function buildOrContextContinue(requestPlugins, runOnEndCallbacks, scheduleOnDisposeCallbacks) {
|
|
985
999
|
const writeDefault = streamIn.hasFS;
|
|
986
1000
|
const {
|
|
987
1001
|
entries,
|
|
@@ -1058,7 +1072,10 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
|
|
|
1058
1072
|
if (error)
|
|
1059
1073
|
return callback(new Error(error), null);
|
|
1060
1074
|
if (!isContext) {
|
|
1061
|
-
return buildResponseToResult(response,
|
|
1075
|
+
return buildResponseToResult(response, (err, res) => {
|
|
1076
|
+
scheduleOnDisposeCallbacks();
|
|
1077
|
+
return callback(err, res);
|
|
1078
|
+
});
|
|
1062
1079
|
}
|
|
1063
1080
|
if (response.errors.length > 0) {
|
|
1064
1081
|
return callback(failureErrorWithLog("Context failed", response.errors, response.warnings), null);
|
|
@@ -1146,15 +1163,28 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
|
|
|
1146
1163
|
resolve(response2);
|
|
1147
1164
|
});
|
|
1148
1165
|
}),
|
|
1166
|
+
cancel: () => new Promise((resolve) => {
|
|
1167
|
+
if (didDispose)
|
|
1168
|
+
return resolve();
|
|
1169
|
+
const request2 = {
|
|
1170
|
+
command: "cancel",
|
|
1171
|
+
key: buildKey
|
|
1172
|
+
};
|
|
1173
|
+
sendRequest(refs, request2, () => {
|
|
1174
|
+
resolve();
|
|
1175
|
+
});
|
|
1176
|
+
}),
|
|
1149
1177
|
dispose: () => new Promise((resolve) => {
|
|
1150
1178
|
if (didDispose)
|
|
1151
1179
|
return resolve();
|
|
1180
|
+
didDispose = true;
|
|
1152
1181
|
const request2 = {
|
|
1153
1182
|
command: "dispose",
|
|
1154
1183
|
key: buildKey
|
|
1155
1184
|
};
|
|
1156
1185
|
sendRequest(refs, request2, () => {
|
|
1157
1186
|
resolve();
|
|
1187
|
+
scheduleOnDisposeCallbacks();
|
|
1158
1188
|
refs.unref();
|
|
1159
1189
|
});
|
|
1160
1190
|
})
|
|
@@ -1169,6 +1199,7 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
|
|
|
1169
1199
|
let onEndCallbacks = [];
|
|
1170
1200
|
let onResolveCallbacks = {};
|
|
1171
1201
|
let onLoadCallbacks = {};
|
|
1202
|
+
let onDisposeCallbacks = [];
|
|
1172
1203
|
let nextCallbackID = 0;
|
|
1173
1204
|
let i = 0;
|
|
1174
1205
|
let requestPlugins = [];
|
|
@@ -1286,6 +1317,9 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
|
|
|
1286
1317
|
onLoadCallbacks[id] = { name, callback, note: registeredNote };
|
|
1287
1318
|
plugin.onLoad.push({ id, filter: filter.source, namespace: namespace || "" });
|
|
1288
1319
|
},
|
|
1320
|
+
onDispose(callback) {
|
|
1321
|
+
onDisposeCallbacks.push(callback);
|
|
1322
|
+
},
|
|
1289
1323
|
esbuild: streamIn.esbuild
|
|
1290
1324
|
});
|
|
1291
1325
|
if (promise)
|
|
@@ -1479,11 +1513,17 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
|
|
|
1479
1513
|
})();
|
|
1480
1514
|
};
|
|
1481
1515
|
}
|
|
1516
|
+
let scheduleOnDisposeCallbacks = () => {
|
|
1517
|
+
for (const cb of onDisposeCallbacks) {
|
|
1518
|
+
setTimeout(() => cb(), 0);
|
|
1519
|
+
}
|
|
1520
|
+
};
|
|
1482
1521
|
isSetupDone = true;
|
|
1483
1522
|
return {
|
|
1484
1523
|
ok: true,
|
|
1485
1524
|
requestPlugins,
|
|
1486
|
-
runOnEndCallbacks
|
|
1525
|
+
runOnEndCallbacks,
|
|
1526
|
+
scheduleOnDisposeCallbacks
|
|
1487
1527
|
};
|
|
1488
1528
|
};
|
|
1489
1529
|
function createObjectStash() {
|
|
@@ -1864,7 +1904,7 @@ for your current platform.`);
|
|
|
1864
1904
|
"node_modules",
|
|
1865
1905
|
".cache",
|
|
1866
1906
|
"esbuild",
|
|
1867
|
-
`pnpapi-${pkg.replace("/", "-")}-${"0.17.
|
|
1907
|
+
`pnpapi-${pkg.replace("/", "-")}-${"0.17.2"}-${path.basename(subpath)}`
|
|
1868
1908
|
);
|
|
1869
1909
|
if (!fs.existsSync(binTargetPath)) {
|
|
1870
1910
|
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
|
@@ -1899,7 +1939,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
|
1899
1939
|
}
|
|
1900
1940
|
}
|
|
1901
1941
|
var _a;
|
|
1902
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.17.
|
|
1942
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.17.2";
|
|
1903
1943
|
var esbuildCommandAndArgs = () => {
|
|
1904
1944
|
if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
|
1905
1945
|
throw new Error(
|
|
@@ -1966,7 +2006,7 @@ var fsAsync = {
|
|
|
1966
2006
|
}
|
|
1967
2007
|
}
|
|
1968
2008
|
};
|
|
1969
|
-
var version = "0.17.
|
|
2009
|
+
var version = "0.17.2";
|
|
1970
2010
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1971
2011
|
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
|
1972
2012
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -2076,7 +2116,7 @@ var ensureServiceIsRunning = () => {
|
|
|
2076
2116
|
if (longLivedService)
|
|
2077
2117
|
return longLivedService;
|
|
2078
2118
|
let [command, args] = esbuildCommandAndArgs();
|
|
2079
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.17.
|
|
2119
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.17.2"}`, "--ping"), {
|
|
2080
2120
|
windowsHide: true,
|
|
2081
2121
|
stdio: ["pipe", "pipe", "inherit"],
|
|
2082
2122
|
cwd: defaultWD
|
|
@@ -2176,7 +2216,7 @@ var runServiceSync = (callback) => {
|
|
|
2176
2216
|
esbuild: node_exports
|
|
2177
2217
|
});
|
|
2178
2218
|
callback(service);
|
|
2179
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.17.
|
|
2219
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.17.2"}`), {
|
|
2180
2220
|
cwd: defaultWD,
|
|
2181
2221
|
windowsHide: true,
|
|
2182
2222
|
input: stdin,
|
|
@@ -2196,7 +2236,7 @@ var workerThreadService = null;
|
|
|
2196
2236
|
var startWorkerThreadService = (worker_threads2) => {
|
|
2197
2237
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
|
2198
2238
|
let worker = new worker_threads2.Worker(__filename, {
|
|
2199
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.17.
|
|
2239
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.17.2" },
|
|
2200
2240
|
transferList: [workerPort],
|
|
2201
2241
|
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
|
2202
2242
|
//
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esbuild",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
|
5
5
|
"repository": "https://github.com/evanw/esbuild",
|
|
6
6
|
"scripts": {
|
|
@@ -15,28 +15,28 @@
|
|
|
15
15
|
"esbuild": "bin/esbuild"
|
|
16
16
|
},
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@esbuild/android-arm": "0.17.
|
|
19
|
-
"@esbuild/android-arm64": "0.17.
|
|
20
|
-
"@esbuild/android-x64": "0.17.
|
|
21
|
-
"@esbuild/darwin-arm64": "0.17.
|
|
22
|
-
"@esbuild/darwin-x64": "0.17.
|
|
23
|
-
"@esbuild/freebsd-arm64": "0.17.
|
|
24
|
-
"@esbuild/freebsd-x64": "0.17.
|
|
25
|
-
"@esbuild/linux-arm": "0.17.
|
|
26
|
-
"@esbuild/linux-arm64": "0.17.
|
|
27
|
-
"@esbuild/linux-ia32": "0.17.
|
|
28
|
-
"@esbuild/linux-loong64": "0.17.
|
|
29
|
-
"@esbuild/linux-mips64el": "0.17.
|
|
30
|
-
"@esbuild/linux-ppc64": "0.17.
|
|
31
|
-
"@esbuild/linux-riscv64": "0.17.
|
|
32
|
-
"@esbuild/linux-s390x": "0.17.
|
|
33
|
-
"@esbuild/linux-x64": "0.17.
|
|
34
|
-
"@esbuild/netbsd-x64": "0.17.
|
|
35
|
-
"@esbuild/openbsd-x64": "0.17.
|
|
36
|
-
"@esbuild/sunos-x64": "0.17.
|
|
37
|
-
"@esbuild/win32-arm64": "0.17.
|
|
38
|
-
"@esbuild/win32-ia32": "0.17.
|
|
39
|
-
"@esbuild/win32-x64": "0.17.
|
|
18
|
+
"@esbuild/android-arm": "0.17.2",
|
|
19
|
+
"@esbuild/android-arm64": "0.17.2",
|
|
20
|
+
"@esbuild/android-x64": "0.17.2",
|
|
21
|
+
"@esbuild/darwin-arm64": "0.17.2",
|
|
22
|
+
"@esbuild/darwin-x64": "0.17.2",
|
|
23
|
+
"@esbuild/freebsd-arm64": "0.17.2",
|
|
24
|
+
"@esbuild/freebsd-x64": "0.17.2",
|
|
25
|
+
"@esbuild/linux-arm": "0.17.2",
|
|
26
|
+
"@esbuild/linux-arm64": "0.17.2",
|
|
27
|
+
"@esbuild/linux-ia32": "0.17.2",
|
|
28
|
+
"@esbuild/linux-loong64": "0.17.2",
|
|
29
|
+
"@esbuild/linux-mips64el": "0.17.2",
|
|
30
|
+
"@esbuild/linux-ppc64": "0.17.2",
|
|
31
|
+
"@esbuild/linux-riscv64": "0.17.2",
|
|
32
|
+
"@esbuild/linux-s390x": "0.17.2",
|
|
33
|
+
"@esbuild/linux-x64": "0.17.2",
|
|
34
|
+
"@esbuild/netbsd-x64": "0.17.2",
|
|
35
|
+
"@esbuild/openbsd-x64": "0.17.2",
|
|
36
|
+
"@esbuild/sunos-x64": "0.17.2",
|
|
37
|
+
"@esbuild/win32-arm64": "0.17.2",
|
|
38
|
+
"@esbuild/win32-ia32": "0.17.2",
|
|
39
|
+
"@esbuild/win32-x64": "0.17.2"
|
|
40
40
|
},
|
|
41
41
|
"license": "MIT"
|
|
42
42
|
}
|