rolldown 1.0.0-beta.6-commit.0fdc9f2 → 1.0.0-beta.60

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