rolldown 1.0.0-beta.1-commit.7c52c94 → 1.0.0-beta.10-commit.ac4e5db

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-CFRprP4h.cjs +125 -0
  40. package/dist/shared/load-config-DrIWz9n9.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-DuQI8s0p.cjs +4654 -0
  48. package/dist/shared/src-r81e2JxS.mjs +4456 -0
  49. package/package.json +63 -62
  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-CPCP99Z9.mjs +0 -2641
  64. package/dist/shared/src-lBcHSsjm.cjs +0 -2822
  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 -1288
  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,1288 +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?: Array<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
- name: string
581
- entryGlobalName?: string
582
- shareScope?: string
583
- }
584
-
585
- export interface BindingReplacePluginConfig {
586
- values: Record<string, string>
587
- delimiters?: [string, string]
588
- preventAssignment?: boolean
589
- objectGuards?: boolean
590
- sourcemap?: boolean
591
- }
592
-
593
- export interface BindingResolveOptions {
594
- alias?: Array<AliasItem>
595
- aliasFields?: Array<Array<string>>
596
- conditionNames?: Array<string>
597
- exportsFields?: Array<Array<string>>
598
- extensions?: Array<string>
599
- extensionAlias?: Array<ExtensionAliasItem>
600
- mainFields?: Array<string>
601
- mainFiles?: Array<string>
602
- modules?: Array<string>
603
- symlinks?: boolean
604
- tsconfigFilename?: string
605
- }
606
-
607
- export interface BindingShared {
608
- version?: string
609
- shareScope?: string
610
- singleton?: boolean
611
- requiredVersion?: string
612
- strictVersion?: boolean
613
- }
614
-
615
- export interface BindingSourcemap {
616
- inner: string | BindingJsonSourcemap
617
- }
618
-
619
- export interface BindingTransformHookExtraArgs {
620
- moduleType: string
621
- }
622
-
623
- export interface BindingTransformHookFilter {
624
- code?: BindingGeneralHookFilter
625
- moduleType?: Array<string>
626
- id?: BindingGeneralHookFilter
627
- }
628
-
629
- export interface BindingTransformPluginConfig {
630
- include?: Array<BindingStringOrRegex>
631
- exclude?: Array<BindingStringOrRegex>
632
- jsxInject?: string
633
- reactRefresh?: boolean
634
- target?: string
635
- browserslist?: string
636
- }
637
-
638
- export interface BindingTreeshake {
639
- moduleSideEffects: boolean | BindingModuleSideEffectsRule[] | ((id: string, is_external: boolean) => boolean | undefined)
640
- annotations?: boolean
641
- }
642
-
643
- export interface BindingViteResolvePluginConfig {
644
- resolveOptions: BindingViteResolvePluginResolveOptions
645
- environmentConsumer: string
646
- environmentName: string
647
- external: true | string[]
648
- noExternal: true | Array<string | RegExp>
649
- dedupe: Array<string>
650
- finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
651
- finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
652
- runtime: string
653
- }
654
-
655
- export interface BindingViteResolvePluginResolveOptions {
656
- isBuild: boolean
657
- isProduction: boolean
658
- asSrc: boolean
659
- preferRelative: boolean
660
- isRequire?: boolean
661
- root: string
662
- scan: boolean
663
- mainFields: Array<string>
664
- conditions: Array<string>
665
- externalConditions: Array<string>
666
- extensions: Array<string>
667
- tryIndex: boolean
668
- tryPrefix?: string
669
- preserveSymlinks: boolean
670
- }
671
-
672
- export interface BindingWatchOption {
673
- skipWrite?: boolean
674
- include?: Array<BindingStringOrRegex>
675
- exclude?: Array<BindingStringOrRegex>
676
- }
677
-
678
- export interface Comment {
679
- type: 'Line' | 'Block'
680
- value: string
681
- start: number
682
- end: number
683
- }
684
-
685
- export interface CompilerAssumptions {
686
- ignoreFunctionLength?: boolean
687
- noDocumentAll?: boolean
688
- objectRestNoSymbols?: boolean
689
- pureGetters?: boolean
690
- setPublicClassFields?: boolean
691
- }
692
-
693
- export interface EcmaScriptModule {
694
- /**
695
- * Has ESM syntax.
696
- *
697
- * i.e. `import` and `export` statements, and `import.meta`.
698
- *
699
- * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
700
- */
701
- hasModuleSyntax: boolean
702
- /** Import Statements. */
703
- staticImports: Array<StaticImport>
704
- /** Export Statements. */
705
- staticExports: Array<StaticExport>
706
- /** Span positions` of `import.meta` */
707
- importMetas: Array<Span>
708
- }
709
-
710
- export interface ErrorLabel {
711
- message?: string
712
- start: number
713
- end: number
714
- }
715
-
716
- export interface Es2015Options {
717
- /** Transform arrow functions into function expressions. */
718
- arrowFunction?: ArrowFunctionsOptions
719
- }
720
-
721
- export interface ExportExportName {
722
- kind: ExportExportNameKind
723
- name?: string
724
- start?: number
725
- end?: number
726
- }
727
-
728
- export type ExportExportNameKind = /** `export { name } */
729
- 'Name'|
730
- /** `export default expression` */
731
- 'Default'|
732
- /** `export * from "mod" */
733
- 'None';
734
-
735
- export interface ExportImportName {
736
- kind: ExportImportNameKind
737
- name?: string
738
- start?: number
739
- end?: number
740
- }
741
-
742
- export type ExportImportNameKind = /** `export { name } */
743
- 'Name'|
744
- /** `export * as ns from "mod"` */
745
- 'All'|
746
- /** `export * from "mod"` */
747
- 'AllButDefault'|
748
- /** Does not have a specifier. */
749
- 'None';
750
-
751
- export interface ExportLocalName {
752
- kind: ExportLocalNameKind
753
- name?: string
754
- start?: number
755
- end?: number
756
- }
757
-
758
- export type ExportLocalNameKind = /** `export { name } */
759
- 'Name'|
760
- /** `export default expression` */
761
- 'Default'|
762
- /**
763
- * If the exported value is not locally accessible from within the module.
764
- * `export default function () {}`
765
- */
766
- 'None';
767
-
768
- export interface ExtensionAliasItem {
769
- target: string
770
- replacements: Array<string>
771
- }
772
-
773
- export type HelperMode = /**
774
- * Runtime mode (default): Helper functions are imported from a runtime package.
775
- *
776
- * Example:
777
- *
778
- * ```js
779
- * import helperName from "@babel/runtime/helpers/helperName";
780
- * helperName(...arguments);
781
- * ```
782
- */
783
- 'Runtime'|
784
- /**
785
- * External mode: Helper functions are accessed from a global `babelHelpers` object.
786
- *
787
- * Example:
788
- *
789
- * ```js
790
- * babelHelpers.helperName(...arguments);
791
- * ```
792
- */
793
- 'External';
794
-
795
- export interface Helpers {
796
- mode?: HelperMode
797
- }
798
-
799
- export interface ImportName {
800
- kind: ImportNameKind
801
- name?: string
802
- start?: number
803
- end?: number
804
- }
805
-
806
- export type ImportNameKind = /** `import { x } from "mod"` */
807
- 'Name'|
808
- /** `import * as ns from "mod"` */
809
- 'NamespaceObject'|
810
- /** `import defaultExport from "mod"` */
811
- 'Default';
812
-
813
- /** TypeScript Isolated Declarations for Standalone DTS Emit */
814
- export declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult
815
-
816
- export interface IsolatedDeclarationsOptions {
817
- /**
818
- * Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
819
- * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
820
- *
821
- * Default: `false`
822
- *
823
- * See <https://www.typescriptlang.org/tsconfig/#stripInternal>
824
- */
825
- stripInternal?: boolean
826
- sourcemap?: boolean
827
- }
828
-
829
- export interface IsolatedDeclarationsResult {
830
- code: string
831
- map?: SourceMap
832
- errors: Array<OxcError>
833
- }
834
-
835
- export interface JsChangedOutputs {
836
- chunks: Array<JsOutputChunk>
837
- assets: Array<JsOutputAsset>
838
- deleted: Array<string>
839
- }
840
-
841
- export interface JsOutputAsset {
842
- names: Array<string>
843
- originalFileNames: Array<string>
844
- filename: string
845
- source: BindingAssetSource
846
- }
847
-
848
- export interface JsOutputChunk {
849
- name: string
850
- isEntry: boolean
851
- isDynamicEntry: boolean
852
- facadeModuleId?: string
853
- moduleIds: Array<string>
854
- exports: Array<string>
855
- filename: string
856
- modules: Record<string, BindingRenderedModule>
857
- imports: Array<string>
858
- dynamicImports: Array<string>
859
- code: string
860
- map?: BindingSourcemap
861
- sourcemapFilename?: string
862
- preliminaryFilename: string
863
- }
864
-
865
- /**
866
- * Configure how TSX and JSX are transformed.
867
- *
868
- * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
869
- */
870
- export interface JsxOptions {
871
- /**
872
- * Decides which runtime to use.
873
- *
874
- * - 'automatic' - auto-import the correct JSX factories
875
- * - 'classic' - no auto-import
876
- *
877
- * @default 'automatic'
878
- */
879
- runtime?: 'classic' | 'automatic'
880
- /**
881
- * Emit development-specific information, such as `__source` and `__self`.
882
- *
883
- * @default false
884
- *
885
- * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development}
886
- */
887
- development?: boolean
888
- /**
889
- * Toggles whether or not to throw an error if an XML namespaced tag name
890
- * is used.
891
- *
892
- * Though the JSX spec allows this, it is disabled by default since React's
893
- * JSX does not currently have support for it.
894
- *
895
- * @default true
896
- */
897
- throwIfNamespace?: boolean
898
- /**
899
- * Enables `@babel/plugin-transform-react-pure-annotations`.
900
- *
901
- * It will mark top-level React method calls as pure for tree shaking.
902
- *
903
- * @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations}
904
- *
905
- * @default true
906
- */
907
- pure?: boolean
908
- /**
909
- * Replaces the import source when importing functions.
910
- *
911
- * @default 'react'
912
- */
913
- importSource?: string
914
- /**
915
- * Replace the function used when compiling JSX expressions. It should be a
916
- * qualified name (e.g. `React.createElement`) or an identifier (e.g.
917
- * `createElement`).
918
- *
919
- * Only used for `classic` {@link runtime}.
920
- *
921
- * @default 'React.createElement'
922
- */
923
- pragma?: string
924
- /**
925
- * Replace the component used when compiling JSX fragments. It should be a
926
- * valid JSX tag name.
927
- *
928
- * Only used for `classic` {@link runtime}.
929
- *
930
- * @default 'React.Fragment'
931
- */
932
- pragmaFrag?: string
933
- /**
934
- * When spreading props, use `Object.assign` directly instead of an extend helper.
935
- *
936
- * Only used for `classic` {@link runtime}.
937
- *
938
- * @default false
939
- */
940
- useBuiltIns?: boolean
941
- /**
942
- * When spreading props, use inline object with spread elements directly
943
- * instead of an extend helper or Object.assign.
944
- *
945
- * Only used for `classic` {@link runtime}.
946
- *
947
- * @default false
948
- */
949
- useSpread?: boolean
950
- /**
951
- * Enable React Fast Refresh .
952
- *
953
- * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
954
- *
955
- * @default false
956
- */
957
- refresh?: boolean | ReactRefreshOptions
958
- }
959
-
960
- export interface LineColumn {
961
- line: number
962
- column: number
963
- }
964
-
965
- export interface OverwriteOptions {
966
- contentOnly: boolean
967
- }
968
-
969
- export interface OxcError {
970
- severity: Severity
971
- message: string
972
- labels: Array<ErrorLabel>
973
- helpMessage?: string
974
- }
975
-
976
- /**
977
- * Parse asynchronously.
978
- *
979
- * Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
980
- */
981
- export declare function parseAsync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): Promise<ParseResult>
982
-
983
- export interface ParserOptions {
984
- sourceType?: 'script' | 'module' | 'unambiguous' | undefined
985
- /** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
986
- lang?: 'js' | 'jsx' | 'ts' | 'tsx'
987
- /**
988
- * Emit `ParenthesizedExpression` in AST.
989
- *
990
- * If this option is true, parenthesized expressions are represented by
991
- * (non-standard) `ParenthesizedExpression` nodes that have a single `expression` property
992
- * containing the expression inside parentheses.
993
- *
994
- * Default: true
995
- */
996
- preserveParens?: boolean
997
- }
998
-
999
- /** Parse synchronously. */
1000
- export declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | undefined | null): ParseResult
1001
-
1002
- /**
1003
- * Parse without returning anything.
1004
- *
1005
- * This is for benchmark purposes such as measuring napi communication overhead.
1006
- */
1007
- export declare function parseWithoutReturn(filename: string, sourceText: string, options?: ParserOptions | undefined | null): void
1008
-
1009
- export interface PreRenderedChunk {
1010
- name: string
1011
- isEntry: boolean
1012
- isDynamicEntry: boolean
1013
- facadeModuleId?: string
1014
- moduleIds: Array<string>
1015
- exports: Array<string>
1016
- }
1017
-
1018
- export interface ReactRefreshOptions {
1019
- /**
1020
- * Specify the identifier of the refresh registration variable.
1021
- *
1022
- * @default `$RefreshReg$`.
1023
- */
1024
- refreshReg?: string
1025
- /**
1026
- * Specify the identifier of the refresh signature variable.
1027
- *
1028
- * @default `$RefreshSig$`.
1029
- */
1030
- refreshSig?: string
1031
- emitFullSignatures?: boolean
1032
- }
1033
-
1034
- export declare function registerPlugins(id: number, plugins: Array<BindingPluginWithIndex>): void
1035
-
1036
- export type Severity = 'Error'|
1037
- 'Warning'|
1038
- 'Advice';
1039
-
1040
- export interface SourceMap {
1041
- file?: string
1042
- mappings: string
1043
- names: Array<string>
1044
- sourceRoot?: string
1045
- sources: Array<string>
1046
- sourcesContent?: Array<string>
1047
- version: number
1048
- x_google_ignoreList?: Array<number>
1049
- }
1050
-
1051
- export interface SourceMapOptions {
1052
- includeContent?: boolean
1053
- source?: string
1054
- hires?: boolean
1055
- }
1056
-
1057
- export interface Span {
1058
- start: number
1059
- end: number
1060
- }
1061
-
1062
- export interface StaticExport {
1063
- start: number
1064
- end: number
1065
- entries: Array<StaticExportEntry>
1066
- }
1067
-
1068
- export interface StaticExportEntry {
1069
- start: number
1070
- end: number
1071
- moduleRequest?: ValueSpan
1072
- /** The name under which the desired binding is exported by the module`. */
1073
- importName: ExportImportName
1074
- /** The name used to export this binding by this module. */
1075
- exportName: ExportExportName
1076
- /** The name that is used to locally access the exported value from within the importing module. */
1077
- localName: ExportLocalName
1078
- }
1079
-
1080
- export interface StaticImport {
1081
- /** Start of import statement. */
1082
- start: number
1083
- /** End of import statement. */
1084
- end: number
1085
- /**
1086
- * Import source.
1087
- *
1088
- * ```js
1089
- * import { foo } from "mod";
1090
- * // ^^^
1091
- * ```
1092
- */
1093
- moduleRequest: ValueSpan
1094
- /**
1095
- * Import specifiers.
1096
- *
1097
- * Empty for `import "mod"`.
1098
- */
1099
- entries: Array<StaticImportEntry>
1100
- }
1101
-
1102
- export interface StaticImportEntry {
1103
- /**
1104
- * The name under which the desired binding is exported by the module.
1105
- *
1106
- * ```js
1107
- * import { foo } from "mod";
1108
- * // ^^^
1109
- * import { foo as bar } from "mod";
1110
- * // ^^^
1111
- * ```
1112
- */
1113
- importName: ImportName
1114
- /**
1115
- * The name that is used to locally access the imported value from within the importing module.
1116
- * ```js
1117
- * import { foo } from "mod";
1118
- * // ^^^
1119
- * import { foo as bar } from "mod";
1120
- * // ^^^
1121
- * ```
1122
- */
1123
- localName: ValueSpan
1124
- /**
1125
- * Whether this binding is for a TypeScript type-only import.
1126
- *
1127
- * `true` for the following imports:
1128
- * ```ts
1129
- * import type { foo } from "mod";
1130
- * import { type foo } from "mod";
1131
- * ```
1132
- */
1133
- isType: boolean
1134
- }
1135
-
1136
- /**
1137
- * Transpile a JavaScript or TypeScript into a target ECMAScript version.
1138
- *
1139
- * @param filename The name of the file being transformed. If this is a
1140
- * relative path, consider setting the {@link TransformOptions#cwd} option..
1141
- * @param sourceText the source code itself
1142
- * @param options The options for the transformation. See {@link
1143
- * TransformOptions} for more information.
1144
- *
1145
- * @returns an object containing the transformed code, source maps, and any
1146
- * errors that occurred during parsing or transformation.
1147
- */
1148
- export declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult
1149
-
1150
- /**
1151
- * Options for transforming a JavaScript or TypeScript file.
1152
- *
1153
- * @see {@link transform}
1154
- */
1155
- export interface TransformOptions {
1156
- sourceType?: 'script' | 'module' | 'unambiguous' | undefined
1157
- /** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
1158
- lang?: 'js' | 'jsx' | 'ts' | 'tsx'
1159
- /**
1160
- * The current working directory. Used to resolve relative paths in other
1161
- * options.
1162
- */
1163
- cwd?: string
1164
- /**
1165
- * Enable source map generation.
1166
- *
1167
- * When `true`, the `sourceMap` field of transform result objects will be populated.
1168
- *
1169
- * @default false
1170
- *
1171
- * @see {@link SourceMap}
1172
- */
1173
- sourcemap?: boolean
1174
- /** Set assumptions in order to produce smaller output. */
1175
- assumptions?: CompilerAssumptions
1176
- /** Configure how TypeScript is transformed. */
1177
- typescript?: TypeScriptOptions
1178
- /** Configure how TSX and JSX are transformed. */
1179
- jsx?: 'preserve' | JsxOptions
1180
- /**
1181
- * Sets the target environment for the generated JavaScript.
1182
- *
1183
- * The lowest target is `es2015`.
1184
- *
1185
- * Example:
1186
- *
1187
- * * 'es2015'
1188
- * * ['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']
1189
- *
1190
- * @default `esnext` (No transformation)
1191
- *
1192
- * @see [esbuild#target](https://esbuild.github.io/api/#target)
1193
- */
1194
- target?: string | Array<string>
1195
- /** Behaviour for runtime helpers. */
1196
- helpers?: Helpers
1197
- /** Define Plugin */
1198
- define?: Record<string, string>
1199
- /** Inject Plugin */
1200
- inject?: Record<string, string | [string, string]>
1201
- }
1202
-
1203
- export interface TransformResult {
1204
- /**
1205
- * The transformed code.
1206
- *
1207
- * If parsing failed, this will be an empty string.
1208
- */
1209
- code: string
1210
- /**
1211
- * The source map for the transformed code.
1212
- *
1213
- * This will be set if {@link TransformOptions#sourcemap} is `true`.
1214
- */
1215
- map?: SourceMap
1216
- /**
1217
- * The `.d.ts` declaration file for the transformed code. Declarations are
1218
- * only generated if `declaration` is set to `true` and a TypeScript file
1219
- * is provided.
1220
- *
1221
- * If parsing failed and `declaration` is set, this will be an empty string.
1222
- *
1223
- * @see {@link TypeScriptOptions#declaration}
1224
- * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
1225
- */
1226
- declaration?: string
1227
- /**
1228
- * Declaration source map. Only generated if both
1229
- * {@link TypeScriptOptions#declaration declaration} and
1230
- * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
1231
- */
1232
- declarationMap?: SourceMap
1233
- /**
1234
- * Helpers used.
1235
- *
1236
- * @internal
1237
- *
1238
- * Example:
1239
- *
1240
- * ```text
1241
- * { "_objectSpread": "@babel/runtime/helpers/objectSpread2" }
1242
- * ```
1243
- */
1244
- helpersUsed: Record<string, string>
1245
- /**
1246
- * Parse and transformation errors.
1247
- *
1248
- * Oxc's parser recovers from common syntax errors, meaning that
1249
- * transformed code may still be available even if there are errors in this
1250
- * list.
1251
- */
1252
- errors: Array<OxcError>
1253
- }
1254
-
1255
- export interface TypeScriptOptions {
1256
- jsxPragma?: string
1257
- jsxPragmaFrag?: string
1258
- onlyRemoveTypeImports?: boolean
1259
- allowNamespaces?: boolean
1260
- allowDeclareFields?: boolean
1261
- /**
1262
- * Also generate a `.d.ts` declaration file for TypeScript files.
1263
- *
1264
- * The source file must be compliant with all
1265
- * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
1266
- * requirements.
1267
- *
1268
- * @default false
1269
- */
1270
- declaration?: IsolatedDeclarationsOptions
1271
- /**
1272
- * Rewrite or remove TypeScript import/export declaration extensions.
1273
- *
1274
- * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
1275
- * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
1276
- * - When set to `true`, it's equivalent to `rewrite`.
1277
- * - When set to `false` or omitted, no changes will be made to the extensions.
1278
- *
1279
- * @default false
1280
- */
1281
- rewriteImportExtensions?: 'rewrite' | 'remove' | boolean
1282
- }
1283
-
1284
- export interface ValueSpan {
1285
- value: string
1286
- start: number
1287
- end: number
1288
- }