@rolldown/browser 1.0.0-beta.7-commit.a0a7d95
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/LICENSE +25 -0
- package/bin/cli.mjs +2 -0
- package/dist/browser-bundler.mjs +3514 -0
- package/dist/browser.js +4626 -0
- package/dist/cli.cjs +1759 -0
- package/dist/cli.mjs +1828 -0
- package/dist/experimental-index.cjs +87 -0
- package/dist/experimental-index.mjs +67 -0
- package/dist/index.cjs +9 -0
- package/dist/index.mjs +5 -0
- package/dist/parallel-plugin-worker.cjs +43 -0
- package/dist/parallel-plugin-worker.mjs +48 -0
- package/dist/parallel-plugin.cjs +9 -0
- package/dist/parallel-plugin.mjs +8 -0
- package/dist/parse-ast-index.cjs +4 -0
- package/dist/parse-ast-index.mjs +4 -0
- package/dist/rolldown-binding.wasi-browser.js +102 -0
- package/dist/rolldown-binding.wasi.cjs +127 -0
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/chunk-BuCFLigr.mjs +12 -0
- package/dist/shared/chunk-Dc32QXFI.cjs +31 -0
- package/dist/shared/parse-ast-index-C29iO6Jv.cjs +316 -0
- package/dist/shared/parse-ast-index-GcZLh6_d.mjs +273 -0
- package/dist/shared/prompt-B3VJLbs9.mjs +854 -0
- package/dist/shared/prompt-wpCBKCzA.cjs +855 -0
- package/dist/shared/src-6_rb-jCl.cjs +3147 -0
- package/dist/shared/src-QrPvO0Ec.mjs +4375 -0
- package/dist/types/api/build.d.ts +18 -0
- package/dist/types/api/experimental.d.ts +7 -0
- package/dist/types/api/rolldown/index.d.ts +3 -0
- package/dist/types/api/rolldown/rolldown-build.d.ts +15 -0
- package/dist/types/api/watch/index.d.ts +3 -0
- package/dist/types/api/watch/watch-emitter.d.ts +31 -0
- package/dist/types/api/watch/watcher.d.ts +13 -0
- package/dist/types/binding.d.ts +1504 -0
- package/dist/types/builtin-plugin/alias-plugin.d.ts +10 -0
- package/dist/types/builtin-plugin/constructors.d.ts +22 -0
- package/dist/types/builtin-plugin/replace-plugin.d.ts +27 -0
- package/dist/types/builtin-plugin/transform-plugin.d.ts +9 -0
- package/dist/types/builtin-plugin/utils.d.ts +8 -0
- package/dist/types/cli/arguments/alias.d.ts +16 -0
- package/dist/types/cli/arguments/index.d.ts +15 -0
- package/dist/types/cli/arguments/normalize.d.ts +16 -0
- package/dist/types/cli/arguments/utils.d.ts +8 -0
- package/dist/types/cli/commands/bundle.d.ts +3 -0
- package/dist/types/cli/commands/help.d.ts +1 -0
- package/dist/types/cli/index.d.ts +1 -0
- package/dist/types/cli/load-config.d.ts +5 -0
- package/dist/types/cli/logger.d.ts +5 -0
- package/dist/types/constants/plugin-context.d.ts +7 -0
- package/dist/types/constants/plugin.d.ts +45 -0
- package/dist/types/experimental-index.d.ts +9 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/log/log-handler.d.ts +4 -0
- package/dist/types/log/logger.d.ts +6 -0
- package/dist/types/log/logging.d.ts +12 -0
- package/dist/types/log/logs.d.ts +18 -0
- package/dist/types/options/generated/checks-options.d.ts +57 -0
- package/dist/types/options/input-options.d.ts +185 -0
- package/dist/types/options/normalized-input-options.d.ts +18 -0
- package/dist/types/options/normalized-output-options.d.ts +70 -0
- package/dist/types/options/output-options.d.ts +182 -0
- package/dist/types/options/watch-options.d.ts +5 -0
- package/dist/types/parallel-plugin-worker.d.ts +1 -0
- package/dist/types/parallel-plugin.d.ts +1 -0
- package/dist/types/parse-ast-index.d.ts +5 -0
- package/dist/types/plugin/bindingify-build-hooks.d.ts +10 -0
- package/dist/types/plugin/bindingify-hook-filter.d.ts +7 -0
- package/dist/types/plugin/bindingify-output-hooks.d.ts +14 -0
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +8 -0
- package/dist/types/plugin/bindingify-plugin.d.ts +17 -0
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +5 -0
- package/dist/types/plugin/hook-filter.d.ts +49 -0
- package/dist/types/plugin/index.d.ts +141 -0
- package/dist/types/plugin/minimal-plugin-context.d.ts +24 -0
- package/dist/types/plugin/parallel-plugin-implementation.d.ts +10 -0
- package/dist/types/plugin/parallel-plugin.d.ts +9 -0
- package/dist/types/plugin/plugin-context-data.d.ts +21 -0
- package/dist/types/plugin/plugin-context.d.ts +67 -0
- package/dist/types/plugin/plugin-driver.d.ts +10 -0
- package/dist/types/plugin/transform-plugin-context.d.ts +28 -0
- package/dist/types/plugin/with-filter.d.ts +10 -0
- package/dist/types/types/assert.d.ts +14 -0
- package/dist/types/types/config-export.d.ts +5 -0
- package/dist/types/types/misc.d.ts +40 -0
- package/dist/types/types/module-info.d.ts +15 -0
- package/dist/types/types/module-side-effects.d.ts +12 -0
- package/dist/types/types/output-bundle.d.ts +4 -0
- package/dist/types/types/rolldown-options.d.ts +5 -0
- package/dist/types/types/rolldown-output.d.ts +66 -0
- package/dist/types/types/schema.d.ts +33 -0
- package/dist/types/types/sourcemap.d.ts +14 -0
- package/dist/types/types/utils.d.ts +13 -0
- package/dist/types/types.d.ts +7 -0
- package/dist/types/utils/asset-source.d.ts +4 -0
- package/dist/types/utils/async-flatten.d.ts +1 -0
- package/dist/types/utils/bindingify-input-options.d.ts +7 -0
- package/dist/types/utils/bindingify-output-options.d.ts +5 -0
- package/dist/types/utils/code-frame.d.ts +1 -0
- package/dist/types/utils/compose-js-plugins.d.ts +2 -0
- package/dist/types/utils/create-bundler-option.d.ts +11 -0
- package/dist/types/utils/create-bundler.d.ts +9 -0
- package/dist/types/utils/define-config.d.ts +5 -0
- package/dist/types/utils/error.d.ts +2 -0
- package/dist/types/utils/initialize-parallel-plugins.d.ts +17 -0
- package/dist/types/utils/misc.d.ts +7 -0
- package/dist/types/utils/normalize-hook.d.ts +7 -0
- package/dist/types/utils/normalize-plugin-option.d.ts +13 -0
- package/dist/types/utils/normalize-string-or-regex.d.ts +2 -0
- package/dist/types/utils/plugin/index.d.ts +2 -0
- package/dist/types/utils/resolved-external.d.ts +4 -0
- package/dist/types/utils/transform-module-info.d.ts +4 -0
- package/dist/types/utils/transform-rendered-chunk.d.ts +4 -0
- package/dist/types/utils/transform-rendered-module.d.ts +3 -0
- package/dist/types/utils/transform-side-effects.d.ts +3 -0
- package/dist/types/utils/transform-sourcemap.d.ts +3 -0
- package/dist/types/utils/transform-to-rollup-output.d.ts +11 -0
- package/dist/types/utils/validator.d.ts +6 -0
- package/dist/wasi-worker-browser.mjs +39 -0
- package/dist/wasi-worker.mjs +63 -0
- package/package.json +85 -0
|
@@ -0,0 +1,1504 @@
|
|
|
1
|
+
type MaybePromise<T> = T | Promise<T>
|
|
2
|
+
type Nullable<T> = T | null | undefined
|
|
3
|
+
type VoidNullable<T = void> = T | null | undefined | void
|
|
4
|
+
export type BindingStringOrRegex = string | RegExp
|
|
5
|
+
|
|
6
|
+
export declare class BindingBundleEndEventData {
|
|
7
|
+
output: string
|
|
8
|
+
duration: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export declare class BindingCallableBuiltinPlugin {
|
|
12
|
+
constructor(plugin: BindingBuiltinPlugin)
|
|
13
|
+
resolveId(id: string, importer?: string | undefined | null, options?: BindingHookJsResolveIdOptions | undefined | null): Promise<BindingHookJsResolveIdOutput | null>
|
|
14
|
+
load(id: string): Promise<BindingHookJsLoadOutput | null>
|
|
15
|
+
watchChange(path: string, event: BindingJsWatchChangeEvent): Promise<void>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export declare class BindingError {
|
|
19
|
+
kind: string
|
|
20
|
+
message: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare class BindingModuleInfo {
|
|
24
|
+
id: string
|
|
25
|
+
importers: Array<string>
|
|
26
|
+
dynamicImporters: Array<string>
|
|
27
|
+
importedIds: Array<string>
|
|
28
|
+
dynamicallyImportedIds: Array<string>
|
|
29
|
+
exports: Array<string>
|
|
30
|
+
isEntry: boolean
|
|
31
|
+
get code(): string | null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare class BindingNormalizedOptions {
|
|
35
|
+
get input(): Array<string> | Record<string, string>
|
|
36
|
+
get cwd(): string | null
|
|
37
|
+
get platform(): 'node' | 'browser' | 'neutral'
|
|
38
|
+
get shimMissingExports(): boolean
|
|
39
|
+
get name(): string | null
|
|
40
|
+
get cssEntryFilenames(): string | undefined
|
|
41
|
+
get cssChunkFilenames(): string | undefined
|
|
42
|
+
get entryFilenames(): string | undefined
|
|
43
|
+
get chunkFilenames(): string | undefined
|
|
44
|
+
get assetFilenames(): string | undefined
|
|
45
|
+
get dir(): string | null
|
|
46
|
+
get file(): string | null
|
|
47
|
+
get format(): 'es' | 'cjs' | 'app' | 'iife' | 'umd'
|
|
48
|
+
get exports(): 'default' | 'named' | 'none' | 'auto'
|
|
49
|
+
get esModule(): boolean | 'if-default-prop'
|
|
50
|
+
get inlineDynamicImports(): boolean
|
|
51
|
+
get sourcemap(): boolean | 'inline' | 'hidden'
|
|
52
|
+
get banner(): string | undefined | null | undefined
|
|
53
|
+
get footer(): string | undefined | null | undefined
|
|
54
|
+
get intro(): string | undefined | null | undefined
|
|
55
|
+
get outro(): string | undefined | null | undefined
|
|
56
|
+
get externalLiveBindings(): boolean
|
|
57
|
+
get extend(): boolean
|
|
58
|
+
get globals(): Record<string, string> | undefined
|
|
59
|
+
get hashCharacters(): 'base64' | 'base36' | 'hex'
|
|
60
|
+
get sourcemapDebugIds(): boolean
|
|
61
|
+
get minify(): false | BindingMinifyOptions
|
|
62
|
+
get polyfillRequire(): boolean
|
|
63
|
+
get comments(): 'none' | 'preserve-legal'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export declare class BindingOutputAsset {
|
|
67
|
+
get fileName(): string
|
|
68
|
+
get originalFileName(): string | null
|
|
69
|
+
get originalFileNames(): Array<string>
|
|
70
|
+
get source(): BindingAssetSource
|
|
71
|
+
get name(): string | null
|
|
72
|
+
get names(): Array<string>
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export declare class BindingOutputChunk {
|
|
76
|
+
get isEntry(): boolean
|
|
77
|
+
get isDynamicEntry(): boolean
|
|
78
|
+
get facadeModuleId(): string | null
|
|
79
|
+
get moduleIds(): Array<string>
|
|
80
|
+
get exports(): Array<string>
|
|
81
|
+
get fileName(): string
|
|
82
|
+
get modules(): BindingModules
|
|
83
|
+
get imports(): Array<string>
|
|
84
|
+
get dynamicImports(): Array<string>
|
|
85
|
+
get code(): string
|
|
86
|
+
get map(): string | null
|
|
87
|
+
get sourcemapFileName(): string | null
|
|
88
|
+
get preliminaryFileName(): string
|
|
89
|
+
get name(): string
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare class BindingOutputs {
|
|
93
|
+
get chunks(): Array<BindingOutputChunk>
|
|
94
|
+
get assets(): Array<BindingOutputAsset>
|
|
95
|
+
get errors(): Array<Error | BindingError>
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export declare class BindingPluginContext {
|
|
99
|
+
load(specifier: string, sideEffects: BindingHookSideEffects | undefined, fn: (success: boolean) => void): Promise<void>
|
|
100
|
+
resolve(specifier: string, importer?: string | undefined | null, extraOptions?: BindingPluginContextResolveOptions | undefined | null): Promise<BindingPluginContextResolvedId | null>
|
|
101
|
+
emitFile(file: BindingEmittedAsset, assetFilename?: string | undefined | null, fnSanitizedFileName?: string | undefined | null): string
|
|
102
|
+
emitChunk(file: BindingEmittedChunk): string
|
|
103
|
+
getFileName(referenceId: string): string
|
|
104
|
+
getModuleInfo(moduleId: string): BindingModuleInfo | null
|
|
105
|
+
getModuleIds(): Array<string>
|
|
106
|
+
addWatchFile(file: string): void
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export declare class BindingRenderedChunk {
|
|
110
|
+
get name(): string
|
|
111
|
+
get isEntry(): boolean
|
|
112
|
+
get isDynamicEntry(): boolean
|
|
113
|
+
get facadeModuleId(): string | null
|
|
114
|
+
get moduleIds(): Array<string>
|
|
115
|
+
get exports(): Array<string>
|
|
116
|
+
get fileName(): string
|
|
117
|
+
get modules(): BindingModules
|
|
118
|
+
get imports(): Array<string>
|
|
119
|
+
get dynamicImports(): Array<string>
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export declare class BindingRenderedChunkMeta {
|
|
123
|
+
get chunks(): Record<string, BindingRenderedChunk>
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export declare class BindingRenderedModule {
|
|
127
|
+
get code(): string | null
|
|
128
|
+
get renderedExports(): Array<string>
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export declare class BindingTransformPluginContext {
|
|
132
|
+
getCombinedSourcemap(): string
|
|
133
|
+
inner(): BindingPluginContext
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export declare class BindingWatcher {
|
|
137
|
+
constructor(options: Array<BindingBundlerOptions>, notifyOption?: BindingNotifyOption | undefined | null)
|
|
138
|
+
close(): Promise<void>
|
|
139
|
+
start(listener: (data: BindingWatcherEvent) => void): Promise<void>
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export declare class BindingWatcherChangeData {
|
|
143
|
+
path: string
|
|
144
|
+
kind: string
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export declare class BindingWatcherEvent {
|
|
148
|
+
eventKind(): string
|
|
149
|
+
watchChangeData(): BindingWatcherChangeData
|
|
150
|
+
bundleEndData(): BindingBundleEndEventData
|
|
151
|
+
bundleEventKind(): string
|
|
152
|
+
errors(): Array<Error | BindingError>
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export declare class Bundler {
|
|
156
|
+
constructor(option: BindingBundlerOptions)
|
|
157
|
+
write(): Promise<BindingOutputs>
|
|
158
|
+
generate(): Promise<BindingOutputs>
|
|
159
|
+
scan(): Promise<BindingOutputs>
|
|
160
|
+
close(): Promise<void>
|
|
161
|
+
get closed(): boolean
|
|
162
|
+
get watchFiles(): Array<string>
|
|
163
|
+
generateHmrPatch(changedFiles: Array<string>): Promise<BindingHmrOutput>
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export declare class ParallelJsPluginRegistry {
|
|
167
|
+
id: number
|
|
168
|
+
workerCount: number
|
|
169
|
+
constructor(workerCount: number)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export declare class ParseResult {
|
|
173
|
+
get program(): import("@oxc-project/types").Program
|
|
174
|
+
get module(): EcmaScriptModule
|
|
175
|
+
get comments(): Array<Comment>
|
|
176
|
+
get errors(): Array<OxcError>
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface AliasItem {
|
|
180
|
+
find: string
|
|
181
|
+
replacements: Array<string>
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface ArrowFunctionsOptions {
|
|
185
|
+
/**
|
|
186
|
+
* This option enables the following:
|
|
187
|
+
* * Wrap the generated function in .bind(this) and keeps uses of this inside the function as-is, instead of using a renamed this.
|
|
188
|
+
* * Add a runtime check to ensure the functions are not instantiated.
|
|
189
|
+
* * Add names to arrow functions.
|
|
190
|
+
*
|
|
191
|
+
* @default false
|
|
192
|
+
*/
|
|
193
|
+
spec?: boolean
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface BindingAdvancedChunksOptions {
|
|
197
|
+
minSize?: number
|
|
198
|
+
minShareCount?: number
|
|
199
|
+
groups?: Array<BindingMatchGroup>
|
|
200
|
+
maxSize?: number
|
|
201
|
+
minModuleSize?: number
|
|
202
|
+
maxModuleSize?: number
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface BindingAliasPluginAlias {
|
|
206
|
+
find: BindingStringOrRegex
|
|
207
|
+
replacement: string
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface BindingAliasPluginConfig {
|
|
211
|
+
entries: Array<BindingAliasPluginAlias>
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface BindingAssetSource {
|
|
215
|
+
inner: string | Uint8Array
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface BindingBuildImportAnalysisPluginConfig {
|
|
219
|
+
preloadCode: string
|
|
220
|
+
insertPreload: boolean
|
|
221
|
+
optimizeModulePreloadRelativePaths: boolean
|
|
222
|
+
renderBuiltUrl: boolean
|
|
223
|
+
isRelativeBase: boolean
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface BindingBuiltinPlugin {
|
|
227
|
+
__name: BindingBuiltinPluginName
|
|
228
|
+
options?: unknown
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export type BindingBuiltinPluginName = 'builtin:wasm-helper'|
|
|
232
|
+
'builtin:import-glob'|
|
|
233
|
+
'builtin:dynamic-import-vars'|
|
|
234
|
+
'builtin:module-preload-polyfill'|
|
|
235
|
+
'builtin:manifest'|
|
|
236
|
+
'builtin:load-fallback'|
|
|
237
|
+
'builtin:transform'|
|
|
238
|
+
'builtin:wasm-fallback'|
|
|
239
|
+
'builtin:alias'|
|
|
240
|
+
'builtin:json'|
|
|
241
|
+
'builtin:build-import-analysis'|
|
|
242
|
+
'builtin:replace'|
|
|
243
|
+
'builtin:vite-resolve'|
|
|
244
|
+
'builtin:module-federation'|
|
|
245
|
+
'builtin:isolated-declaration';
|
|
246
|
+
|
|
247
|
+
export interface BindingBundlerOptions {
|
|
248
|
+
inputOptions: BindingInputOptions
|
|
249
|
+
outputOptions: BindingOutputOptions
|
|
250
|
+
parallelPluginsRegistry?: ParallelJsPluginRegistry
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface BindingChecksOptions {
|
|
254
|
+
circularDependency?: boolean
|
|
255
|
+
eval?: boolean
|
|
256
|
+
missingGlobalName?: boolean
|
|
257
|
+
missingNameOptionForIifeExport?: boolean
|
|
258
|
+
mixedExport?: boolean
|
|
259
|
+
unresolvedEntry?: boolean
|
|
260
|
+
unresolvedImport?: boolean
|
|
261
|
+
filenameConflict?: boolean
|
|
262
|
+
commonJsVariableInEsm?: boolean
|
|
263
|
+
importIsUndefined?: boolean
|
|
264
|
+
configurationFieldConflict?: boolean
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface BindingDebugOptions {
|
|
268
|
+
buildId?: string
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface BindingDeferSyncScanData {
|
|
272
|
+
/** ModuleId */
|
|
273
|
+
id: string
|
|
274
|
+
sideEffects?: BindingHookSideEffects
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export interface BindingEmittedAsset {
|
|
278
|
+
name?: string
|
|
279
|
+
fileName?: string
|
|
280
|
+
originalFileName?: string
|
|
281
|
+
source: BindingAssetSource
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface BindingEmittedChunk {
|
|
285
|
+
name?: string
|
|
286
|
+
fileName?: string
|
|
287
|
+
id: string
|
|
288
|
+
importer?: string
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface BindingExperimentalHmrOptions {
|
|
292
|
+
host?: string
|
|
293
|
+
port?: number
|
|
294
|
+
implement?: string
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface BindingExperimentalOptions {
|
|
298
|
+
strictExecutionOrder?: boolean
|
|
299
|
+
disableLiveBindings?: boolean
|
|
300
|
+
viteMode?: boolean
|
|
301
|
+
resolveNewUrlToAsset?: boolean
|
|
302
|
+
hmr?: BindingExperimentalHmrOptions
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface BindingGeneralHookFilter {
|
|
306
|
+
include?: Array<BindingStringOrRegex>
|
|
307
|
+
exclude?: Array<BindingStringOrRegex>
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export interface BindingGlobImportPluginConfig {
|
|
311
|
+
root?: string
|
|
312
|
+
restoreQueryExtension?: boolean
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export interface BindingHmrBoundaryOutput {
|
|
316
|
+
boundary: string
|
|
317
|
+
acceptedVia: string
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface BindingHmrOutput {
|
|
321
|
+
patch: string
|
|
322
|
+
hmrBoundaries: Array<BindingHmrBoundaryOutput>
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface BindingHookJsLoadOutput {
|
|
326
|
+
code: string
|
|
327
|
+
map?: string
|
|
328
|
+
sideEffects: boolean | 'no-treeshake'
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export interface BindingHookJsResolveIdOptions {
|
|
332
|
+
scan?: boolean
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export interface BindingHookJsResolveIdOutput {
|
|
336
|
+
id: string
|
|
337
|
+
external?: BindingResolvedExternal
|
|
338
|
+
sideEffects: boolean | 'no-treeshake'
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export interface BindingHookLoadOutput {
|
|
342
|
+
code: string
|
|
343
|
+
sideEffects?: BindingHookSideEffects
|
|
344
|
+
map?: BindingSourcemap
|
|
345
|
+
moduleType?: string
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export interface BindingHookRenderChunkOutput {
|
|
349
|
+
code: string
|
|
350
|
+
map?: BindingSourcemap
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export interface BindingHookResolveIdExtraArgs {
|
|
354
|
+
custom?: number
|
|
355
|
+
isEntry: boolean
|
|
356
|
+
kind: 'import' | 'dynamic-import' | 'require-call'
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export interface BindingHookResolveIdOutput {
|
|
360
|
+
id: string
|
|
361
|
+
external?: BindingResolvedExternal
|
|
362
|
+
normalizeExternalId?: boolean
|
|
363
|
+
sideEffects?: BindingHookSideEffects
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export declare enum BindingHookSideEffects {
|
|
367
|
+
True = 0,
|
|
368
|
+
False = 1,
|
|
369
|
+
NoTreeshake = 2
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export interface BindingHookTransformOutput {
|
|
373
|
+
code?: string
|
|
374
|
+
sideEffects?: BindingHookSideEffects
|
|
375
|
+
map?: BindingSourcemap
|
|
376
|
+
moduleType?: string
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export interface BindingInjectImportNamed {
|
|
380
|
+
tagNamed: true
|
|
381
|
+
imported: string
|
|
382
|
+
alias?: string
|
|
383
|
+
from: string
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export interface BindingInjectImportNamespace {
|
|
387
|
+
tagNamespace: true
|
|
388
|
+
alias: string
|
|
389
|
+
from: string
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export interface BindingInputItem {
|
|
393
|
+
name?: string
|
|
394
|
+
import: string
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export interface BindingInputOptions {
|
|
398
|
+
external?: undefined | ((source: string, importer: string | undefined, isResolved: boolean) => boolean)
|
|
399
|
+
input: Array<BindingInputItem>
|
|
400
|
+
plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[]
|
|
401
|
+
resolve?: BindingResolveOptions
|
|
402
|
+
shimMissingExports?: boolean
|
|
403
|
+
platform?: 'node' | 'browser' | 'neutral'
|
|
404
|
+
logLevel: BindingLogLevel
|
|
405
|
+
onLog: (logLevel: 'debug' | 'warn' | 'info', log: BindingLog) => void
|
|
406
|
+
cwd: string
|
|
407
|
+
treeshake?: BindingTreeshake
|
|
408
|
+
moduleTypes?: Record<string, string>
|
|
409
|
+
define?: Array<[string, string]>
|
|
410
|
+
dropLabels?: Array<string>
|
|
411
|
+
inject?: Array<BindingInjectImportNamed | BindingInjectImportNamespace>
|
|
412
|
+
experimental?: BindingExperimentalOptions
|
|
413
|
+
profilerNames?: boolean
|
|
414
|
+
jsx?: BindingJsx
|
|
415
|
+
transform?: TransformOptions
|
|
416
|
+
watch?: BindingWatchOption
|
|
417
|
+
keepNames?: boolean
|
|
418
|
+
checks?: BindingChecksOptions
|
|
419
|
+
deferSyncScanData?: undefined | (() => BindingDeferSyncScanData[])
|
|
420
|
+
makeAbsoluteExternalsRelative?: BindingMakeAbsoluteExternalsRelative
|
|
421
|
+
debug?: BindingDebugOptions
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export interface BindingIsolatedDeclarationPluginConfig {
|
|
425
|
+
stripInternal?: boolean
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export interface BindingJsonPluginConfig {
|
|
429
|
+
minify?: boolean
|
|
430
|
+
namedExports?: boolean
|
|
431
|
+
stringify?: BindingJsonPluginStringify
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export type BindingJsonPluginStringify =
|
|
435
|
+
boolean | string
|
|
436
|
+
|
|
437
|
+
export interface BindingJsonSourcemap {
|
|
438
|
+
file?: string
|
|
439
|
+
mappings?: string
|
|
440
|
+
sourceRoot?: string
|
|
441
|
+
sources?: Array<string | undefined | null>
|
|
442
|
+
sourcesContent?: Array<string | undefined | null>
|
|
443
|
+
names?: Array<string>
|
|
444
|
+
debugId?: string
|
|
445
|
+
x_google_ignoreList?: Array<number>
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface BindingJsWatchChangeEvent {
|
|
449
|
+
event: string
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** TODO: support `preserve-react` mode */
|
|
453
|
+
export type BindingJsx =
|
|
454
|
+
| { type: 'Disable' }
|
|
455
|
+
| { type: 'Preserve' }
|
|
456
|
+
| { type: 'React' }
|
|
457
|
+
| { type: 'ReactJsx' }
|
|
458
|
+
| { type: 'Enable', field0: JsxOptions }
|
|
459
|
+
|
|
460
|
+
export interface BindingLog {
|
|
461
|
+
code: string
|
|
462
|
+
message: string
|
|
463
|
+
id?: string
|
|
464
|
+
exporter?: string
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export declare enum BindingLogLevel {
|
|
468
|
+
Silent = 0,
|
|
469
|
+
Warn = 1,
|
|
470
|
+
Info = 2,
|
|
471
|
+
Debug = 3
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export type BindingMakeAbsoluteExternalsRelative =
|
|
475
|
+
| { type: 'Bool', field0: boolean }
|
|
476
|
+
| { type: 'IfRelativeSource' }
|
|
477
|
+
|
|
478
|
+
export interface BindingManifestPluginConfig {
|
|
479
|
+
root: string
|
|
480
|
+
outPath: string
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export interface BindingMatchGroup {
|
|
484
|
+
name: string
|
|
485
|
+
test?: BindingStringOrRegex
|
|
486
|
+
priority?: number
|
|
487
|
+
minSize?: number
|
|
488
|
+
minShareCount?: number
|
|
489
|
+
minModuleSize?: number
|
|
490
|
+
maxModuleSize?: number
|
|
491
|
+
maxSize?: number
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export interface BindingMfManifest {
|
|
495
|
+
filePath?: string
|
|
496
|
+
disableAssetsAnalyze?: boolean
|
|
497
|
+
fileName?: string
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export interface BindingMinifyOptions {
|
|
501
|
+
mangle: boolean
|
|
502
|
+
compress: boolean
|
|
503
|
+
removeWhitespace: boolean
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export interface BindingModuleFederationPluginOption {
|
|
507
|
+
name: string
|
|
508
|
+
filename?: string
|
|
509
|
+
exposes?: Record<string, string>
|
|
510
|
+
remotes?: Array<BindingRemote>
|
|
511
|
+
shared?: Record<string, BindingShared>
|
|
512
|
+
runtimePlugins?: Array<string>
|
|
513
|
+
manifest?: BindingMfManifest
|
|
514
|
+
getPublicPath?: string
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export interface BindingModulePreloadPolyfillPluginConfig {
|
|
518
|
+
skip?: boolean
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export interface BindingModules {
|
|
522
|
+
values: Array<BindingRenderedModule>
|
|
523
|
+
keys: Array<string>
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
export interface BindingModuleSideEffectsRule {
|
|
527
|
+
test?: RegExp | undefined
|
|
528
|
+
sideEffects: boolean
|
|
529
|
+
external?: boolean | undefined
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export interface BindingNotifyOption {
|
|
533
|
+
pollInterval?: number
|
|
534
|
+
compareContents?: boolean
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
export interface BindingOutputOptions {
|
|
538
|
+
name?: string
|
|
539
|
+
assetFileNames?: string | ((chunk: BindingPreRenderedAsset) => string)
|
|
540
|
+
entryFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
541
|
+
chunkFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
542
|
+
cssEntryFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
543
|
+
cssChunkFileNames?: string | ((chunk: PreRenderedChunk) => string)
|
|
544
|
+
sanitizeFileName?: boolean | ((name: string) => string)
|
|
545
|
+
banner?: (chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
546
|
+
dir?: string
|
|
547
|
+
file?: string
|
|
548
|
+
esModule?: boolean | 'if-default-prop'
|
|
549
|
+
exports?: 'default' | 'named' | 'none' | 'auto'
|
|
550
|
+
extend?: boolean
|
|
551
|
+
externalLiveBindings?: boolean
|
|
552
|
+
footer?: (chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
553
|
+
format?: 'es' | 'cjs' | 'iife' | 'umd' | 'app'
|
|
554
|
+
globals?: Record<string, string> | ((name: string) => string)
|
|
555
|
+
hashCharacters?: 'base64' | 'base36' | 'hex'
|
|
556
|
+
inlineDynamicImports?: boolean
|
|
557
|
+
intro?: (chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
558
|
+
outro?: (chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>
|
|
559
|
+
plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[]
|
|
560
|
+
sourcemap?: 'file' | 'inline' | 'hidden'
|
|
561
|
+
sourcemapIgnoreList?: (source: string, sourcemapPath: string) => boolean
|
|
562
|
+
sourcemapDebugIds?: boolean
|
|
563
|
+
sourcemapPathTransform?: (source: string, sourcemapPath: string) => string
|
|
564
|
+
minify?: boolean | 'dce-only' | BindingMinifyOptions
|
|
565
|
+
advancedChunks?: BindingAdvancedChunksOptions
|
|
566
|
+
comments?: 'none' | 'preserve-legal'
|
|
567
|
+
polyfillRequire?: boolean
|
|
568
|
+
target?: string
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export interface BindingPluginContextResolvedId {
|
|
572
|
+
id: string
|
|
573
|
+
external: BindingResolvedExternal
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
export interface BindingPluginContextResolveOptions {
|
|
577
|
+
importKind?: 'import' | 'dynamic-import' | 'require-call'
|
|
578
|
+
skipSelf?: boolean
|
|
579
|
+
custom?: number
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
export interface BindingPluginHookMeta {
|
|
583
|
+
order?: BindingPluginOrder
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export interface BindingPluginOptions {
|
|
587
|
+
name: string
|
|
588
|
+
buildStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable>
|
|
589
|
+
buildStartMeta?: BindingPluginHookMeta
|
|
590
|
+
resolveId?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>, options: BindingHookResolveIdExtraArgs) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
|
|
591
|
+
resolveIdMeta?: BindingPluginHookMeta
|
|
592
|
+
resolveIdFilter?: BindingGeneralHookFilter
|
|
593
|
+
resolveDynamicImport?: (ctx: BindingPluginContext, specifier: string, importer: Nullable<string>) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>
|
|
594
|
+
resolveDynamicImportMeta?: BindingPluginHookMeta
|
|
595
|
+
load?: (ctx: BindingPluginContext, id: string) => MaybePromise<VoidNullable<BindingHookLoadOutput>>
|
|
596
|
+
loadMeta?: BindingPluginHookMeta
|
|
597
|
+
loadFilter?: BindingGeneralHookFilter
|
|
598
|
+
transform?: (ctx: BindingTransformPluginContext, id: string, code: string, module_type: BindingTransformHookExtraArgs) => MaybePromise<VoidNullable<BindingHookTransformOutput>>
|
|
599
|
+
transformMeta?: BindingPluginHookMeta
|
|
600
|
+
transformFilter?: BindingTransformHookFilter
|
|
601
|
+
moduleParsed?: (ctx: BindingPluginContext, module: BindingModuleInfo) => MaybePromise<VoidNullable>
|
|
602
|
+
moduleParsedMeta?: BindingPluginHookMeta
|
|
603
|
+
buildEnd?: (ctx: BindingPluginContext, error?: (Error | BindingError)[]) => MaybePromise<VoidNullable>
|
|
604
|
+
buildEndMeta?: BindingPluginHookMeta
|
|
605
|
+
renderChunk?: (ctx: BindingPluginContext, code: string, chunk: BindingRenderedChunk, opts: BindingNormalizedOptions, meta: BindingRenderedChunkMeta) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
|
|
606
|
+
renderChunkMeta?: BindingPluginHookMeta
|
|
607
|
+
augmentChunkHash?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => MaybePromise<void | string>
|
|
608
|
+
augmentChunkHashMeta?: BindingPluginHookMeta
|
|
609
|
+
renderStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => void
|
|
610
|
+
renderStartMeta?: BindingPluginHookMeta
|
|
611
|
+
renderError?: (ctx: BindingPluginContext, error: (Error | BindingError)[]) => void
|
|
612
|
+
renderErrorMeta?: BindingPluginHookMeta
|
|
613
|
+
generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<JsChangedOutputs>>
|
|
614
|
+
generateBundleMeta?: BindingPluginHookMeta
|
|
615
|
+
writeBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<JsChangedOutputs>>
|
|
616
|
+
writeBundleMeta?: BindingPluginHookMeta
|
|
617
|
+
closeBundle?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
|
|
618
|
+
closeBundleMeta?: BindingPluginHookMeta
|
|
619
|
+
watchChange?: (ctx: BindingPluginContext, path: string, event: string) => MaybePromise<VoidNullable>
|
|
620
|
+
watchChangeMeta?: BindingPluginHookMeta
|
|
621
|
+
closeWatcher?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>
|
|
622
|
+
closeWatcherMeta?: BindingPluginHookMeta
|
|
623
|
+
banner?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void
|
|
624
|
+
bannerMeta?: BindingPluginHookMeta
|
|
625
|
+
footer?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void
|
|
626
|
+
footerMeta?: BindingPluginHookMeta
|
|
627
|
+
intro?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void
|
|
628
|
+
introMeta?: BindingPluginHookMeta
|
|
629
|
+
outro?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void
|
|
630
|
+
outroMeta?: BindingPluginHookMeta
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export declare enum BindingPluginOrder {
|
|
634
|
+
Pre = 0,
|
|
635
|
+
Post = 1
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export interface BindingPluginWithIndex {
|
|
639
|
+
index: number
|
|
640
|
+
plugin: BindingPluginOptions
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export interface BindingPreRenderedAsset {
|
|
644
|
+
names: Array<string>
|
|
645
|
+
originalFileNames: Array<string>
|
|
646
|
+
source: BindingAssetSource
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
export interface BindingRemote {
|
|
650
|
+
type?: string
|
|
651
|
+
entry: string
|
|
652
|
+
name: string
|
|
653
|
+
entryGlobalName?: string
|
|
654
|
+
shareScope?: string
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
export interface BindingReplacePluginConfig {
|
|
658
|
+
values: Record<string, string>
|
|
659
|
+
delimiters?: [string, string]
|
|
660
|
+
preventAssignment?: boolean
|
|
661
|
+
objectGuards?: boolean
|
|
662
|
+
sourcemap?: boolean
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
export type BindingResolvedExternal =
|
|
666
|
+
| { type: 'Bool', field0: boolean }
|
|
667
|
+
| { type: 'Absolute' }
|
|
668
|
+
| { type: 'Relative' }
|
|
669
|
+
|
|
670
|
+
export interface BindingResolveOptions {
|
|
671
|
+
alias?: Array<AliasItem>
|
|
672
|
+
aliasFields?: Array<Array<string>>
|
|
673
|
+
conditionNames?: Array<string>
|
|
674
|
+
exportsFields?: Array<Array<string>>
|
|
675
|
+
extensions?: Array<string>
|
|
676
|
+
extensionAlias?: Array<ExtensionAliasItem>
|
|
677
|
+
mainFields?: Array<string>
|
|
678
|
+
mainFiles?: Array<string>
|
|
679
|
+
modules?: Array<string>
|
|
680
|
+
symlinks?: boolean
|
|
681
|
+
tsconfigFilename?: string
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
export interface BindingShared {
|
|
685
|
+
version?: string
|
|
686
|
+
shareScope?: string
|
|
687
|
+
singleton?: boolean
|
|
688
|
+
requiredVersion?: string
|
|
689
|
+
strictVersion?: boolean
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
export interface BindingSourcemap {
|
|
693
|
+
inner: string | BindingJsonSourcemap
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
export interface BindingTransformHookExtraArgs {
|
|
697
|
+
moduleType: string
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export interface BindingTransformHookFilter {
|
|
701
|
+
code?: BindingGeneralHookFilter
|
|
702
|
+
moduleType?: Array<string>
|
|
703
|
+
id?: BindingGeneralHookFilter
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
export interface BindingTransformPluginConfig {
|
|
707
|
+
include?: Array<BindingStringOrRegex>
|
|
708
|
+
exclude?: Array<BindingStringOrRegex>
|
|
709
|
+
jsxInject?: string
|
|
710
|
+
reactRefresh?: boolean
|
|
711
|
+
target?: string
|
|
712
|
+
browserslist?: string
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
export interface BindingTreeshake {
|
|
716
|
+
moduleSideEffects: boolean | BindingModuleSideEffectsRule[] | ((id: string, is_external: boolean) => boolean | undefined)
|
|
717
|
+
annotations?: boolean
|
|
718
|
+
manualPureFunctions?: Array<string>
|
|
719
|
+
unknownGlobalSideEffects?: boolean
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
export interface BindingViteResolvePluginConfig {
|
|
723
|
+
resolveOptions: BindingViteResolvePluginResolveOptions
|
|
724
|
+
environmentConsumer: string
|
|
725
|
+
environmentName: string
|
|
726
|
+
external: true | string[]
|
|
727
|
+
noExternal: true | Array<string | RegExp>
|
|
728
|
+
dedupe: Array<string>
|
|
729
|
+
finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
|
|
730
|
+
finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
|
|
731
|
+
runtime: string
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
export interface BindingViteResolvePluginResolveOptions {
|
|
735
|
+
isBuild: boolean
|
|
736
|
+
isProduction: boolean
|
|
737
|
+
asSrc: boolean
|
|
738
|
+
preferRelative: boolean
|
|
739
|
+
isRequire?: boolean
|
|
740
|
+
root: string
|
|
741
|
+
scan: boolean
|
|
742
|
+
mainFields: Array<string>
|
|
743
|
+
conditions: Array<string>
|
|
744
|
+
externalConditions: Array<string>
|
|
745
|
+
extensions: Array<string>
|
|
746
|
+
tryIndex: boolean
|
|
747
|
+
tryPrefix?: string
|
|
748
|
+
preserveSymlinks: boolean
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export interface BindingWatchOption {
|
|
752
|
+
skipWrite?: boolean
|
|
753
|
+
include?: Array<BindingStringOrRegex>
|
|
754
|
+
exclude?: Array<BindingStringOrRegex>
|
|
755
|
+
buildDelay?: number
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
export interface Comment {
|
|
759
|
+
type: 'Line' | 'Block'
|
|
760
|
+
value: string
|
|
761
|
+
start: number
|
|
762
|
+
end: number
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export interface CompilerAssumptions {
|
|
766
|
+
ignoreFunctionLength?: boolean
|
|
767
|
+
noDocumentAll?: boolean
|
|
768
|
+
objectRestNoSymbols?: boolean
|
|
769
|
+
pureGetters?: boolean
|
|
770
|
+
setPublicClassFields?: boolean
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
export interface DecoratorOptions {
|
|
774
|
+
/**
|
|
775
|
+
* Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
|
|
776
|
+
*
|
|
777
|
+
* Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
|
|
778
|
+
* This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
|
|
779
|
+
*
|
|
780
|
+
* @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
|
|
781
|
+
* @default false
|
|
782
|
+
*/
|
|
783
|
+
legacy?: boolean
|
|
784
|
+
/**
|
|
785
|
+
* Enables emitting decorator metadata.
|
|
786
|
+
*
|
|
787
|
+
* This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
|
|
788
|
+
* in TypeScript, and it only works when `legacy` is true.
|
|
789
|
+
*
|
|
790
|
+
* @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
|
|
791
|
+
* @default false
|
|
792
|
+
*/
|
|
793
|
+
emitDecoratorMetadata?: boolean
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
export interface DynamicImport {
|
|
797
|
+
start: number
|
|
798
|
+
end: number
|
|
799
|
+
moduleRequest: Span
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
export interface EcmaScriptModule {
|
|
803
|
+
/**
|
|
804
|
+
* Has ESM syntax.
|
|
805
|
+
*
|
|
806
|
+
* i.e. `import` and `export` statements, and `import.meta`.
|
|
807
|
+
*
|
|
808
|
+
* Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
|
|
809
|
+
*/
|
|
810
|
+
hasModuleSyntax: boolean
|
|
811
|
+
/** Import statements. */
|
|
812
|
+
staticImports: Array<StaticImport>
|
|
813
|
+
/** Export statements. */
|
|
814
|
+
staticExports: Array<StaticExport>
|
|
815
|
+
/** Dynamic import expressions. */
|
|
816
|
+
dynamicImports: Array<DynamicImport>
|
|
817
|
+
/** Span positions` of `import.meta` */
|
|
818
|
+
importMetas: Array<Span>
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
export interface ErrorLabel {
|
|
822
|
+
message?: string
|
|
823
|
+
start: number
|
|
824
|
+
end: number
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export interface Es2015Options {
|
|
828
|
+
/** Transform arrow functions into function expressions. */
|
|
829
|
+
arrowFunction?: ArrowFunctionsOptions
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
export interface ExportExportName {
|
|
833
|
+
kind: ExportExportNameKind
|
|
834
|
+
name?: string
|
|
835
|
+
start?: number
|
|
836
|
+
end?: number
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
export type ExportExportNameKind = /** `export { name } */
|
|
840
|
+
'Name'|
|
|
841
|
+
/** `export default expression` */
|
|
842
|
+
'Default'|
|
|
843
|
+
/** `export * from "mod" */
|
|
844
|
+
'None';
|
|
845
|
+
|
|
846
|
+
export interface ExportImportName {
|
|
847
|
+
kind: ExportImportNameKind
|
|
848
|
+
name?: string
|
|
849
|
+
start?: number
|
|
850
|
+
end?: number
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
export type ExportImportNameKind = /** `export { name } */
|
|
854
|
+
'Name'|
|
|
855
|
+
/** `export * as ns from "mod"` */
|
|
856
|
+
'All'|
|
|
857
|
+
/** `export * from "mod"` */
|
|
858
|
+
'AllButDefault'|
|
|
859
|
+
/** Does not have a specifier. */
|
|
860
|
+
'None';
|
|
861
|
+
|
|
862
|
+
export interface ExportLocalName {
|
|
863
|
+
kind: ExportLocalNameKind
|
|
864
|
+
name?: string
|
|
865
|
+
start?: number
|
|
866
|
+
end?: number
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
export type ExportLocalNameKind = /** `export { name } */
|
|
870
|
+
'Name'|
|
|
871
|
+
/** `export default expression` */
|
|
872
|
+
'Default'|
|
|
873
|
+
/**
|
|
874
|
+
* If the exported value is not locally accessible from within the module.
|
|
875
|
+
* `export default function () {}`
|
|
876
|
+
*/
|
|
877
|
+
'None';
|
|
878
|
+
|
|
879
|
+
export interface ExtensionAliasItem {
|
|
880
|
+
target: string
|
|
881
|
+
replacements: Array<string>
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Get offset within a `Uint8Array` which is aligned on 4 GiB.
|
|
886
|
+
*
|
|
887
|
+
* Does not check that the offset is within bounds of `buffer`.
|
|
888
|
+
* To ensure it always is, provide a `Uint8Array` of at least 4 GiB size.
|
|
889
|
+
*/
|
|
890
|
+
export declare function getBufferOffset(buffer: Uint8Array): number
|
|
891
|
+
|
|
892
|
+
export type HelperMode = /**
|
|
893
|
+
* Runtime mode (default): Helper functions are imported from a runtime package.
|
|
894
|
+
*
|
|
895
|
+
* Example:
|
|
896
|
+
*
|
|
897
|
+
* ```js
|
|
898
|
+
* import helperName from "@oxc-project/runtime/helpers/helperName";
|
|
899
|
+
* helperName(...arguments);
|
|
900
|
+
* ```
|
|
901
|
+
*/
|
|
902
|
+
'Runtime'|
|
|
903
|
+
/**
|
|
904
|
+
* External mode: Helper functions are accessed from a global `babelHelpers` object.
|
|
905
|
+
*
|
|
906
|
+
* Example:
|
|
907
|
+
*
|
|
908
|
+
* ```js
|
|
909
|
+
* babelHelpers.helperName(...arguments);
|
|
910
|
+
* ```
|
|
911
|
+
*/
|
|
912
|
+
'External';
|
|
913
|
+
|
|
914
|
+
export interface Helpers {
|
|
915
|
+
mode?: HelperMode
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
export interface ImportName {
|
|
919
|
+
kind: ImportNameKind
|
|
920
|
+
name?: string
|
|
921
|
+
start?: number
|
|
922
|
+
end?: number
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
export type ImportNameKind = /** `import { x } from "mod"` */
|
|
926
|
+
'Name'|
|
|
927
|
+
/** `import * as ns from "mod"` */
|
|
928
|
+
'NamespaceObject'|
|
|
929
|
+
/** `import defaultExport from "mod"` */
|
|
930
|
+
'Default';
|
|
931
|
+
|
|
932
|
+
/** TypeScript Isolated Declarations for Standalone DTS Emit */
|
|
933
|
+
export declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult
|
|
934
|
+
|
|
935
|
+
export interface IsolatedDeclarationsOptions {
|
|
936
|
+
/**
|
|
937
|
+
* Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
|
|
938
|
+
* This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
|
|
939
|
+
*
|
|
940
|
+
* Default: `false`
|
|
941
|
+
*
|
|
942
|
+
* See <https://www.typescriptlang.org/tsconfig/#stripInternal>
|
|
943
|
+
*/
|
|
944
|
+
stripInternal?: boolean
|
|
945
|
+
sourcemap?: boolean
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
export interface IsolatedDeclarationsResult {
|
|
949
|
+
code: string
|
|
950
|
+
map?: SourceMap
|
|
951
|
+
errors: Array<OxcError>
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
export interface JsChangedOutputs {
|
|
955
|
+
chunks: Array<JsOutputChunk>
|
|
956
|
+
assets: Array<JsOutputAsset>
|
|
957
|
+
deleted: Array<string>
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export interface JsOutputAsset {
|
|
961
|
+
names: Array<string>
|
|
962
|
+
originalFileNames: Array<string>
|
|
963
|
+
filename: string
|
|
964
|
+
source: BindingAssetSource
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
export interface JsOutputChunk {
|
|
968
|
+
name: string
|
|
969
|
+
isEntry: boolean
|
|
970
|
+
isDynamicEntry: boolean
|
|
971
|
+
facadeModuleId?: string
|
|
972
|
+
moduleIds: Array<string>
|
|
973
|
+
exports: Array<string>
|
|
974
|
+
filename: string
|
|
975
|
+
modules: Record<string, BindingRenderedModule>
|
|
976
|
+
imports: Array<string>
|
|
977
|
+
dynamicImports: Array<string>
|
|
978
|
+
code: string
|
|
979
|
+
map?: BindingSourcemap
|
|
980
|
+
sourcemapFilename?: string
|
|
981
|
+
preliminaryFilename: string
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Configure how TSX and JSX are transformed.
|
|
986
|
+
*
|
|
987
|
+
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
|
|
988
|
+
*/
|
|
989
|
+
export interface JsxOptions {
|
|
990
|
+
/**
|
|
991
|
+
* Decides which runtime to use.
|
|
992
|
+
*
|
|
993
|
+
* - 'automatic' - auto-import the correct JSX factories
|
|
994
|
+
* - 'classic' - no auto-import
|
|
995
|
+
*
|
|
996
|
+
* @default 'automatic'
|
|
997
|
+
*/
|
|
998
|
+
runtime?: 'classic' | 'automatic'
|
|
999
|
+
/**
|
|
1000
|
+
* Emit development-specific information, such as `__source` and `__self`.
|
|
1001
|
+
*
|
|
1002
|
+
* @default false
|
|
1003
|
+
*
|
|
1004
|
+
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development}
|
|
1005
|
+
*/
|
|
1006
|
+
development?: boolean
|
|
1007
|
+
/**
|
|
1008
|
+
* Toggles whether or not to throw an error if an XML namespaced tag name
|
|
1009
|
+
* is used.
|
|
1010
|
+
*
|
|
1011
|
+
* Though the JSX spec allows this, it is disabled by default since React's
|
|
1012
|
+
* JSX does not currently have support for it.
|
|
1013
|
+
*
|
|
1014
|
+
* @default true
|
|
1015
|
+
*/
|
|
1016
|
+
throwIfNamespace?: boolean
|
|
1017
|
+
/**
|
|
1018
|
+
* Enables `@babel/plugin-transform-react-pure-annotations`.
|
|
1019
|
+
*
|
|
1020
|
+
* It will mark top-level React method calls as pure for tree shaking.
|
|
1021
|
+
*
|
|
1022
|
+
* @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations}
|
|
1023
|
+
*
|
|
1024
|
+
* @default true
|
|
1025
|
+
*/
|
|
1026
|
+
pure?: boolean
|
|
1027
|
+
/**
|
|
1028
|
+
* Replaces the import source when importing functions.
|
|
1029
|
+
*
|
|
1030
|
+
* @default 'react'
|
|
1031
|
+
*/
|
|
1032
|
+
importSource?: string
|
|
1033
|
+
/**
|
|
1034
|
+
* Replace the function used when compiling JSX expressions. It should be a
|
|
1035
|
+
* qualified name (e.g. `React.createElement`) or an identifier (e.g.
|
|
1036
|
+
* `createElement`).
|
|
1037
|
+
*
|
|
1038
|
+
* Only used for `classic` {@link runtime}.
|
|
1039
|
+
*
|
|
1040
|
+
* @default 'React.createElement'
|
|
1041
|
+
*/
|
|
1042
|
+
pragma?: string
|
|
1043
|
+
/**
|
|
1044
|
+
* Replace the component used when compiling JSX fragments. It should be a
|
|
1045
|
+
* valid JSX tag name.
|
|
1046
|
+
*
|
|
1047
|
+
* Only used for `classic` {@link runtime}.
|
|
1048
|
+
*
|
|
1049
|
+
* @default 'React.Fragment'
|
|
1050
|
+
*/
|
|
1051
|
+
pragmaFrag?: string
|
|
1052
|
+
/**
|
|
1053
|
+
* When spreading props, use `Object.assign` directly instead of an extend helper.
|
|
1054
|
+
*
|
|
1055
|
+
* Only used for `classic` {@link runtime}.
|
|
1056
|
+
*
|
|
1057
|
+
* @default false
|
|
1058
|
+
*/
|
|
1059
|
+
useBuiltIns?: boolean
|
|
1060
|
+
/**
|
|
1061
|
+
* When spreading props, use inline object with spread elements directly
|
|
1062
|
+
* instead of an extend helper or Object.assign.
|
|
1063
|
+
*
|
|
1064
|
+
* Only used for `classic` {@link runtime}.
|
|
1065
|
+
*
|
|
1066
|
+
* @default false
|
|
1067
|
+
*/
|
|
1068
|
+
useSpread?: boolean
|
|
1069
|
+
/**
|
|
1070
|
+
* Enable React Fast Refresh .
|
|
1071
|
+
*
|
|
1072
|
+
* Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
|
|
1073
|
+
*
|
|
1074
|
+
* @default false
|
|
1075
|
+
*/
|
|
1076
|
+
refresh?: boolean | ReactRefreshOptions
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Transform JavaScript code to a Vite Node runnable module.
|
|
1081
|
+
*
|
|
1082
|
+
* @param filename The name of the file being transformed.
|
|
1083
|
+
* @param sourceText the source code itself
|
|
1084
|
+
* @param options The options for the transformation. See {@link
|
|
1085
|
+
* ModuleRunnerTransformOptions} for more information.
|
|
1086
|
+
*
|
|
1087
|
+
* @returns an object containing the transformed code, source maps, and any
|
|
1088
|
+
* errors that occurred during parsing or transformation.
|
|
1089
|
+
*
|
|
1090
|
+
* @deprecated Only works for Vite.
|
|
1091
|
+
*/
|
|
1092
|
+
export declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): ModuleRunnerTransformResult
|
|
1093
|
+
|
|
1094
|
+
export interface ModuleRunnerTransformOptions {
|
|
1095
|
+
/**
|
|
1096
|
+
* Enable source map generation.
|
|
1097
|
+
*
|
|
1098
|
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
|
1099
|
+
*
|
|
1100
|
+
* @default false
|
|
1101
|
+
*
|
|
1102
|
+
* @see {@link SourceMap}
|
|
1103
|
+
*/
|
|
1104
|
+
sourcemap?: boolean
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
export interface ModuleRunnerTransformResult {
|
|
1108
|
+
/**
|
|
1109
|
+
* The transformed code.
|
|
1110
|
+
*
|
|
1111
|
+
* If parsing failed, this will be an empty string.
|
|
1112
|
+
*/
|
|
1113
|
+
code: string
|
|
1114
|
+
/**
|
|
1115
|
+
* The source map for the transformed code.
|
|
1116
|
+
*
|
|
1117
|
+
* This will be set if {@link TransformOptions#sourcemap} is `true`.
|
|
1118
|
+
*/
|
|
1119
|
+
map?: SourceMap
|
|
1120
|
+
deps: Array<string>
|
|
1121
|
+
dynamicDeps: Array<string>
|
|
1122
|
+
/**
|
|
1123
|
+
* Parse and transformation errors.
|
|
1124
|
+
*
|
|
1125
|
+
* Oxc's parser recovers from common syntax errors, meaning that
|
|
1126
|
+
* transformed code may still be available even if there are errors in this
|
|
1127
|
+
* list.
|
|
1128
|
+
*/
|
|
1129
|
+
errors: Array<OxcError>
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
export interface OxcError {
|
|
1133
|
+
severity: Severity
|
|
1134
|
+
message: string
|
|
1135
|
+
labels: Array<ErrorLabel>
|
|
1136
|
+
helpMessage?: string
|
|
1137
|
+
codeframe?: string
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Parse asynchronously.
|
|
1142
|
+
*
|
|
1143
|
+
* Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
|
|
1144
|
+
*/
|
|
1145
|
+
export declare function parseAsync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>
|
|
1146
|
+
|
|
1147
|
+
export interface ParserOptions {
|
|
1148
|
+
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
|
|
1149
|
+
/** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
|
|
1150
|
+
lang?: 'js' | 'jsx' | 'ts' | 'tsx'
|
|
1151
|
+
/**
|
|
1152
|
+
* Return an AST which includes TypeScript-related properties, or excludes them.
|
|
1153
|
+
*
|
|
1154
|
+
* `'js'` is default for JS / JSX files.
|
|
1155
|
+
* `'ts'` is default for TS / TSX files.
|
|
1156
|
+
* The type of the file is determined from `lang` option, or extension of provided `filename`.
|
|
1157
|
+
*/
|
|
1158
|
+
astType?: 'js' | 'ts'
|
|
1159
|
+
/**
|
|
1160
|
+
* Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST.
|
|
1161
|
+
*
|
|
1162
|
+
* If this option is true, parenthesized expressions are represented by
|
|
1163
|
+
* (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that
|
|
1164
|
+
* have a single `expression` property containing the expression inside parentheses.
|
|
1165
|
+
*
|
|
1166
|
+
* @default true
|
|
1167
|
+
*/
|
|
1168
|
+
preserveParens?: boolean
|
|
1169
|
+
/**
|
|
1170
|
+
* Produce semantic errors with an additional AST pass.
|
|
1171
|
+
* Semantic errors depend on symbols and scopes, where the parser does not construct.
|
|
1172
|
+
* This adds a small performance overhead.
|
|
1173
|
+
*
|
|
1174
|
+
* @default false
|
|
1175
|
+
*/
|
|
1176
|
+
showSemanticErrors?: boolean
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
/** Parse synchronously. */
|
|
1180
|
+
export declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): ParseResult
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Parses AST into provided `Uint8Array` buffer.
|
|
1184
|
+
*
|
|
1185
|
+
* Source text must be written into the start of the buffer, and its length (in UTF-8 bytes)
|
|
1186
|
+
* provided as `source_len`.
|
|
1187
|
+
*
|
|
1188
|
+
* This function will parse the source, and write the AST into the buffer, starting at the end.
|
|
1189
|
+
*
|
|
1190
|
+
* It also writes to the very end of the buffer the offset of `Program` within the buffer.
|
|
1191
|
+
*
|
|
1192
|
+
* Caller can deserialize data from the buffer on JS side.
|
|
1193
|
+
*
|
|
1194
|
+
* # SAFETY
|
|
1195
|
+
*
|
|
1196
|
+
* Caller must ensure:
|
|
1197
|
+
* * Source text is written into start of the buffer.
|
|
1198
|
+
* * Source text's UTF-8 byte length is `source_len`.
|
|
1199
|
+
* * The 1st `source_len` bytes of the buffer comprises a valid UTF-8 string.
|
|
1200
|
+
*
|
|
1201
|
+
* If source text is originally a JS string on JS side, and converted to a buffer with
|
|
1202
|
+
* `Buffer.from(str)` or `new TextEncoder().encode(str)`, this guarantees it's valid UTF-8.
|
|
1203
|
+
*
|
|
1204
|
+
* # Panics
|
|
1205
|
+
*
|
|
1206
|
+
* Panics if source text is too long, or AST takes more memory than is available in the buffer.
|
|
1207
|
+
*/
|
|
1208
|
+
export declare function parseSyncRaw(filename: string, buffer: Uint8Array, sourceLen: number, options?: ParserOptions | undefined | null): void
|
|
1209
|
+
|
|
1210
|
+
export interface PreRenderedChunk {
|
|
1211
|
+
name: string
|
|
1212
|
+
isEntry: boolean
|
|
1213
|
+
isDynamicEntry: boolean
|
|
1214
|
+
facadeModuleId?: string
|
|
1215
|
+
moduleIds: Array<string>
|
|
1216
|
+
exports: Array<string>
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/** Returns `true` if raw transfer is supported on this platform. */
|
|
1220
|
+
export declare function rawTransferSupported(): boolean
|
|
1221
|
+
|
|
1222
|
+
export interface ReactRefreshOptions {
|
|
1223
|
+
/**
|
|
1224
|
+
* Specify the identifier of the refresh registration variable.
|
|
1225
|
+
*
|
|
1226
|
+
* @default `$RefreshReg$`.
|
|
1227
|
+
*/
|
|
1228
|
+
refreshReg?: string
|
|
1229
|
+
/**
|
|
1230
|
+
* Specify the identifier of the refresh signature variable.
|
|
1231
|
+
*
|
|
1232
|
+
* @default `$RefreshSig$`.
|
|
1233
|
+
*/
|
|
1234
|
+
refreshSig?: string
|
|
1235
|
+
emitFullSignatures?: boolean
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
export declare function registerPlugins(id: number, plugins: Array<BindingPluginWithIndex>): void
|
|
1239
|
+
|
|
1240
|
+
export type Severity = 'Error'|
|
|
1241
|
+
'Warning'|
|
|
1242
|
+
'Advice';
|
|
1243
|
+
|
|
1244
|
+
/**
|
|
1245
|
+
* Shutdown the tokio runtime manually.
|
|
1246
|
+
*
|
|
1247
|
+
* This is required for the wasm target with `tokio_unstable` cfg.
|
|
1248
|
+
* In the wasm runtime, the `park` threads will hang there until the tokio::Runtime is shutdown.
|
|
1249
|
+
*/
|
|
1250
|
+
export declare function shutdownAsyncRuntime(): void
|
|
1251
|
+
|
|
1252
|
+
export interface SourceMap {
|
|
1253
|
+
file?: string
|
|
1254
|
+
mappings: string
|
|
1255
|
+
names: Array<string>
|
|
1256
|
+
sourceRoot?: string
|
|
1257
|
+
sources: Array<string>
|
|
1258
|
+
sourcesContent?: Array<string>
|
|
1259
|
+
version: number
|
|
1260
|
+
x_google_ignoreList?: Array<number>
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
export interface Span {
|
|
1264
|
+
start: number
|
|
1265
|
+
end: number
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* Start the async runtime manually.
|
|
1270
|
+
*
|
|
1271
|
+
* This is required when the async runtime is shutdown manually.
|
|
1272
|
+
* Usually it's used in test.
|
|
1273
|
+
*/
|
|
1274
|
+
export declare function startAsyncRuntime(): void
|
|
1275
|
+
|
|
1276
|
+
export interface StaticExport {
|
|
1277
|
+
start: number
|
|
1278
|
+
end: number
|
|
1279
|
+
entries: Array<StaticExportEntry>
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
export interface StaticExportEntry {
|
|
1283
|
+
start: number
|
|
1284
|
+
end: number
|
|
1285
|
+
moduleRequest?: ValueSpan
|
|
1286
|
+
/** The name under which the desired binding is exported by the module`. */
|
|
1287
|
+
importName: ExportImportName
|
|
1288
|
+
/** The name used to export this binding by this module. */
|
|
1289
|
+
exportName: ExportExportName
|
|
1290
|
+
/** The name that is used to locally access the exported value from within the importing module. */
|
|
1291
|
+
localName: ExportLocalName
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
export interface StaticImport {
|
|
1295
|
+
/** Start of import statement. */
|
|
1296
|
+
start: number
|
|
1297
|
+
/** End of import statement. */
|
|
1298
|
+
end: number
|
|
1299
|
+
/**
|
|
1300
|
+
* Import source.
|
|
1301
|
+
*
|
|
1302
|
+
* ```js
|
|
1303
|
+
* import { foo } from "mod";
|
|
1304
|
+
* // ^^^
|
|
1305
|
+
* ```
|
|
1306
|
+
*/
|
|
1307
|
+
moduleRequest: ValueSpan
|
|
1308
|
+
/**
|
|
1309
|
+
* Import specifiers.
|
|
1310
|
+
*
|
|
1311
|
+
* Empty for `import "mod"`.
|
|
1312
|
+
*/
|
|
1313
|
+
entries: Array<StaticImportEntry>
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
export interface StaticImportEntry {
|
|
1317
|
+
/**
|
|
1318
|
+
* The name under which the desired binding is exported by the module.
|
|
1319
|
+
*
|
|
1320
|
+
* ```js
|
|
1321
|
+
* import { foo } from "mod";
|
|
1322
|
+
* // ^^^
|
|
1323
|
+
* import { foo as bar } from "mod";
|
|
1324
|
+
* // ^^^
|
|
1325
|
+
* ```
|
|
1326
|
+
*/
|
|
1327
|
+
importName: ImportName
|
|
1328
|
+
/**
|
|
1329
|
+
* The name that is used to locally access the imported value from within the importing module.
|
|
1330
|
+
* ```js
|
|
1331
|
+
* import { foo } from "mod";
|
|
1332
|
+
* // ^^^
|
|
1333
|
+
* import { foo as bar } from "mod";
|
|
1334
|
+
* // ^^^
|
|
1335
|
+
* ```
|
|
1336
|
+
*/
|
|
1337
|
+
localName: ValueSpan
|
|
1338
|
+
/**
|
|
1339
|
+
* Whether this binding is for a TypeScript type-only import.
|
|
1340
|
+
*
|
|
1341
|
+
* `true` for the following imports:
|
|
1342
|
+
* ```ts
|
|
1343
|
+
* import type { foo } from "mod";
|
|
1344
|
+
* import { type foo } from "mod";
|
|
1345
|
+
* ```
|
|
1346
|
+
*/
|
|
1347
|
+
isType: boolean
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
|
|
1352
|
+
*
|
|
1353
|
+
* @param filename The name of the file being transformed. If this is a
|
|
1354
|
+
* relative path, consider setting the {@link TransformOptions#cwd} option..
|
|
1355
|
+
* @param sourceText the source code itself
|
|
1356
|
+
* @param options The options for the transformation. See {@link
|
|
1357
|
+
* TransformOptions} for more information.
|
|
1358
|
+
*
|
|
1359
|
+
* @returns an object containing the transformed code, source maps, and any
|
|
1360
|
+
* errors that occurred during parsing or transformation.
|
|
1361
|
+
*/
|
|
1362
|
+
export declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* Options for transforming a JavaScript or TypeScript file.
|
|
1366
|
+
*
|
|
1367
|
+
* @see {@link transform}
|
|
1368
|
+
*/
|
|
1369
|
+
export interface TransformOptions {
|
|
1370
|
+
sourceType?: 'script' | 'module' | 'unambiguous' | undefined
|
|
1371
|
+
/** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
|
|
1372
|
+
lang?: 'js' | 'jsx' | 'ts' | 'tsx'
|
|
1373
|
+
/**
|
|
1374
|
+
* The current working directory. Used to resolve relative paths in other
|
|
1375
|
+
* options.
|
|
1376
|
+
*/
|
|
1377
|
+
cwd?: string
|
|
1378
|
+
/**
|
|
1379
|
+
* Enable source map generation.
|
|
1380
|
+
*
|
|
1381
|
+
* When `true`, the `sourceMap` field of transform result objects will be populated.
|
|
1382
|
+
*
|
|
1383
|
+
* @default false
|
|
1384
|
+
*
|
|
1385
|
+
* @see {@link SourceMap}
|
|
1386
|
+
*/
|
|
1387
|
+
sourcemap?: boolean
|
|
1388
|
+
/** Set assumptions in order to produce smaller output. */
|
|
1389
|
+
assumptions?: CompilerAssumptions
|
|
1390
|
+
/** Configure how TypeScript is transformed. */
|
|
1391
|
+
typescript?: TypeScriptOptions
|
|
1392
|
+
/** Configure how TSX and JSX are transformed. */
|
|
1393
|
+
jsx?: 'preserve' | JsxOptions
|
|
1394
|
+
/**
|
|
1395
|
+
* Sets the target environment for the generated JavaScript.
|
|
1396
|
+
*
|
|
1397
|
+
* The lowest target is `es2015`.
|
|
1398
|
+
*
|
|
1399
|
+
* Example:
|
|
1400
|
+
*
|
|
1401
|
+
* * 'es2015'
|
|
1402
|
+
* * ['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']
|
|
1403
|
+
*
|
|
1404
|
+
* @default `esnext` (No transformation)
|
|
1405
|
+
*
|
|
1406
|
+
* @see [esbuild#target](https://esbuild.github.io/api/#target)
|
|
1407
|
+
*/
|
|
1408
|
+
target?: string | Array<string>
|
|
1409
|
+
/** Behaviour for runtime helpers. */
|
|
1410
|
+
helpers?: Helpers
|
|
1411
|
+
/** Define Plugin */
|
|
1412
|
+
define?: Record<string, string>
|
|
1413
|
+
/** Inject Plugin */
|
|
1414
|
+
inject?: Record<string, string | [string, string]>
|
|
1415
|
+
/** Decorator plugin */
|
|
1416
|
+
decorator?: DecoratorOptions
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
export interface TransformResult {
|
|
1420
|
+
/**
|
|
1421
|
+
* The transformed code.
|
|
1422
|
+
*
|
|
1423
|
+
* If parsing failed, this will be an empty string.
|
|
1424
|
+
*/
|
|
1425
|
+
code: string
|
|
1426
|
+
/**
|
|
1427
|
+
* The source map for the transformed code.
|
|
1428
|
+
*
|
|
1429
|
+
* This will be set if {@link TransformOptions#sourcemap} is `true`.
|
|
1430
|
+
*/
|
|
1431
|
+
map?: SourceMap
|
|
1432
|
+
/**
|
|
1433
|
+
* The `.d.ts` declaration file for the transformed code. Declarations are
|
|
1434
|
+
* only generated if `declaration` is set to `true` and a TypeScript file
|
|
1435
|
+
* is provided.
|
|
1436
|
+
*
|
|
1437
|
+
* If parsing failed and `declaration` is set, this will be an empty string.
|
|
1438
|
+
*
|
|
1439
|
+
* @see {@link TypeScriptOptions#declaration}
|
|
1440
|
+
* @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
|
|
1441
|
+
*/
|
|
1442
|
+
declaration?: string
|
|
1443
|
+
/**
|
|
1444
|
+
* Declaration source map. Only generated if both
|
|
1445
|
+
* {@link TypeScriptOptions#declaration declaration} and
|
|
1446
|
+
* {@link TransformOptions#sourcemap sourcemap} are set to `true`.
|
|
1447
|
+
*/
|
|
1448
|
+
declarationMap?: SourceMap
|
|
1449
|
+
/**
|
|
1450
|
+
* Helpers used.
|
|
1451
|
+
*
|
|
1452
|
+
* @internal
|
|
1453
|
+
*
|
|
1454
|
+
* Example:
|
|
1455
|
+
*
|
|
1456
|
+
* ```text
|
|
1457
|
+
* { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
|
|
1458
|
+
* ```
|
|
1459
|
+
*/
|
|
1460
|
+
helpersUsed: Record<string, string>
|
|
1461
|
+
/**
|
|
1462
|
+
* Parse and transformation errors.
|
|
1463
|
+
*
|
|
1464
|
+
* Oxc's parser recovers from common syntax errors, meaning that
|
|
1465
|
+
* transformed code may still be available even if there are errors in this
|
|
1466
|
+
* list.
|
|
1467
|
+
*/
|
|
1468
|
+
errors: Array<OxcError>
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
export interface TypeScriptOptions {
|
|
1472
|
+
jsxPragma?: string
|
|
1473
|
+
jsxPragmaFrag?: string
|
|
1474
|
+
onlyRemoveTypeImports?: boolean
|
|
1475
|
+
allowNamespaces?: boolean
|
|
1476
|
+
allowDeclareFields?: boolean
|
|
1477
|
+
/**
|
|
1478
|
+
* Also generate a `.d.ts` declaration file for TypeScript files.
|
|
1479
|
+
*
|
|
1480
|
+
* The source file must be compliant with all
|
|
1481
|
+
* [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
|
|
1482
|
+
* requirements.
|
|
1483
|
+
*
|
|
1484
|
+
* @default false
|
|
1485
|
+
*/
|
|
1486
|
+
declaration?: IsolatedDeclarationsOptions
|
|
1487
|
+
/**
|
|
1488
|
+
* Rewrite or remove TypeScript import/export declaration extensions.
|
|
1489
|
+
*
|
|
1490
|
+
* - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
|
|
1491
|
+
* - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
|
|
1492
|
+
* - When set to `true`, it's equivalent to `rewrite`.
|
|
1493
|
+
* - When set to `false` or omitted, no changes will be made to the extensions.
|
|
1494
|
+
*
|
|
1495
|
+
* @default false
|
|
1496
|
+
*/
|
|
1497
|
+
rewriteImportExtensions?: 'rewrite' | 'remove' | boolean
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
export interface ValueSpan {
|
|
1501
|
+
value: string
|
|
1502
|
+
start: number
|
|
1503
|
+
end: number
|
|
1504
|
+
}
|