@rolldown/browser 1.0.0-beta.7-commit.46fbc61 → 1.0.0-beta.7-commit.a684277

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