rolldown 1.0.0-beta.3-commit.e170e6e → 1.0.0-beta.30

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