rolldown 1.0.0-beta.7-commit.46fbc61 → 1.0.0-beta.7-commit.a684277

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/cli.cjs +124 -17
  2. package/dist/cli.d.cts +1 -0
  3. package/dist/cli.d.mts +1 -0
  4. package/dist/cli.mjs +80 -15
  5. package/dist/experimental-index.cjs +31 -2
  6. package/dist/experimental-index.d.cts +94 -0
  7. package/dist/experimental-index.d.mts +94 -0
  8. package/dist/experimental-index.mjs +31 -2
  9. package/dist/index.cjs +2 -2
  10. package/dist/index.d.cts +4 -0
  11. package/dist/index.d.mts +4 -0
  12. package/dist/index.mjs +2 -2
  13. package/dist/parallel-plugin-worker.cjs +2 -2
  14. package/dist/parallel-plugin-worker.d.cts +1 -0
  15. package/dist/parallel-plugin-worker.d.mts +1 -0
  16. package/dist/parallel-plugin-worker.mjs +2 -2
  17. package/dist/parallel-plugin.d.cts +15 -0
  18. package/dist/parallel-plugin.d.mts +15 -0
  19. package/dist/parse-ast-index.cjs +1 -1
  20. package/dist/parse-ast-index.d.cts +9 -0
  21. package/dist/parse-ast-index.d.mts +9 -0
  22. package/dist/parse-ast-index.mjs +1 -1
  23. package/dist/shared/binding.d-BRtxlpZ6.d.mts +824 -0
  24. package/dist/shared/binding.d-CzSMPsR_.d.cts +824 -0
  25. package/dist/shared/input-options.d-Bc_A4cnr.d.cts +1072 -0
  26. package/dist/shared/input-options.d-Bk53WsIe.d.mts +1072 -0
  27. package/dist/shared/{parse-ast-index-CLx_7WML.cjs → parse-ast-index-3MkelEDZ.cjs} +10 -0
  28. package/dist/shared/{parse-ast-index-lybCSSSh.mjs → parse-ast-index-C93JXze5.mjs} +10 -0
  29. package/dist/shared/{src-CbcfNaXm.cjs → src--wu12-kY.cjs} +83 -4
  30. package/dist/shared/{src-Ca98NyM6.mjs → src-BBUt-xgm.mjs} +71 -4
  31. package/package.json +17 -21
  32. package/dist/tsconfig.tsbuildinfo +0 -1
  33. package/dist/types/api/build.d.ts +0 -18
  34. package/dist/types/api/experimental.d.ts +0 -7
  35. package/dist/types/api/rolldown/index.d.ts +0 -3
  36. package/dist/types/api/rolldown/rolldown-build.d.ts +0 -15
  37. package/dist/types/api/watch/index.d.ts +0 -3
  38. package/dist/types/api/watch/watch-emitter.d.ts +0 -31
  39. package/dist/types/api/watch/watcher.d.ts +0 -13
  40. package/dist/types/binding.d.ts +0 -1507
  41. package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
  42. package/dist/types/builtin-plugin/constructors.d.ts +0 -23
  43. package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -27
  44. package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
  45. package/dist/types/builtin-plugin/utils.d.ts +0 -8
  46. package/dist/types/cli/arguments/alias.d.ts +0 -16
  47. package/dist/types/cli/arguments/index.d.ts +0 -15
  48. package/dist/types/cli/arguments/normalize.d.ts +0 -16
  49. package/dist/types/cli/arguments/utils.d.ts +0 -8
  50. package/dist/types/cli/commands/bundle.d.ts +0 -3
  51. package/dist/types/cli/commands/help.d.ts +0 -1
  52. package/dist/types/cli/index.d.ts +0 -1
  53. package/dist/types/cli/load-config.d.ts +0 -5
  54. package/dist/types/cli/logger.d.ts +0 -5
  55. package/dist/types/constants/plugin-context.d.ts +0 -7
  56. package/dist/types/constants/plugin.d.ts +0 -45
  57. package/dist/types/experimental-index.d.ts +0 -9
  58. package/dist/types/index.d.ts +0 -31
  59. package/dist/types/log/log-handler.d.ts +0 -4
  60. package/dist/types/log/logger.d.ts +0 -6
  61. package/dist/types/log/logging.d.ts +0 -12
  62. package/dist/types/log/logs.d.ts +0 -18
  63. package/dist/types/options/generated/checks-options.d.ts +0 -57
  64. package/dist/types/options/input-options.d.ts +0 -185
  65. package/dist/types/options/normalized-input-options.d.ts +0 -18
  66. package/dist/types/options/normalized-output-options.d.ts +0 -70
  67. package/dist/types/options/output-options.d.ts +0 -182
  68. package/dist/types/options/watch-options.d.ts +0 -5
  69. package/dist/types/parallel-plugin-worker.d.ts +0 -1
  70. package/dist/types/parallel-plugin.d.ts +0 -1
  71. package/dist/types/parse-ast-index.d.ts +0 -5
  72. package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
  73. package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
  74. package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
  75. package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
  76. package/dist/types/plugin/bindingify-plugin.d.ts +0 -17
  77. package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
  78. package/dist/types/plugin/generated/hook-usage.d.ts +0 -29
  79. package/dist/types/plugin/hook-filter.d.ts +0 -49
  80. package/dist/types/plugin/index.d.ts +0 -141
  81. package/dist/types/plugin/minimal-plugin-context.d.ts +0 -24
  82. package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
  83. package/dist/types/plugin/parallel-plugin.d.ts +0 -9
  84. package/dist/types/plugin/plugin-context-data.d.ts +0 -22
  85. package/dist/types/plugin/plugin-context.d.ts +0 -67
  86. package/dist/types/plugin/plugin-driver.d.ts +0 -10
  87. package/dist/types/plugin/transform-plugin-context.d.ts +0 -28
  88. package/dist/types/plugin/with-filter.d.ts +0 -10
  89. package/dist/types/types/assert.d.ts +0 -14
  90. package/dist/types/types/config-export.d.ts +0 -5
  91. package/dist/types/types/misc.d.ts +0 -40
  92. package/dist/types/types/module-info.d.ts +0 -15
  93. package/dist/types/types/module-side-effects.d.ts +0 -12
  94. package/dist/types/types/output-bundle.d.ts +0 -4
  95. package/dist/types/types/rolldown-options.d.ts +0 -5
  96. package/dist/types/types/rolldown-output.d.ts +0 -66
  97. package/dist/types/types/schema.d.ts +0 -33
  98. package/dist/types/types/sourcemap.d.ts +0 -14
  99. package/dist/types/types/utils.d.ts +0 -13
  100. package/dist/types/types.d.ts +0 -7
  101. package/dist/types/utils/asset-source.d.ts +0 -4
  102. package/dist/types/utils/async-flatten.d.ts +0 -1
  103. package/dist/types/utils/bindingify-input-options.d.ts +0 -7
  104. package/dist/types/utils/bindingify-output-options.d.ts +0 -5
  105. package/dist/types/utils/code-frame.d.ts +0 -1
  106. package/dist/types/utils/compose-js-plugins.d.ts +0 -2
  107. package/dist/types/utils/create-bundler-option.d.ts +0 -11
  108. package/dist/types/utils/create-bundler.d.ts +0 -9
  109. package/dist/types/utils/define-config.d.ts +0 -5
  110. package/dist/types/utils/error.d.ts +0 -2
  111. package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -17
  112. package/dist/types/utils/misc.d.ts +0 -7
  113. package/dist/types/utils/normalize-hook.d.ts +0 -7
  114. package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
  115. package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
  116. package/dist/types/utils/plugin/index.d.ts +0 -2
  117. package/dist/types/utils/resolved-external.d.ts +0 -4
  118. package/dist/types/utils/transform-module-info.d.ts +0 -4
  119. package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
  120. package/dist/types/utils/transform-rendered-module.d.ts +0 -3
  121. package/dist/types/utils/transform-side-effects.d.ts +0 -3
  122. package/dist/types/utils/transform-sourcemap.d.ts +0 -3
  123. package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
  124. package/dist/types/utils/validator.d.ts +0 -6
@@ -0,0 +1,824 @@
1
+ import { Program } from "@oxc-project/types";
2
+
3
+ //#region src/binding.d.ts
4
+ type VoidNullable<T = void> = T | null | undefined | void
5
+ type BindingStringOrRegex = string | RegExp
6
+ declare class BindingBundleEndEventData {
7
+ output: string
8
+ duration: number
9
+ }
10
+ declare class BindingError {
11
+ kind: string
12
+ message: string
13
+ }
14
+ declare class BindingRenderedChunk {
15
+ get name(): string
16
+ get isEntry(): boolean
17
+ get isDynamicEntry(): boolean
18
+ get facadeModuleId(): string | null
19
+ get moduleIds(): Array<string>
20
+ get exports(): Array<string>
21
+ get fileName(): string
22
+ get modules(): BindingModules
23
+ get imports(): Array<string>
24
+ get dynamicImports(): Array<string>
25
+ }
26
+ declare class BindingRenderedModule {
27
+ get code(): string | null
28
+ get renderedExports(): Array<string>
29
+ }
30
+ declare class BindingWatcherChangeData {
31
+ path: string
32
+ kind: string
33
+ }
34
+ declare class BindingWatcherEvent {
35
+ eventKind(): string
36
+ watchChangeData(): BindingWatcherChangeData
37
+ bundleEndData(): BindingBundleEndEventData
38
+ bundleEventKind(): string
39
+ errors(): Array<Error | BindingError>
40
+ }
41
+ declare class ParseResult {
42
+ get program(): Program
43
+ get module(): EcmaScriptModule
44
+ get comments(): Array<Comment>
45
+ get errors(): Array<OxcError>
46
+ }
47
+ interface BindingBuildImportAnalysisPluginConfig {
48
+ preloadCode: string
49
+ insertPreload: boolean
50
+ optimizeModulePreloadRelativePaths: boolean
51
+ renderBuiltUrl: boolean
52
+ isRelativeBase: boolean
53
+ }
54
+ type BindingBuiltinPluginName = 'builtin:wasm-helper'|
55
+ 'builtin:import-glob'|
56
+ 'builtin:dynamic-import-vars'|
57
+ 'builtin:module-preload-polyfill'|
58
+ 'builtin:manifest'|
59
+ 'builtin:load-fallback'|
60
+ 'builtin:transform'|
61
+ 'builtin:wasm-fallback'|
62
+ 'builtin:alias'|
63
+ 'builtin:json'|
64
+ 'builtin:build-import-analysis'|
65
+ 'builtin:replace'|
66
+ 'builtin:vite-resolve'|
67
+ 'builtin:module-federation'|
68
+ 'builtin:isolated-declaration'|
69
+ 'builtin:report';
70
+ interface BindingGlobImportPluginConfig {
71
+ root?: string
72
+ restoreQueryExtension?: boolean
73
+ }
74
+ interface BindingHmrBoundaryOutput {
75
+ boundary: string
76
+ acceptedVia: string
77
+ }
78
+ interface BindingHmrOutput {
79
+ patch: string
80
+ hmrBoundaries: Array<BindingHmrBoundaryOutput>
81
+ }
82
+ interface BindingHookResolveIdExtraArgs {
83
+ custom?: number
84
+ isEntry: boolean
85
+ kind: 'import' | 'dynamic-import' | 'require-call'
86
+ }
87
+ interface BindingIsolatedDeclarationPluginConfig {
88
+ stripInternal?: boolean
89
+ }
90
+ interface BindingJsonPluginConfig {
91
+ minify?: boolean
92
+ namedExports?: boolean
93
+ stringify?: BindingJsonPluginStringify
94
+ }
95
+ type BindingJsonPluginStringify =
96
+ boolean | string
97
+ interface BindingManifestPluginConfig {
98
+ root: string
99
+ outPath: string
100
+ }
101
+ interface BindingMfManifest {
102
+ filePath?: string
103
+ disableAssetsAnalyze?: boolean
104
+ fileName?: string
105
+ }
106
+ interface BindingMinifyOptions {
107
+ mangle: boolean
108
+ compress: boolean
109
+ removeWhitespace: boolean
110
+ }
111
+ interface BindingModuleFederationPluginOption {
112
+ name: string
113
+ filename?: string
114
+ exposes?: Record<string, string>
115
+ remotes?: Array<BindingRemote>
116
+ shared?: Record<string, BindingShared>
117
+ runtimePlugins?: Array<string>
118
+ manifest?: BindingMfManifest
119
+ getPublicPath?: string
120
+ }
121
+ interface BindingModulePreloadPolyfillPluginConfig {
122
+ skip?: boolean
123
+ }
124
+ interface BindingModules {
125
+ values: Array<BindingRenderedModule>
126
+ keys: Array<string>
127
+ }
128
+ interface BindingRemote {
129
+ type?: string
130
+ entry: string
131
+ name: string
132
+ entryGlobalName?: string
133
+ shareScope?: string
134
+ }
135
+ interface BindingReplacePluginConfig {
136
+ values: Record<string, string>
137
+ delimiters?: [string, string]
138
+ preventAssignment?: boolean
139
+ objectGuards?: boolean
140
+ sourcemap?: boolean
141
+ }
142
+ interface BindingReportPluginConfig {
143
+ isTty: boolean
144
+ }
145
+ interface BindingShared {
146
+ version?: string
147
+ shareScope?: string
148
+ singleton?: boolean
149
+ requiredVersion?: string
150
+ strictVersion?: boolean
151
+ }
152
+ interface BindingTransformHookExtraArgs {
153
+ moduleType: string
154
+ }
155
+ interface BindingTransformPluginConfig {
156
+ include?: Array<BindingStringOrRegex>
157
+ exclude?: Array<BindingStringOrRegex>
158
+ jsxRefreshInclude?: Array<BindingStringOrRegex>
159
+ jsxRefreshExclude?: Array<BindingStringOrRegex>
160
+ isServerConsumer?: boolean
161
+ runtimeResolveBase?: string
162
+ jsxInject?: string
163
+ transformOptions?: TransformOptions
164
+ }
165
+ interface BindingViteResolvePluginConfig {
166
+ resolveOptions: BindingViteResolvePluginResolveOptions
167
+ environmentConsumer: string
168
+ environmentName: string
169
+ external: true | string[]
170
+ noExternal: true | Array<string | RegExp>
171
+ dedupe: Array<string>
172
+ finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
173
+ finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
174
+ runtime: string
175
+ }
176
+ interface BindingViteResolvePluginResolveOptions {
177
+ isBuild: boolean
178
+ isProduction: boolean
179
+ asSrc: boolean
180
+ preferRelative: boolean
181
+ isRequire?: boolean
182
+ root: string
183
+ scan: boolean
184
+ mainFields: Array<string>
185
+ conditions: Array<string>
186
+ externalConditions: Array<string>
187
+ extensions: Array<string>
188
+ tryIndex: boolean
189
+ tryPrefix?: string
190
+ preserveSymlinks: boolean
191
+ }
192
+ interface Comment {
193
+ type: 'Line' | 'Block'
194
+ value: string
195
+ start: number
196
+ end: number
197
+ }
198
+ interface CompilerAssumptions {
199
+ ignoreFunctionLength?: boolean
200
+ noDocumentAll?: boolean
201
+ objectRestNoSymbols?: boolean
202
+ pureGetters?: boolean
203
+ setPublicClassFields?: boolean
204
+ }
205
+ interface DecoratorOptions {
206
+ /**
207
+ * Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
208
+ *
209
+ * Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
210
+ * This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
211
+ *
212
+ * @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
213
+ * @default false
214
+ */
215
+ legacy?: boolean
216
+ /**
217
+ * Enables emitting decorator metadata.
218
+ *
219
+ * This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
220
+ * in TypeScript, and it only works when `legacy` is true.
221
+ *
222
+ * @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
223
+ * @default false
224
+ */
225
+ emitDecoratorMetadata?: boolean
226
+ }
227
+ interface DynamicImport {
228
+ start: number
229
+ end: number
230
+ moduleRequest: Span
231
+ }
232
+ interface EcmaScriptModule {
233
+ /**
234
+ * Has ESM syntax.
235
+ *
236
+ * i.e. `import` and `export` statements, and `import.meta`.
237
+ *
238
+ * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
239
+ */
240
+ hasModuleSyntax: boolean
241
+ /** Import statements. */
242
+ staticImports: Array<StaticImport>
243
+ /** Export statements. */
244
+ staticExports: Array<StaticExport>
245
+ /** Dynamic import expressions. */
246
+ dynamicImports: Array<DynamicImport>
247
+ /** Span positions` of `import.meta` */
248
+ importMetas: Array<Span>
249
+ }
250
+ interface ErrorLabel {
251
+ message?: string
252
+ start: number
253
+ end: number
254
+ }
255
+ interface ExportExportName {
256
+ kind: ExportExportNameKind
257
+ name?: string
258
+ start?: number
259
+ end?: number
260
+ }
261
+ type ExportExportNameKind = /** `export { name } */
262
+ 'Name'|
263
+ /** `export default expression` */
264
+ 'Default'|
265
+ /** `export * from "mod" */
266
+ 'None';
267
+ interface ExportImportName {
268
+ kind: ExportImportNameKind
269
+ name?: string
270
+ start?: number
271
+ end?: number
272
+ }
273
+ type ExportImportNameKind = /** `export { name } */
274
+ 'Name'|
275
+ /** `export * as ns from "mod"` */
276
+ 'All'|
277
+ /** `export * from "mod"` */
278
+ 'AllButDefault'|
279
+ /** Does not have a specifier. */
280
+ 'None';
281
+ interface ExportLocalName {
282
+ kind: ExportLocalNameKind
283
+ name?: string
284
+ start?: number
285
+ end?: number
286
+ }
287
+ type ExportLocalNameKind = /** `export { name } */
288
+ 'Name'|
289
+ /** `export default expression` */
290
+ 'Default'|
291
+ /**
292
+ * If the exported value is not locally accessible from within the module.
293
+ * `export default function () {}`
294
+ */
295
+ 'None';
296
+ type HelperMode = /**
297
+ * Runtime mode (default): Helper functions are imported from a runtime package.
298
+ *
299
+ * Example:
300
+ *
301
+ * ```js
302
+ * import helperName from "@oxc-project/runtime/helpers/helperName";
303
+ * helperName(...arguments);
304
+ * ```
305
+ */
306
+ 'Runtime'|
307
+ /**
308
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
309
+ *
310
+ * Example:
311
+ *
312
+ * ```js
313
+ * babelHelpers.helperName(...arguments);
314
+ * ```
315
+ */
316
+ 'External';
317
+ interface Helpers {
318
+ mode?: HelperMode
319
+ }
320
+ interface ImportName {
321
+ kind: ImportNameKind
322
+ name?: string
323
+ start?: number
324
+ end?: number
325
+ }
326
+ type ImportNameKind = /** `import { x } from "mod"` */
327
+ 'Name'|
328
+ /** `import * as ns from "mod"` */
329
+ 'NamespaceObject'|
330
+ /** `import defaultExport from "mod"` */
331
+ 'Default';
332
+ interface IsolatedDeclarationsOptions {
333
+ /**
334
+ * Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
335
+ * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
336
+ *
337
+ * Default: `false`
338
+ *
339
+ * See <https://www.typescriptlang.org/tsconfig/#stripInternal>
340
+ */
341
+ stripInternal?: boolean
342
+ sourcemap?: boolean
343
+ }
344
+ /**
345
+ * Configure how TSX and JSX are transformed.
346
+ *
347
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
348
+ */
349
+ /**
350
+ * Configure how TSX and JSX are transformed.
351
+ *
352
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
353
+ */
354
+ interface JsxOptions {
355
+ /**
356
+ * Decides which runtime to use.
357
+ *
358
+ * - 'automatic' - auto-import the correct JSX factories
359
+ * - 'classic' - no auto-import
360
+ *
361
+ * @default 'automatic'
362
+ */
363
+ runtime?: 'classic' | 'automatic'
364
+ /**
365
+ * Emit development-specific information, such as `__source` and `__self`.
366
+ *
367
+ * @default false
368
+ *
369
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development}
370
+ */
371
+ development?: boolean
372
+ /**
373
+ * Toggles whether or not to throw an error if an XML namespaced tag name
374
+ * is used.
375
+ *
376
+ * Though the JSX spec allows this, it is disabled by default since React's
377
+ * JSX does not currently have support for it.
378
+ *
379
+ * @default true
380
+ */
381
+ throwIfNamespace?: boolean
382
+ /**
383
+ * Enables `@babel/plugin-transform-react-pure-annotations`.
384
+ *
385
+ * It will mark top-level React method calls as pure for tree shaking.
386
+ *
387
+ * @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations}
388
+ *
389
+ * @default true
390
+ */
391
+ pure?: boolean
392
+ /**
393
+ * Replaces the import source when importing functions.
394
+ *
395
+ * @default 'react'
396
+ */
397
+ importSource?: string
398
+ /**
399
+ * Replace the function used when compiling JSX expressions. It should be a
400
+ * qualified name (e.g. `React.createElement`) or an identifier (e.g.
401
+ * `createElement`).
402
+ *
403
+ * Only used for `classic` {@link runtime}.
404
+ *
405
+ * @default 'React.createElement'
406
+ */
407
+ pragma?: string
408
+ /**
409
+ * Replace the component used when compiling JSX fragments. It should be a
410
+ * valid JSX tag name.
411
+ *
412
+ * Only used for `classic` {@link runtime}.
413
+ *
414
+ * @default 'React.Fragment'
415
+ */
416
+ pragmaFrag?: string
417
+ /**
418
+ * When spreading props, use `Object.assign` directly instead of an extend helper.
419
+ *
420
+ * Only used for `classic` {@link runtime}.
421
+ *
422
+ * @default false
423
+ */
424
+ useBuiltIns?: boolean
425
+ /**
426
+ * When spreading props, use inline object with spread elements directly
427
+ * instead of an extend helper or Object.assign.
428
+ *
429
+ * Only used for `classic` {@link runtime}.
430
+ *
431
+ * @default false
432
+ */
433
+ useSpread?: boolean
434
+ /**
435
+ * Enable React Fast Refresh .
436
+ *
437
+ * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
438
+ *
439
+ * @default false
440
+ */
441
+ refresh?: boolean | ReactRefreshOptions
442
+ }
443
+ /**
444
+ * Transform JavaScript code to a Vite Node runnable module.
445
+ *
446
+ * @param filename The name of the file being transformed.
447
+ * @param sourceText the source code itself
448
+ * @param options The options for the transformation. See {@link
449
+ * ModuleRunnerTransformOptions} for more information.
450
+ *
451
+ * @returns an object containing the transformed code, source maps, and any
452
+ * errors that occurred during parsing or transformation.
453
+ *
454
+ * @deprecated Only works for Vite.
455
+ */
456
+ /**
457
+ * Transform JavaScript code to a Vite Node runnable module.
458
+ *
459
+ * @param filename The name of the file being transformed.
460
+ * @param sourceText the source code itself
461
+ * @param options The options for the transformation. See {@link
462
+ * ModuleRunnerTransformOptions} for more information.
463
+ *
464
+ * @returns an object containing the transformed code, source maps, and any
465
+ * errors that occurred during parsing or transformation.
466
+ *
467
+ * @deprecated Only works for Vite.
468
+ */
469
+ declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): ModuleRunnerTransformResult
470
+ interface ModuleRunnerTransformOptions {
471
+ /**
472
+ * Enable source map generation.
473
+ *
474
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
475
+ *
476
+ * @default false
477
+ *
478
+ * @see {@link SourceMap}
479
+ */
480
+ sourcemap?: boolean
481
+ }
482
+ interface ModuleRunnerTransformResult {
483
+ /**
484
+ * The transformed code.
485
+ *
486
+ * If parsing failed, this will be an empty string.
487
+ */
488
+ code: string
489
+ /**
490
+ * The source map for the transformed code.
491
+ *
492
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
493
+ */
494
+ map?: SourceMap
495
+ deps: Array<string>
496
+ dynamicDeps: Array<string>
497
+ /**
498
+ * Parse and transformation errors.
499
+ *
500
+ * Oxc's parser recovers from common syntax errors, meaning that
501
+ * transformed code may still be available even if there are errors in this
502
+ * list.
503
+ */
504
+ errors: Array<OxcError>
505
+ }
506
+ interface OxcError {
507
+ severity: Severity
508
+ message: string
509
+ labels: Array<ErrorLabel>
510
+ helpMessage?: string
511
+ codeframe?: string
512
+ }
513
+ interface ParserOptions {
514
+ sourceType?: 'script' | 'module' | 'unambiguous' | undefined
515
+ /** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
516
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx'
517
+ /**
518
+ * Return an AST which includes TypeScript-related properties, or excludes them.
519
+ *
520
+ * `'js'` is default for JS / JSX files.
521
+ * `'ts'` is default for TS / TSX files.
522
+ * The type of the file is determined from `lang` option, or extension of provided `filename`.
523
+ */
524
+ astType?: 'js' | 'ts'
525
+ /**
526
+ * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST.
527
+ *
528
+ * If this option is true, parenthesized expressions are represented by
529
+ * (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that
530
+ * have a single `expression` property containing the expression inside parentheses.
531
+ *
532
+ * @default true
533
+ */
534
+ preserveParens?: boolean
535
+ /**
536
+ * Produce semantic errors with an additional AST pass.
537
+ * Semantic errors depend on symbols and scopes, where the parser does not construct.
538
+ * This adds a small performance overhead.
539
+ *
540
+ * @default false
541
+ */
542
+ showSemanticErrors?: boolean
543
+ }
544
+ interface PreRenderedChunk {
545
+ name: string
546
+ isEntry: boolean
547
+ isDynamicEntry: boolean
548
+ facadeModuleId?: string
549
+ moduleIds: Array<string>
550
+ exports: Array<string>
551
+ }
552
+ interface ReactRefreshOptions {
553
+ /**
554
+ * Specify the identifier of the refresh registration variable.
555
+ *
556
+ * @default `$RefreshReg$`.
557
+ */
558
+ refreshReg?: string
559
+ /**
560
+ * Specify the identifier of the refresh signature variable.
561
+ *
562
+ * @default `$RefreshSig$`.
563
+ */
564
+ refreshSig?: string
565
+ emitFullSignatures?: boolean
566
+ }
567
+ type Severity = 'Error'|
568
+ 'Warning'|
569
+ 'Advice';
570
+ interface SourceMap {
571
+ file?: string
572
+ mappings: string
573
+ names: Array<string>
574
+ sourceRoot?: string
575
+ sources: Array<string>
576
+ sourcesContent?: Array<string>
577
+ version: number
578
+ x_google_ignoreList?: Array<number>
579
+ }
580
+ interface Span {
581
+ start: number
582
+ end: number
583
+ }
584
+ interface StaticExport {
585
+ start: number
586
+ end: number
587
+ entries: Array<StaticExportEntry>
588
+ }
589
+ interface StaticExportEntry {
590
+ start: number
591
+ end: number
592
+ moduleRequest?: ValueSpan
593
+ /** The name under which the desired binding is exported by the module`. */
594
+ importName: ExportImportName
595
+ /** The name used to export this binding by this module. */
596
+ exportName: ExportExportName
597
+ /** The name that is used to locally access the exported value from within the importing module. */
598
+ localName: ExportLocalName
599
+ }
600
+ interface StaticImport {
601
+ /** Start of import statement. */
602
+ start: number
603
+ /** End of import statement. */
604
+ end: number
605
+ /**
606
+ * Import source.
607
+ *
608
+ * ```js
609
+ * import { foo } from "mod";
610
+ * // ^^^
611
+ * ```
612
+ */
613
+ moduleRequest: ValueSpan
614
+ /**
615
+ * Import specifiers.
616
+ *
617
+ * Empty for `import "mod"`.
618
+ */
619
+ entries: Array<StaticImportEntry>
620
+ }
621
+ interface StaticImportEntry {
622
+ /**
623
+ * The name under which the desired binding is exported by the module.
624
+ *
625
+ * ```js
626
+ * import { foo } from "mod";
627
+ * // ^^^
628
+ * import { foo as bar } from "mod";
629
+ * // ^^^
630
+ * ```
631
+ */
632
+ importName: ImportName
633
+ /**
634
+ * The name that is used to locally access the imported value from within the importing module.
635
+ * ```js
636
+ * import { foo } from "mod";
637
+ * // ^^^
638
+ * import { foo as bar } from "mod";
639
+ * // ^^^
640
+ * ```
641
+ */
642
+ localName: ValueSpan
643
+ /**
644
+ * Whether this binding is for a TypeScript type-only import.
645
+ *
646
+ * `true` for the following imports:
647
+ * ```ts
648
+ * import type { foo } from "mod";
649
+ * import { type foo } from "mod";
650
+ * ```
651
+ */
652
+ isType: boolean
653
+ }
654
+ /**
655
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
656
+ *
657
+ * @param filename The name of the file being transformed. If this is a
658
+ * relative path, consider setting the {@link TransformOptions#cwd} option..
659
+ * @param sourceText the source code itself
660
+ * @param options The options for the transformation. See {@link
661
+ * TransformOptions} for more information.
662
+ *
663
+ * @returns an object containing the transformed code, source maps, and any
664
+ * errors that occurred during parsing or transformation.
665
+ */
666
+ /**
667
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
668
+ *
669
+ * @param filename The name of the file being transformed. If this is a
670
+ * relative path, consider setting the {@link TransformOptions#cwd} option..
671
+ * @param sourceText the source code itself
672
+ * @param options The options for the transformation. See {@link
673
+ * TransformOptions} for more information.
674
+ *
675
+ * @returns an object containing the transformed code, source maps, and any
676
+ * errors that occurred during parsing or transformation.
677
+ */
678
+ declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult
679
+ /**
680
+ * Options for transforming a JavaScript or TypeScript file.
681
+ *
682
+ * @see {@link transform}
683
+ */
684
+ /**
685
+ * Options for transforming a JavaScript or TypeScript file.
686
+ *
687
+ * @see {@link transform}
688
+ */
689
+ interface TransformOptions {
690
+ sourceType?: 'script' | 'module' | 'unambiguous' | undefined
691
+ /** Treat the source text as `js`, `jsx`, `ts`, or `tsx`. */
692
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx'
693
+ /**
694
+ * The current working directory. Used to resolve relative paths in other
695
+ * options.
696
+ */
697
+ cwd?: string
698
+ /**
699
+ * Enable source map generation.
700
+ *
701
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
702
+ *
703
+ * @default false
704
+ *
705
+ * @see {@link SourceMap}
706
+ */
707
+ sourcemap?: boolean
708
+ /** Set assumptions in order to produce smaller output. */
709
+ assumptions?: CompilerAssumptions
710
+ /** Configure how TypeScript is transformed. */
711
+ typescript?: TypeScriptOptions
712
+ /** Configure how TSX and JSX are transformed. */
713
+ jsx?: 'preserve' | JsxOptions
714
+ /**
715
+ * Sets the target environment for the generated JavaScript.
716
+ *
717
+ * The lowest target is `es2015`.
718
+ *
719
+ * Example:
720
+ *
721
+ * * 'es2015'
722
+ * * ['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']
723
+ *
724
+ * @default `esnext` (No transformation)
725
+ *
726
+ * @see [esbuild#target](https://esbuild.github.io/api/#target)
727
+ */
728
+ target?: string | Array<string>
729
+ /** Behaviour for runtime helpers. */
730
+ helpers?: Helpers
731
+ /** Define Plugin */
732
+ define?: Record<string, string>
733
+ /** Inject Plugin */
734
+ inject?: Record<string, string | [string, string]>
735
+ /** Decorator plugin */
736
+ decorator?: DecoratorOptions
737
+ }
738
+ interface TransformResult {
739
+ /**
740
+ * The transformed code.
741
+ *
742
+ * If parsing failed, this will be an empty string.
743
+ */
744
+ code: string
745
+ /**
746
+ * The source map for the transformed code.
747
+ *
748
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
749
+ */
750
+ map?: SourceMap
751
+ /**
752
+ * The `.d.ts` declaration file for the transformed code. Declarations are
753
+ * only generated if `declaration` is set to `true` and a TypeScript file
754
+ * is provided.
755
+ *
756
+ * If parsing failed and `declaration` is set, this will be an empty string.
757
+ *
758
+ * @see {@link TypeScriptOptions#declaration}
759
+ * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
760
+ */
761
+ declaration?: string
762
+ /**
763
+ * Declaration source map. Only generated if both
764
+ * {@link TypeScriptOptions#declaration declaration} and
765
+ * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
766
+ */
767
+ declarationMap?: SourceMap
768
+ /**
769
+ * Helpers used.
770
+ *
771
+ * @internal
772
+ *
773
+ * Example:
774
+ *
775
+ * ```text
776
+ * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
777
+ * ```
778
+ */
779
+ helpersUsed: Record<string, string>
780
+ /**
781
+ * Parse and transformation errors.
782
+ *
783
+ * Oxc's parser recovers from common syntax errors, meaning that
784
+ * transformed code may still be available even if there are errors in this
785
+ * list.
786
+ */
787
+ errors: Array<OxcError>
788
+ }
789
+ interface TypeScriptOptions {
790
+ jsxPragma?: string
791
+ jsxPragmaFrag?: string
792
+ onlyRemoveTypeImports?: boolean
793
+ allowNamespaces?: boolean
794
+ allowDeclareFields?: boolean
795
+ /**
796
+ * Also generate a `.d.ts` declaration file for TypeScript files.
797
+ *
798
+ * The source file must be compliant with all
799
+ * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
800
+ * requirements.
801
+ *
802
+ * @default false
803
+ */
804
+ declaration?: IsolatedDeclarationsOptions
805
+ /**
806
+ * Rewrite or remove TypeScript import/export declaration extensions.
807
+ *
808
+ * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
809
+ * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
810
+ * - When set to `true`, it's equivalent to `rewrite`.
811
+ * - When set to `false` or omitted, no changes will be made to the extensions.
812
+ *
813
+ * @default false
814
+ */
815
+ rewriteImportExtensions?: 'rewrite' | 'remove' | boolean
816
+ }
817
+ interface ValueSpan {
818
+ value: string
819
+ start: number
820
+ end: number
821
+ }
822
+
823
+ //#endregion
824
+ export { BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingGlobImportPluginConfig, BindingHmrOutput, BindingHookResolveIdExtraArgs, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReplacePluginConfig, BindingReportPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWatcherEvent, ParseResult, ParserOptions, PreRenderedChunk, TransformOptions, TransformResult as TransformResult$1, moduleRunnerTransform, transform };