esbuild-wasm-strapkit 0.16.17-build.3 → 0.17.0-build.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esbuild.wasm CHANGED
Binary file
package/esm/browser.d.ts CHANGED
@@ -132,8 +132,6 @@ export interface BuildOptions extends CommonOptions {
132
132
  banner?: { [type: string]: string };
133
133
  /** Documentation: https://esbuild.github.io/api/#footer */
134
134
  footer?: { [type: string]: string };
135
- /** Documentation: https://esbuild.github.io/api/#incremental */
136
- incremental?: boolean;
137
135
  /** Documentation: https://esbuild.github.io/api/#entry-points */
138
136
  entryPoints?: string[] | Record<string, string>;
139
137
  /** Documentation: https://esbuild.github.io/api/#stdin */
@@ -144,12 +142,6 @@ export interface BuildOptions extends CommonOptions {
144
142
  absWorkingDir?: string;
145
143
  /** Documentation: https://esbuild.github.io/api/#node-paths */
146
144
  nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
147
- /** Documentation: https://esbuild.github.io/api/#watch */
148
- watch?: boolean | WatchMode;
149
- }
150
-
151
- export interface WatchMode {
152
- onRebuild?: (error: BuildFailure | null, result: BuildResult | null) => void;
153
145
  }
154
146
 
155
147
  export interface StdinOptions {
@@ -199,28 +191,15 @@ export interface OutputFile {
199
191
  readonly text: string;
200
192
  }
201
193
 
202
- export interface BuildInvalidate {
203
- (): Promise<BuildIncremental>;
204
- dispose(): void;
205
- }
206
-
207
- export interface BuildIncremental extends BuildResult {
208
- rebuild: BuildInvalidate;
209
- }
210
-
211
- export interface BuildResult {
194
+ export interface BuildResult<SpecificOptions extends BuildOptions = BuildOptions> {
212
195
  errors: Message[];
213
196
  warnings: Message[];
214
197
  /** Only when "write: false" */
215
- outputFiles?: OutputFile[];
216
- /** Only when "incremental: true" */
217
- rebuild?: BuildInvalidate;
218
- /** Only when "watch: true" */
219
- stop?: () => void;
198
+ outputFiles: OutputFile[] | (SpecificOptions['write'] extends false ? never : undefined);
220
199
  /** Only when "metafile: true" */
221
- metafile?: Metafile;
200
+ metafile: Metafile | (SpecificOptions['metafile'] extends true ? never : undefined);
222
201
  /** Only when "mangleCache" is present */
223
- mangleCache?: Record<string, string | false>;
202
+ mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined);
224
203
  }
225
204
 
226
205
  export interface BuildFailure extends Error {
@@ -233,6 +212,8 @@ export interface ServeOptions {
233
212
  port?: number;
234
213
  host?: string;
235
214
  servedir?: string;
215
+ keyfile?: string
216
+ certfile?: string
236
217
  onRequest?: (args: ServeOnRequestArgs) => void;
237
218
  }
238
219
 
@@ -249,8 +230,6 @@ export interface ServeOnRequestArgs {
249
230
  export interface ServeResult {
250
231
  port: number;
251
232
  host: string;
252
- wait: Promise<void>;
253
- stop: () => void;
254
233
  }
255
234
 
256
235
  export interface TransformOptions extends CommonOptions {
@@ -274,14 +253,14 @@ export interface TransformOptions extends CommonOptions {
274
253
  footer?: string;
275
254
  }
276
255
 
277
- export interface TransformResult {
256
+ export interface TransformResult<SpecificOptions extends TransformOptions = TransformOptions> {
278
257
  code: string;
279
258
  map: string;
280
259
  warnings: Message[];
281
260
  /** Only when "mangleCache" is present */
282
- mangleCache?: Record<string, string | false>;
261
+ mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined);
283
262
  /** Only when "legalComments" is "external" */
284
- legalComments?: string;
263
+ legalComments: string | (SpecificOptions['legalComments'] extends 'external' ? never : undefined);
285
264
  }
286
265
 
287
266
  export interface TransformFailure extends Error {
@@ -301,7 +280,7 @@ export interface PluginBuild {
301
280
  onStart(callback: () =>
302
281
  (OnStartResult | null | void | Promise<OnStartResult | null | void>)): void;
303
282
  onEnd(callback: (result: BuildResult) =>
304
- (void | Promise<void>)): void;
283
+ (OnEndResult | null | void | Promise<OnEndResult | null | void>)): void;
305
284
  onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
306
285
  (OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void;
307
286
  onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
@@ -309,7 +288,7 @@ export interface PluginBuild {
309
288
 
310
289
  // This is a full copy of the esbuild library in case you need it
311
290
  esbuild: {
312
- serve: typeof serve,
291
+ context: typeof context,
313
292
  build: typeof build,
314
293
  buildSync: typeof buildSync,
315
294
  transform: typeof transform,
@@ -349,6 +328,11 @@ export interface OnStartResult {
349
328
  warnings?: PartialMessage[];
350
329
  }
351
330
 
331
+ export interface OnEndResult {
332
+ errors?: PartialMessage[];
333
+ warnings?: PartialMessage[];
334
+ }
335
+
352
336
  export interface OnResolveOptions {
353
337
  filter: RegExp;
354
338
  namespace?: string;
@@ -478,6 +462,16 @@ export interface AnalyzeMetafileOptions {
478
462
  verbose?: boolean;
479
463
  }
480
464
 
465
+ export interface WatchOptions {
466
+ }
467
+
468
+ export interface BuildContext<SpecificOptions extends BuildOptions = BuildOptions> {
469
+ rebuild(): Promise<BuildResult<SpecificOptions>>
470
+ watch(options?: WatchOptions): void
471
+ serve(options?: ServeOptions): Promise<ServeResult>
472
+ dispose(): Promise<void>
473
+ }
474
+
481
475
  /**
482
476
  * This function invokes the "esbuild" command-line tool for you. It returns a
483
477
  * promise that either resolves with a "BuildResult" object or rejects with a
@@ -488,22 +482,20 @@ export interface AnalyzeMetafileOptions {
488
482
  *
489
483
  * Documentation: https://esbuild.github.io/api/#build-api
490
484
  */
491
- export declare function build(options: BuildOptions & { write: false }): Promise<BuildResult & { outputFiles: OutputFile[] }>;
492
- export declare function build(options: BuildOptions & { incremental: true, metafile: true }): Promise<BuildIncremental & { metafile: Metafile }>;
493
- export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
494
- export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
485
+ export declare function build<SpecificOptions extends BuildOptions>(options: SpecificOptions): Promise<BuildResult<SpecificOptions>>;
495
486
  export declare function build(options: BuildOptions): Promise<BuildResult>;
496
487
 
497
488
  /**
498
- * This function is similar to "build" but it serves the resulting files over
499
- * HTTP on a localhost address with the specified port.
489
+ * This is the advanced long-running form of "build" that supports additional
490
+ * features such as watch mode and a local development server.
500
491
  *
501
492
  * - Works in node: yes
502
493
  * - Works in browser: no
503
494
  *
504
- * Documentation: https://esbuild.github.io/api/#serve
495
+ * Documentation: https://esbuild.github.io/api/#context-api
505
496
  */
506
- export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOptions): Promise<ServeResult>;
497
+ export declare function context<T extends BuildOptions>(options: T): Promise<BuildContext<T>>;
498
+ export declare function context(options: BuildOptions): Promise<BuildContext>;
507
499
 
508
500
  /**
509
501
  * This function transforms a single JavaScript file. It can be used to minify
@@ -516,6 +508,7 @@ export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOpt
516
508
  *
517
509
  * Documentation: https://esbuild.github.io/api/#transform-api
518
510
  */
511
+ export declare function transform<SpecificOptions extends TransformOptions>(input: string | Uint8Array, options?: SpecificOptions): Promise<TransformResult<SpecificOptions>>;
519
512
  export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>;
520
513
 
521
514
  /**
@@ -548,7 +541,7 @@ export declare function analyzeMetafile(metafile: Metafile | string, options?: A
548
541
  *
549
542
  * Documentation: https://esbuild.github.io/api/#build-api
550
543
  */
551
- export declare function buildSync(options: BuildOptions & { write: false }): BuildResult & { outputFiles: OutputFile[] };
544
+ export declare function buildSync<SpecificOptions extends BuildOptions>(options: SpecificOptions): BuildResult<SpecificOptions>;
552
545
  export declare function buildSync(options: BuildOptions): BuildResult;
553
546
 
554
547
  /**
@@ -559,7 +552,8 @@ export declare function buildSync(options: BuildOptions): BuildResult;
559
552
  *
560
553
  * Documentation: https://esbuild.github.io/api/#transform-api
561
554
  */
562
- export declare function transformSync(input: string, options?: TransformOptions): TransformResult;
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;
563
557
 
564
558
  /**
565
559
  * A synchronous version of "formatMessages".