rolldown 1.0.0-beta.1-commit.35fb1f8 → 1.0.0-beta.10

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