1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import type { FormatMessagesOptions, PartialMessage, TransformOptions, TransformResult } from 'esbuild';
|
---|
9 | /**
|
---|
10 | * Provides the ability to execute esbuild regardless of the current platform's support
|
---|
11 | * for using the native variant of esbuild. The native variant will be preferred (assuming
|
---|
12 | * the `alwaysUseWasm` constructor option is `false) due to its inherent performance advantages.
|
---|
13 | * At first use of esbuild, a supportability test will be automatically performed and the
|
---|
14 | * WASM-variant will be used if needed by the platform.
|
---|
15 | */
|
---|
16 | export declare class EsbuildExecutor implements Pick<typeof import('esbuild'), 'transform' | 'formatMessages'> {
|
---|
17 | private alwaysUseWasm;
|
---|
18 | private esbuildTransform;
|
---|
19 | private esbuildFormatMessages;
|
---|
20 | private initialized;
|
---|
21 | /**
|
---|
22 | * Constructs an instance of the `EsbuildExecutor` class.
|
---|
23 | *
|
---|
24 | * @param alwaysUseWasm If true, the WASM-variant will be preferred and no support test will be
|
---|
25 | * performed; if false (default), the native variant will be preferred.
|
---|
26 | */
|
---|
27 | constructor(alwaysUseWasm?: boolean);
|
---|
28 | /**
|
---|
29 | * Determines whether the native variant of esbuild can be used on the current platform.
|
---|
30 | *
|
---|
31 | * @returns True, if the native variant of esbuild is support; False, if the WASM variant is required.
|
---|
32 | */
|
---|
33 | static hasNativeSupport(): boolean;
|
---|
34 | /**
|
---|
35 | * Initializes the esbuild transform and format messages functions.
|
---|
36 | *
|
---|
37 | * @returns A promise that fulfills when esbuild has been loaded and available for use.
|
---|
38 | */
|
---|
39 | private ensureEsbuild;
|
---|
40 | /**
|
---|
41 | * Transitions an executor instance to use the WASM-variant of esbuild.
|
---|
42 | */
|
---|
43 | private useWasm;
|
---|
44 | transform(input: string, options?: TransformOptions): Promise<TransformResult>;
|
---|
45 | formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>;
|
---|
46 | }
|
---|