rolldown 1.0.0-beta.3-commit.e170e6e → 1.0.0-beta.30

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 (149) hide show
  1. package/bin/cli.mjs +2 -0
  2. package/dist/{cjs/cli.cjs → cli.cjs} +620 -620
  3. package/dist/cli.d.cts +1 -0
  4. package/dist/cli.d.mts +1 -0
  5. package/dist/{esm/cli.mjs → cli.mjs} +596 -593
  6. package/dist/config.cjs +12 -0
  7. package/dist/config.d.cts +10 -0
  8. package/dist/config.d.mts +10 -0
  9. package/dist/config.mjs +10 -0
  10. package/dist/experimental-index.cjs +105 -0
  11. package/dist/experimental-index.d.cts +58 -0
  12. package/dist/experimental-index.d.mts +58 -0
  13. package/dist/experimental-index.mjs +82 -0
  14. package/dist/experimental-runtime-types.d.ts +66 -0
  15. package/dist/filter-index.cjs +105 -0
  16. package/dist/filter-index.d.cts +4 -0
  17. package/dist/filter-index.d.mts +4 -0
  18. package/dist/filter-index.mjs +44 -0
  19. package/dist/index.cjs +9 -0
  20. package/dist/index.d.cts +3 -0
  21. package/dist/index.d.mts +3 -0
  22. package/dist/index.mjs +5 -0
  23. package/dist/{cjs/parallel-plugin-worker.cjs → parallel-plugin-worker.cjs} +6 -15
  24. package/dist/parallel-plugin-worker.d.cts +1 -0
  25. package/dist/parallel-plugin-worker.d.mts +1 -0
  26. package/dist/{esm/parallel-plugin-worker.mjs → parallel-plugin-worker.mjs} +5 -13
  27. package/dist/{cjs/parallel-plugin.cjs → parallel-plugin.cjs} +1 -2
  28. package/dist/parallel-plugin.d.cts +14 -0
  29. package/dist/parallel-plugin.d.mts +14 -0
  30. package/dist/{esm/parallel-plugin.mjs → parallel-plugin.mjs} +0 -1
  31. package/dist/parse-ast-index.cjs +4 -0
  32. package/dist/parse-ast-index.d.cts +8 -0
  33. package/dist/parse-ast-index.d.mts +8 -0
  34. package/dist/parse-ast-index.mjs +3 -0
  35. package/dist/shared/binding-BAyrv67G.d.cts +1309 -0
  36. package/dist/shared/binding-DUz1Q2JW.d.mts +1309 -0
  37. package/dist/shared/{chunk-qZFfknuJ.cjs → chunk-DDkG_k5U.cjs} +0 -1
  38. package/dist/shared/define-config-CMH1jWhX.d.cts +1331 -0
  39. package/dist/shared/define-config-D_KKKWbo.d.mts +1331 -0
  40. package/dist/shared/load-config-BWjPkvnW.mjs +119 -0
  41. package/dist/shared/load-config-BtTrX40c.cjs +125 -0
  42. package/dist/shared/misc-CQeo-AFx.mjs +22 -0
  43. package/dist/shared/misc-DksvspN4.cjs +58 -0
  44. package/dist/shared/parse-ast-index-DrqwhzH4.cjs +784 -0
  45. package/dist/shared/parse-ast-index-DyFjvjrb.mjs +656 -0
  46. package/dist/shared/{prompt-CxK9euq3.mjs → prompt-C5jz26Zn.mjs} +241 -240
  47. package/dist/shared/{prompt-ZZScCEWI.cjs → prompt-QNI93ne7.cjs} +245 -245
  48. package/dist/shared/src-CRRyjCYJ.cjs +4573 -0
  49. package/dist/shared/src-DR2upIfp.mjs +4381 -0
  50. package/package.json +69 -69
  51. package/bin/cli.js +0 -2
  52. package/dist/cjs/experimental-index.cjs +0 -85
  53. package/dist/cjs/index.cjs +0 -8
  54. package/dist/cjs/parse-ast-index.cjs +0 -4
  55. package/dist/esm/experimental-index.mjs +0 -57
  56. package/dist/esm/index.mjs +0 -4
  57. package/dist/esm/parse-ast-index.mjs +0 -3
  58. package/dist/shared/parse-ast-index-DIxeQDpE.mjs +0 -674
  59. package/dist/shared/parse-ast-index-Dh_sWnMa.cjs +0 -719
  60. package/dist/shared/src-CLo-BgXK.cjs +0 -3007
  61. package/dist/shared/src-CTS_IQ3m.mjs +0 -2826
  62. package/dist/types/api/build.d.ts +0 -18
  63. package/dist/types/api/experimental.d.ts +0 -7
  64. package/dist/types/api/rolldown/index.d.ts +0 -3
  65. package/dist/types/api/rolldown/rolldown-build.d.ts +0 -13
  66. package/dist/types/api/watch/index.d.ts +0 -3
  67. package/dist/types/api/watch/watch-emitter.d.ts +0 -31
  68. package/dist/types/api/watch/watcher.d.ts +0 -13
  69. package/dist/types/binding.d.ts +0 -1435
  70. package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
  71. package/dist/types/builtin-plugin/constructors.d.ts +0 -21
  72. package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -28
  73. package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
  74. package/dist/types/builtin-plugin/utils.d.ts +0 -8
  75. package/dist/types/cli/arguments/alias.d.ts +0 -16
  76. package/dist/types/cli/arguments/index.d.ts +0 -15
  77. package/dist/types/cli/arguments/normalize.d.ts +0 -12
  78. package/dist/types/cli/arguments/utils.d.ts +0 -8
  79. package/dist/types/cli/colors.d.ts +0 -11
  80. package/dist/types/cli/commands/bundle.d.ts +0 -3
  81. package/dist/types/cli/commands/help.d.ts +0 -1
  82. package/dist/types/cli/index.d.ts +0 -1
  83. package/dist/types/cli/load-config.d.ts +0 -5
  84. package/dist/types/cli/logger.d.ts +0 -5
  85. package/dist/types/constants/plugin-context.d.ts +0 -7
  86. package/dist/types/constants/plugin.d.ts +0 -45
  87. package/dist/types/experimental-index.d.ts +0 -9
  88. package/dist/types/index.d.ts +0 -30
  89. package/dist/types/log/log-handler.d.ts +0 -4
  90. package/dist/types/log/logger.d.ts +0 -6
  91. package/dist/types/log/logging.d.ts +0 -12
  92. package/dist/types/log/logs.d.ts +0 -18
  93. package/dist/types/options/input-options.d.ts +0 -181
  94. package/dist/types/options/normalized-input-options.d.ts +0 -18
  95. package/dist/types/options/normalized-output-options.d.ts +0 -70
  96. package/dist/types/options/output-options.d.ts +0 -182
  97. package/dist/types/options/watch-options.d.ts +0 -5
  98. package/dist/types/parallel-plugin-worker.d.ts +0 -1
  99. package/dist/types/parallel-plugin.d.ts +0 -1
  100. package/dist/types/parse-ast-index.d.ts +0 -5
  101. package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
  102. package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
  103. package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
  104. package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
  105. package/dist/types/plugin/bindingify-plugin.d.ts +0 -16
  106. package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
  107. package/dist/types/plugin/hook-filter.d.ts +0 -48
  108. package/dist/types/plugin/index.d.ts +0 -134
  109. package/dist/types/plugin/minimal-plugin-context.d.ts +0 -23
  110. package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
  111. package/dist/types/plugin/parallel-plugin.d.ts +0 -9
  112. package/dist/types/plugin/plugin-context-data.d.ts +0 -17
  113. package/dist/types/plugin/plugin-context.d.ts +0 -67
  114. package/dist/types/plugin/plugin-driver.d.ts +0 -8
  115. package/dist/types/plugin/transform-plugin-context.d.ts +0 -28
  116. package/dist/types/types/assert.d.ts +0 -14
  117. package/dist/types/types/config-export.d.ts +0 -5
  118. package/dist/types/types/misc.d.ts +0 -40
  119. package/dist/types/types/module-info.d.ts +0 -15
  120. package/dist/types/types/module-side-effects.d.ts +0 -12
  121. package/dist/types/types/output-bundle.d.ts +0 -4
  122. package/dist/types/types/rolldown-options.d.ts +0 -5
  123. package/dist/types/types/rolldown-output.d.ts +0 -66
  124. package/dist/types/types/schema.d.ts +0 -33
  125. package/dist/types/types/sourcemap.d.ts +0 -14
  126. package/dist/types/types/utils.d.ts +0 -13
  127. package/dist/types/utils/asset-source.d.ts +0 -4
  128. package/dist/types/utils/async-flatten.d.ts +0 -1
  129. package/dist/types/utils/bindingify-input-options.d.ts +0 -7
  130. package/dist/types/utils/bindingify-output-options.d.ts +0 -5
  131. package/dist/types/utils/code-frame.d.ts +0 -1
  132. package/dist/types/utils/compose-js-plugins.d.ts +0 -2
  133. package/dist/types/utils/create-bundler-option.d.ts +0 -11
  134. package/dist/types/utils/create-bundler.d.ts +0 -8
  135. package/dist/types/utils/define-config.d.ts +0 -5
  136. package/dist/types/utils/error.d.ts +0 -2
  137. package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -19
  138. package/dist/types/utils/misc.d.ts +0 -6
  139. package/dist/types/utils/normalize-hook.d.ts +0 -7
  140. package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
  141. package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
  142. package/dist/types/utils/plugin/index.d.ts +0 -2
  143. package/dist/types/utils/transform-module-info.d.ts +0 -4
  144. package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
  145. package/dist/types/utils/transform-rendered-module.d.ts +0 -3
  146. package/dist/types/utils/transform-side-effects.d.ts +0 -3
  147. package/dist/types/utils/transform-sourcemap.d.ts +0 -3
  148. package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
  149. package/dist/types/utils/validator.d.ts +0 -6
@@ -0,0 +1,1309 @@
1
+ import * as _oxc_project_types0 from "@oxc-project/types";
2
+
3
+ //#region src/binding.d.ts
4
+ type MaybePromise<T> = T | Promise<T>;
5
+ type VoidNullable<T = void> = T | null | undefined | void;
6
+ type BindingStringOrRegex = string | RegExp;
7
+ interface Comment {
8
+ type: 'Line' | 'Block';
9
+ value: string;
10
+ start: number;
11
+ end: number;
12
+ }
13
+ interface ErrorLabel {
14
+ message?: string;
15
+ start: number;
16
+ end: number;
17
+ }
18
+ interface OxcError {
19
+ severity: Severity;
20
+ message: string;
21
+ labels: Array<ErrorLabel>;
22
+ helpMessage?: string;
23
+ codeframe?: string;
24
+ }
25
+ type Severity = 'Error' | 'Warning' | 'Advice';
26
+ declare class ParseResult {
27
+ get program(): _oxc_project_types0.Program;
28
+ get module(): EcmaScriptModule;
29
+ get comments(): Array<Comment>;
30
+ get errors(): Array<OxcError>;
31
+ }
32
+ interface DynamicImport {
33
+ start: number;
34
+ end: number;
35
+ moduleRequest: Span;
36
+ }
37
+ interface EcmaScriptModule {
38
+ /**
39
+ * Has ESM syntax.
40
+ *
41
+ * i.e. `import` and `export` statements, and `import.meta`.
42
+ *
43
+ * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
44
+ */
45
+ hasModuleSyntax: boolean;
46
+ /** Import statements. */
47
+ staticImports: Array<StaticImport>;
48
+ /** Export statements. */
49
+ staticExports: Array<StaticExport>;
50
+ /** Dynamic import expressions. */
51
+ dynamicImports: Array<DynamicImport>;
52
+ /** Span positions` of `import.meta` */
53
+ importMetas: Array<Span>;
54
+ }
55
+ interface ExportExportName {
56
+ kind: ExportExportNameKind;
57
+ name?: string;
58
+ start?: number;
59
+ end?: number;
60
+ }
61
+ type ExportExportNameKind = /** `export { name } */
62
+ 'Name' | /** `export default expression` */
63
+ 'Default' | /** `export * from "mod" */
64
+ 'None';
65
+ interface ExportImportName {
66
+ kind: ExportImportNameKind;
67
+ name?: string;
68
+ start?: number;
69
+ end?: number;
70
+ }
71
+ type ExportImportNameKind = /** `export { name } */
72
+ 'Name' | /** `export * as ns from "mod"` */
73
+ 'All' | /** `export * from "mod"` */
74
+ 'AllButDefault' | /** Does not have a specifier. */
75
+ 'None';
76
+ interface ExportLocalName {
77
+ kind: ExportLocalNameKind;
78
+ name?: string;
79
+ start?: number;
80
+ end?: number;
81
+ }
82
+ type ExportLocalNameKind = /** `export { name } */
83
+ 'Name' | /** `export default expression` */
84
+ 'Default' |
85
+ /**
86
+ * If the exported value is not locally accessible from within the module.
87
+ * `export default function () {}`
88
+ */
89
+ 'None';
90
+ interface ImportName {
91
+ kind: ImportNameKind;
92
+ name?: string;
93
+ start?: number;
94
+ end?: number;
95
+ }
96
+ type ImportNameKind = /** `import { x } from "mod"` */
97
+ 'Name' | /** `import * as ns from "mod"` */
98
+ 'NamespaceObject' | /** `import defaultExport from "mod"` */
99
+ 'Default';
100
+
101
+ /**
102
+ * Parse asynchronously.
103
+ *
104
+ * Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
105
+ */
106
+
107
+ interface ParserOptions {
108
+ /** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */
109
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
110
+ /** Treat the source text as `script` or `module` code. */
111
+ sourceType?: 'script' | 'module' | 'unambiguous' | undefined;
112
+ /**
113
+ * Return an AST which includes TypeScript-related properties, or excludes them.
114
+ *
115
+ * `'js'` is default for JS / JSX files.
116
+ * `'ts'` is default for TS / TSX files.
117
+ * The type of the file is determined from `lang` option, or extension of provided `filename`.
118
+ */
119
+ astType?: 'js' | 'ts';
120
+ /**
121
+ * Controls whether the `range` property is included on AST nodes.
122
+ * The `range` property is a `[number, number]` which indicates the start/end offsets
123
+ * of the node in the file contents.
124
+ *
125
+ * @default false
126
+ */
127
+ range?: boolean;
128
+ /**
129
+ * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST.
130
+ *
131
+ * If this option is true, parenthesized expressions are represented by
132
+ * (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that
133
+ * have a single `expression` property containing the expression inside parentheses.
134
+ *
135
+ * @default true
136
+ */
137
+ preserveParens?: boolean;
138
+ /**
139
+ * Produce semantic errors with an additional AST pass.
140
+ * Semantic errors depend on symbols and scopes, where the parser does not construct.
141
+ * This adds a small performance overhead.
142
+ *
143
+ * @default false
144
+ */
145
+ showSemanticErrors?: boolean;
146
+ }
147
+
148
+ /** Parse synchronously. */
149
+
150
+ interface Span {
151
+ start: number;
152
+ end: number;
153
+ }
154
+ interface StaticExport {
155
+ start: number;
156
+ end: number;
157
+ entries: Array<StaticExportEntry>;
158
+ }
159
+ interface StaticExportEntry {
160
+ start: number;
161
+ end: number;
162
+ moduleRequest?: ValueSpan;
163
+ /** The name under which the desired binding is exported by the module`. */
164
+ importName: ExportImportName;
165
+ /** The name used to export this binding by this module. */
166
+ exportName: ExportExportName;
167
+ /** The name that is used to locally access the exported value from within the importing module. */
168
+ localName: ExportLocalName;
169
+ /**
170
+ * Whether the export is a TypeScript `export type`.
171
+ *
172
+ * Examples:
173
+ *
174
+ * ```ts
175
+ * export type * from 'mod';
176
+ * export type * as ns from 'mod';
177
+ * export type { foo };
178
+ * export { type foo }:
179
+ * export type { foo } from 'mod';
180
+ * ```
181
+ */
182
+ isType: boolean;
183
+ }
184
+ interface StaticImport {
185
+ /** Start of import statement. */
186
+ start: number;
187
+ /** End of import statement. */
188
+ end: number;
189
+ /**
190
+ * Import source.
191
+ *
192
+ * ```js
193
+ * import { foo } from "mod";
194
+ * // ^^^
195
+ * ```
196
+ */
197
+ moduleRequest: ValueSpan;
198
+ /**
199
+ * Import specifiers.
200
+ *
201
+ * Empty for `import "mod"`.
202
+ */
203
+ entries: Array<StaticImportEntry>;
204
+ }
205
+ interface StaticImportEntry {
206
+ /**
207
+ * The name under which the desired binding is exported by the module.
208
+ *
209
+ * ```js
210
+ * import { foo } from "mod";
211
+ * // ^^^
212
+ * import { foo as bar } from "mod";
213
+ * // ^^^
214
+ * ```
215
+ */
216
+ importName: ImportName;
217
+ /**
218
+ * The name that is used to locally access the imported value from within the importing module.
219
+ * ```js
220
+ * import { foo } from "mod";
221
+ * // ^^^
222
+ * import { foo as bar } from "mod";
223
+ * // ^^^
224
+ * ```
225
+ */
226
+ localName: ValueSpan;
227
+ /**
228
+ * Whether this binding is for a TypeScript type-only import.
229
+ *
230
+ * `true` for the following imports:
231
+ * ```ts
232
+ * import type { foo } from "mod";
233
+ * import { type foo } from "mod";
234
+ * ```
235
+ */
236
+ isType: boolean;
237
+ }
238
+ interface ValueSpan {
239
+ value: string;
240
+ start: number;
241
+ end: number;
242
+ }
243
+ declare class ResolverFactory {
244
+ constructor(options?: NapiResolveOptions | undefined | null);
245
+ static default(): ResolverFactory;
246
+ /** Clone the resolver using the same underlying cache. */
247
+ cloneWithOptions(options: NapiResolveOptions): ResolverFactory;
248
+ /** Clear the underlying cache. */
249
+ clearCache(): void;
250
+ /** Synchronously resolve `specifier` at an absolute path to a `directory`. */
251
+ sync(directory: string, request: string): ResolveResult;
252
+ /** Asynchronously resolve `specifier` at an absolute path to a `directory`. */
253
+ async(directory: string, request: string): Promise<ResolveResult>;
254
+ }
255
+
256
+ /** Node.js builtin module when `Options::builtin_modules` is enabled. */
257
+ interface Builtin {
258
+ /**
259
+ * Resolved module.
260
+ *
261
+ * Always prefixed with "node:" in compliance with the ESM specification.
262
+ */
263
+ resolved: string;
264
+ /**
265
+ * Whether the request was prefixed with `node:` or not.
266
+ * `fs` -> `false`.
267
+ * `node:fs` returns `true`.
268
+ */
269
+ isRuntimeModule: boolean;
270
+ }
271
+ declare enum EnforceExtension {
272
+ Auto = 0,
273
+ Enabled = 1,
274
+ Disabled = 2,
275
+ }
276
+ type ModuleType = 'module' | 'commonjs' | 'json' | 'wasm' | 'addon';
277
+
278
+ /**
279
+ * Module Resolution Options
280
+ *
281
+ * Options are directly ported from [enhanced-resolve](https://github.com/webpack/enhanced-resolve#resolver-options).
282
+ *
283
+ * See [webpack resolve](https://webpack.js.org/configuration/resolve/) for information and examples
284
+ */
285
+ interface NapiResolveOptions {
286
+ /**
287
+ * Path to TypeScript configuration file.
288
+ *
289
+ * Default `None`
290
+ */
291
+ tsconfig?: TsconfigOptions;
292
+ /**
293
+ * Alias for [ResolveOptions::alias] and [ResolveOptions::fallback].
294
+ *
295
+ * For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) ->
296
+ * AliasValue::Path(String)`
297
+ * Create aliases to import or require certain modules more easily.
298
+ * A trailing $ can also be added to the given object's keys to signify an exact match.
299
+ * Default `{}`
300
+ */
301
+ alias?: Record<string, Array<string | undefined | null>>;
302
+ /**
303
+ * A list of alias fields in description files.
304
+ * Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec).
305
+ * Can be a path to json object such as `["path", "to", "exports"]`.
306
+ *
307
+ * Default `[]`
308
+ */
309
+ aliasFields?: (string | string[])[];
310
+ /**
311
+ * Condition names for exports field which defines entry points of a package.
312
+ * The key order in the exports field is significant. During condition matching, earlier entries have higher priority and take precedence over later entries.
313
+ *
314
+ * Default `[]`
315
+ */
316
+ conditionNames?: Array<string>;
317
+ /**
318
+ * If true, it will not allow extension-less files.
319
+ * So by default `require('./foo')` works if `./foo` has a `.js` extension,
320
+ * but with this enabled only `require('./foo.js')` will work.
321
+ *
322
+ * Default to `true` when [ResolveOptions::extensions] contains an empty string.
323
+ * Use `Some(false)` to disable the behavior.
324
+ * See <https://github.com/webpack/enhanced-resolve/pull/285>
325
+ *
326
+ * Default None, which is the same as `Some(false)` when the above empty rule is not applied.
327
+ */
328
+ enforceExtension?: EnforceExtension;
329
+ /**
330
+ * A list of exports fields in description files.
331
+ * Can be a path to json object such as `["path", "to", "exports"]`.
332
+ *
333
+ * Default `[["exports"]]`.
334
+ */
335
+ exportsFields?: (string | string[])[];
336
+ /**
337
+ * Fields from `package.json` which are used to provide the internal requests of a package
338
+ * (requests starting with # are considered internal).
339
+ *
340
+ * Can be a path to a JSON object such as `["path", "to", "imports"]`.
341
+ *
342
+ * Default `[["imports"]]`.
343
+ */
344
+ importsFields?: (string | string[])[];
345
+ /**
346
+ * An object which maps extension to extension aliases.
347
+ *
348
+ * Default `{}`
349
+ */
350
+ extensionAlias?: Record<string, Array<string>>;
351
+ /**
352
+ * Attempt to resolve these extensions in order.
353
+ * If multiple files share the same name but have different extensions,
354
+ * will resolve the one with the extension listed first in the array and skip the rest.
355
+ *
356
+ * Default `[".js", ".json", ".node"]`
357
+ */
358
+ extensions?: Array<string>;
359
+ /**
360
+ * Redirect module requests when normal resolving fails.
361
+ *
362
+ * Default `{}`
363
+ */
364
+ fallback?: Record<string, Array<string | undefined | null>>;
365
+ /**
366
+ * Request passed to resolve is already fully specified and extensions or main files are not resolved for it (they are still resolved for internal requests).
367
+ *
368
+ * See also webpack configuration [resolve.fullySpecified](https://webpack.js.org/configuration/module/#resolvefullyspecified)
369
+ *
370
+ * Default `false`
371
+ */
372
+ fullySpecified?: boolean;
373
+ /**
374
+ * A list of main fields in description files
375
+ *
376
+ * Default `["main"]`.
377
+ */
378
+ mainFields?: string | string[];
379
+ /**
380
+ * The filename to be used while resolving directories.
381
+ *
382
+ * Default `["index"]`
383
+ */
384
+ mainFiles?: Array<string>;
385
+ /**
386
+ * A list of directories to resolve modules from, can be absolute path or folder name.
387
+ *
388
+ * Default `["node_modules"]`
389
+ */
390
+ modules?: string | string[];
391
+ /**
392
+ * Resolve to a context instead of a file.
393
+ *
394
+ * Default `false`
395
+ */
396
+ resolveToContext?: boolean;
397
+ /**
398
+ * Prefer to resolve module requests as relative requests instead of using modules from node_modules directories.
399
+ *
400
+ * Default `false`
401
+ */
402
+ preferRelative?: boolean;
403
+ /**
404
+ * Prefer to resolve server-relative urls as absolute paths before falling back to resolve in ResolveOptions::roots.
405
+ *
406
+ * Default `false`
407
+ */
408
+ preferAbsolute?: boolean;
409
+ /**
410
+ * A list of resolve restrictions to restrict the paths that a request can be resolved on.
411
+ *
412
+ * Default `[]`
413
+ */
414
+ restrictions?: Array<Restriction>;
415
+ /**
416
+ * A list of directories where requests of server-relative URLs (starting with '/') are resolved.
417
+ * On non-Windows systems these requests are resolved as an absolute path first.
418
+ *
419
+ * Default `[]`
420
+ */
421
+ roots?: Array<string>;
422
+ /**
423
+ * Whether to resolve symlinks to their symlinked location.
424
+ * When enabled, symlinked resources are resolved to their real path, not their symlinked location.
425
+ * Note that this may cause module resolution to fail when using tools that symlink packages (like npm link).
426
+ *
427
+ * Default `true`
428
+ */
429
+ symlinks?: boolean;
430
+ /**
431
+ * Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not.
432
+ * For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true.
433
+ *
434
+ * Default `false`
435
+ */
436
+ builtinModules?: boolean;
437
+ /**
438
+ * Resolve [ResolveResult::moduleType].
439
+ *
440
+ * Default `false`
441
+ */
442
+ moduleType?: boolean;
443
+ /**
444
+ * Allow `exports` field in `require('../directory')`.
445
+ *
446
+ * This is not part of the spec but some vite projects rely on this behavior.
447
+ * See
448
+ * * <https://github.com/vitejs/vite/pull/20252>
449
+ * * <https://github.com/nodejs/node/issues/58827>
450
+ *
451
+ * Default: `false`
452
+ */
453
+ allowPackageExportsInDirectoryResolve?: boolean;
454
+ }
455
+ interface ResolveResult {
456
+ path?: string;
457
+ error?: string;
458
+ builtin?: Builtin;
459
+ /**
460
+ * Module type for this path.
461
+ *
462
+ * Enable with `ResolveOptions#moduleType`.
463
+ *
464
+ * The module type is computed `ESM_FILE_FORMAT` from the [ESM resolution algorithm specification](https://nodejs.org/docs/latest/api/esm.html#resolution-algorithm-specification).
465
+ *
466
+ * The algorithm uses the file extension or finds the closest `package.json` with the `type` field.
467
+ */
468
+ moduleType?: ModuleType;
469
+ /** `package.json` path for the given module. */
470
+ packageJsonPath?: string;
471
+ }
472
+
473
+ /**
474
+ * Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback].
475
+ * Use struct because napi don't support structured union now
476
+ */
477
+ interface Restriction {
478
+ path?: string;
479
+ regex?: string;
480
+ }
481
+ /**
482
+ * Tsconfig Options
483
+ *
484
+ * Derived from [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin#options)
485
+ */
486
+ interface TsconfigOptions {
487
+ /**
488
+ * Allows you to specify where to find the TypeScript configuration file.
489
+ * You may provide
490
+ * * a relative path to the configuration file. It will be resolved relative to cwd.
491
+ * * an absolute path to the configuration file.
492
+ */
493
+ configFile: string;
494
+ /**
495
+ * Support for Typescript Project References.
496
+ *
497
+ * * `'auto'`: use the `references` field from tsconfig of `config_file`.
498
+ * * `string[]`: manually provided relative or absolute path.
499
+ */
500
+ references?: 'auto' | string[];
501
+ }
502
+ interface SourceMap {
503
+ file?: string;
504
+ mappings: string;
505
+ names: Array<string>;
506
+ sourceRoot?: string;
507
+ sources: Array<string>;
508
+ sourcesContent?: Array<string>;
509
+ version: number;
510
+ x_google_ignoreList?: Array<number>;
511
+ }
512
+ interface CompilerAssumptions {
513
+ ignoreFunctionLength?: boolean;
514
+ noDocumentAll?: boolean;
515
+ objectRestNoSymbols?: boolean;
516
+ pureGetters?: boolean;
517
+ /**
518
+ * When using public class fields, assume that they don't shadow any getter in the current class,
519
+ * in its subclasses or in its superclass. Thus, it's safe to assign them rather than using
520
+ * `Object.defineProperty`.
521
+ *
522
+ * For example:
523
+ *
524
+ * Input:
525
+ * ```js
526
+ * class Test {
527
+ * field = 2;
528
+ *
529
+ * static staticField = 3;
530
+ * }
531
+ * ```
532
+ *
533
+ * When `set_public_class_fields` is `true`, the output will be:
534
+ * ```js
535
+ * class Test {
536
+ * constructor() {
537
+ * this.field = 2;
538
+ * }
539
+ * }
540
+ * Test.staticField = 3;
541
+ * ```
542
+ *
543
+ * Otherwise, the output will be:
544
+ * ```js
545
+ * import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
546
+ * class Test {
547
+ * constructor() {
548
+ * _defineProperty(this, "field", 2);
549
+ * }
550
+ * }
551
+ * _defineProperty(Test, "staticField", 3);
552
+ * ```
553
+ *
554
+ * NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should
555
+ * set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`]
556
+ * to `true`.
557
+ */
558
+ setPublicClassFields?: boolean;
559
+ }
560
+ interface DecoratorOptions {
561
+ /**
562
+ * Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
563
+ *
564
+ * Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
565
+ * This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
566
+ *
567
+ * @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
568
+ * @default false
569
+ */
570
+ legacy?: boolean;
571
+ /**
572
+ * Enables emitting decorator metadata.
573
+ *
574
+ * This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
575
+ * in TypeScript, and it only works when `legacy` is true.
576
+ *
577
+ * @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
578
+ * @default false
579
+ */
580
+ emitDecoratorMetadata?: boolean;
581
+ }
582
+ type HelperMode =
583
+ /**
584
+ * Runtime mode (default): Helper functions are imported from a runtime package.
585
+ *
586
+ * Example:
587
+ *
588
+ * ```js
589
+ * import helperName from "@oxc-project/runtime/helpers/helperName";
590
+ * helperName(...arguments);
591
+ * ```
592
+ */
593
+ 'Runtime' |
594
+ /**
595
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
596
+ *
597
+ * Example:
598
+ *
599
+ * ```js
600
+ * babelHelpers.helperName(...arguments);
601
+ * ```
602
+ */
603
+ 'External';
604
+ interface Helpers {
605
+ mode?: HelperMode;
606
+ }
607
+
608
+ /** TypeScript Isolated Declarations for Standalone DTS Emit */
609
+ declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult;
610
+ interface IsolatedDeclarationsOptions {
611
+ /**
612
+ * Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
613
+ * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
614
+ *
615
+ * Default: `false`
616
+ *
617
+ * See <https://www.typescriptlang.org/tsconfig/#stripInternal>
618
+ */
619
+ stripInternal?: boolean;
620
+ sourcemap?: boolean;
621
+ }
622
+ interface IsolatedDeclarationsResult {
623
+ code: string;
624
+ map?: SourceMap;
625
+ errors: Array<OxcError>;
626
+ }
627
+
628
+ /**
629
+ * Configure how TSX and JSX are transformed.
630
+ *
631
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options}
632
+ */
633
+ interface JsxOptions {
634
+ /**
635
+ * Decides which runtime to use.
636
+ *
637
+ * - 'automatic' - auto-import the correct JSX factories
638
+ * - 'classic' - no auto-import
639
+ *
640
+ * @default 'automatic'
641
+ */
642
+ runtime?: 'classic' | 'automatic';
643
+ /**
644
+ * Emit development-specific information, such as `__source` and `__self`.
645
+ *
646
+ * @default false
647
+ *
648
+ * @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx-development}
649
+ */
650
+ development?: boolean;
651
+ /**
652
+ * Toggles whether or not to throw an error if an XML namespaced tag name
653
+ * is used.
654
+ *
655
+ * Though the JSX spec allows this, it is disabled by default since React's
656
+ * JSX does not currently have support for it.
657
+ *
658
+ * @default true
659
+ */
660
+ throwIfNamespace?: boolean;
661
+ /**
662
+ * Enables `@babel/plugin-transform-react-pure-annotations`.
663
+ *
664
+ * It will mark top-level React method calls as pure for tree shaking.
665
+ *
666
+ * @see {@link https://babeljs.io/docs/en/babel-plugin-transform-react-pure-annotations}
667
+ *
668
+ * @default true
669
+ */
670
+ pure?: boolean;
671
+ /**
672
+ * Replaces the import source when importing functions.
673
+ *
674
+ * @default 'react'
675
+ */
676
+ importSource?: string;
677
+ /**
678
+ * Replace the function used when compiling JSX expressions. It should be a
679
+ * qualified name (e.g. `React.createElement`) or an identifier (e.g.
680
+ * `createElement`).
681
+ *
682
+ * Only used for `classic` {@link runtime}.
683
+ *
684
+ * @default 'React.createElement'
685
+ */
686
+ pragma?: string;
687
+ /**
688
+ * Replace the component used when compiling JSX fragments. It should be a
689
+ * valid JSX tag name.
690
+ *
691
+ * Only used for `classic` {@link runtime}.
692
+ *
693
+ * @default 'React.Fragment'
694
+ */
695
+ pragmaFrag?: string;
696
+ /**
697
+ * When spreading props, use `Object.assign` directly instead of an extend helper.
698
+ *
699
+ * Only used for `classic` {@link runtime}.
700
+ *
701
+ * @default false
702
+ */
703
+ useBuiltIns?: boolean;
704
+ /**
705
+ * When spreading props, use inline object with spread elements directly
706
+ * instead of an extend helper or Object.assign.
707
+ *
708
+ * Only used for `classic` {@link runtime}.
709
+ *
710
+ * @default false
711
+ */
712
+ useSpread?: boolean;
713
+ /**
714
+ * Enable React Fast Refresh .
715
+ *
716
+ * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
717
+ *
718
+ * @default false
719
+ */
720
+ refresh?: boolean | ReactRefreshOptions;
721
+ }
722
+
723
+ /**
724
+ * Transform JavaScript code to a Vite Node runnable module.
725
+ *
726
+ * @param filename The name of the file being transformed.
727
+ * @param sourceText the source code itself
728
+ * @param options The options for the transformation. See {@link
729
+ * ModuleRunnerTransformOptions} for more information.
730
+ *
731
+ * @returns an object containing the transformed code, source maps, and any
732
+ * errors that occurred during parsing or transformation.
733
+ *
734
+ * @deprecated Only works for Vite.
735
+ */
736
+ declare function moduleRunnerTransform(filename: string, sourceText: string, options?: ModuleRunnerTransformOptions | undefined | null): ModuleRunnerTransformResult;
737
+ interface ModuleRunnerTransformOptions {
738
+ /**
739
+ * Enable source map generation.
740
+ *
741
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
742
+ *
743
+ * @default false
744
+ *
745
+ * @see {@link SourceMap}
746
+ */
747
+ sourcemap?: boolean;
748
+ }
749
+ interface ModuleRunnerTransformResult {
750
+ /**
751
+ * The transformed code.
752
+ *
753
+ * If parsing failed, this will be an empty string.
754
+ */
755
+ code: string;
756
+ /**
757
+ * The source map for the transformed code.
758
+ *
759
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
760
+ */
761
+ map?: SourceMap;
762
+ deps: Array<string>;
763
+ dynamicDeps: Array<string>;
764
+ /**
765
+ * Parse and transformation errors.
766
+ *
767
+ * Oxc's parser recovers from common syntax errors, meaning that
768
+ * transformed code may still be available even if there are errors in this
769
+ * list.
770
+ */
771
+ errors: Array<OxcError>;
772
+ }
773
+ interface PluginsOptions {
774
+ styledComponents?: StyledComponentsOptions;
775
+ }
776
+ interface ReactRefreshOptions {
777
+ /**
778
+ * Specify the identifier of the refresh registration variable.
779
+ *
780
+ * @default `$RefreshReg$`.
781
+ */
782
+ refreshReg?: string;
783
+ /**
784
+ * Specify the identifier of the refresh signature variable.
785
+ *
786
+ * @default `$RefreshSig$`.
787
+ */
788
+ refreshSig?: string;
789
+ emitFullSignatures?: boolean;
790
+ }
791
+
792
+ /**
793
+ * Configure how styled-components are transformed.
794
+ *
795
+ * @see {@link https://styled-components.com/docs/tooling#babel-plugin}
796
+ */
797
+ interface StyledComponentsOptions {
798
+ /**
799
+ * Enhances the attached CSS class name on each component with richer output to help
800
+ * identify your components in the DOM without React DevTools.
801
+ *
802
+ * @default true
803
+ */
804
+ displayName?: boolean;
805
+ /**
806
+ * Controls whether the `displayName` of a component will be prefixed with the filename
807
+ * to make the component name as unique as possible.
808
+ *
809
+ * @default true
810
+ */
811
+ fileName?: boolean;
812
+ /**
813
+ * Adds a unique identifier to every styled component to avoid checksum mismatches
814
+ * due to different class generation on the client and server during server-side rendering.
815
+ *
816
+ * @default true
817
+ */
818
+ ssr?: boolean;
819
+ /**
820
+ * Transpiles styled-components tagged template literals to a smaller representation
821
+ * than what Babel normally creates, helping to reduce bundle size.
822
+ *
823
+ * @default true
824
+ */
825
+ transpileTemplateLiterals?: boolean;
826
+ /**
827
+ * Minifies CSS content by removing all whitespace and comments from your CSS,
828
+ * keeping valuable bytes out of your bundles.
829
+ *
830
+ * @default true
831
+ */
832
+ minify?: boolean;
833
+ /**
834
+ * Enables transformation of JSX `css` prop when using styled-components.
835
+ *
836
+ * **Note: This feature is not yet implemented in oxc.**
837
+ *
838
+ * @default true
839
+ */
840
+ cssProp?: boolean;
841
+ /**
842
+ * Enables "pure annotation" to aid dead code elimination by bundlers.
843
+ *
844
+ * @default false
845
+ */
846
+ pure?: boolean;
847
+ /**
848
+ * Adds a namespace prefix to component identifiers to ensure class names are unique.
849
+ *
850
+ * Example: With `namespace: "my-app"`, generates `componentId: "my-app__sc-3rfj0a-1"`
851
+ */
852
+ namespace?: string;
853
+ /**
854
+ * List of file names that are considered meaningless for component naming purposes.
855
+ *
856
+ * When the `fileName` option is enabled and a component is in a file with a name
857
+ * from this list, the directory name will be used instead of the file name for
858
+ * the component's display name.
859
+ *
860
+ * @default ["index"]
861
+ */
862
+ meaninglessFileNames?: Array<string>;
863
+ /**
864
+ * Import paths to be considered as styled-components imports at the top level.
865
+ *
866
+ * **Note: This feature is not yet implemented in oxc.**
867
+ */
868
+ topLevelImportPaths?: Array<string>;
869
+ }
870
+
871
+ /**
872
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
873
+ *
874
+ * @param filename The name of the file being transformed. If this is a
875
+ * relative path, consider setting the {@link TransformOptions#cwd} option..
876
+ * @param sourceText the source code itself
877
+ * @param options The options for the transformation. See {@link
878
+ * TransformOptions} for more information.
879
+ *
880
+ * @returns an object containing the transformed code, source maps, and any
881
+ * errors that occurred during parsing or transformation.
882
+ */
883
+ declare function transform(filename: string, sourceText: string, options?: TransformOptions | undefined | null): TransformResult;
884
+
885
+ /**
886
+ * Options for transforming a JavaScript or TypeScript file.
887
+ *
888
+ * @see {@link transform}
889
+ */
890
+ interface TransformOptions {
891
+ /** Treat the source text as `js`, `jsx`, `ts`, `tsx`, or `dts`. */
892
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
893
+ /** Treat the source text as `script` or `module` code. */
894
+ sourceType?: 'script' | 'module' | 'unambiguous' | undefined;
895
+ /**
896
+ * The current working directory. Used to resolve relative paths in other
897
+ * options.
898
+ */
899
+ cwd?: string;
900
+ /**
901
+ * Enable source map generation.
902
+ *
903
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
904
+ *
905
+ * @default false
906
+ *
907
+ * @see {@link SourceMap}
908
+ */
909
+ sourcemap?: boolean;
910
+ /** Set assumptions in order to produce smaller output. */
911
+ assumptions?: CompilerAssumptions;
912
+ /** Configure how TypeScript is transformed. */
913
+ typescript?: TypeScriptOptions;
914
+ /** Configure how TSX and JSX are transformed. */
915
+ jsx?: 'preserve' | JsxOptions;
916
+ /**
917
+ * Sets the target environment for the generated JavaScript.
918
+ *
919
+ * The lowest target is `es2015`.
920
+ *
921
+ * Example:
922
+ *
923
+ * * 'es2015'
924
+ * * ['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']
925
+ *
926
+ * @default `esnext` (No transformation)
927
+ *
928
+ * @see [esbuild#target](https://esbuild.github.io/api/#target)
929
+ */
930
+ target?: string | Array<string>;
931
+ /** Behaviour for runtime helpers. */
932
+ helpers?: Helpers;
933
+ /** Define Plugin */
934
+ define?: Record<string, string>;
935
+ /** Inject Plugin */
936
+ inject?: Record<string, string | [string, string]>;
937
+ /** Decorator plugin */
938
+ decorator?: DecoratorOptions;
939
+ /** Third-party plugins to use. */
940
+ plugins?: PluginsOptions;
941
+ }
942
+ interface TransformResult {
943
+ /**
944
+ * The transformed code.
945
+ *
946
+ * If parsing failed, this will be an empty string.
947
+ */
948
+ code: string;
949
+ /**
950
+ * The source map for the transformed code.
951
+ *
952
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
953
+ */
954
+ map?: SourceMap;
955
+ /**
956
+ * The `.d.ts` declaration file for the transformed code. Declarations are
957
+ * only generated if `declaration` is set to `true` and a TypeScript file
958
+ * is provided.
959
+ *
960
+ * If parsing failed and `declaration` is set, this will be an empty string.
961
+ *
962
+ * @see {@link TypeScriptOptions#declaration}
963
+ * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
964
+ */
965
+ declaration?: string;
966
+ /**
967
+ * Declaration source map. Only generated if both
968
+ * {@link TypeScriptOptions#declaration declaration} and
969
+ * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
970
+ */
971
+ declarationMap?: SourceMap;
972
+ /**
973
+ * Helpers used.
974
+ *
975
+ * @internal
976
+ *
977
+ * Example:
978
+ *
979
+ * ```text
980
+ * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
981
+ * ```
982
+ */
983
+ helpersUsed: Record<string, string>;
984
+ /**
985
+ * Parse and transformation errors.
986
+ *
987
+ * Oxc's parser recovers from common syntax errors, meaning that
988
+ * transformed code may still be available even if there are errors in this
989
+ * list.
990
+ */
991
+ errors: Array<OxcError>;
992
+ }
993
+ interface TypeScriptOptions {
994
+ jsxPragma?: string;
995
+ jsxPragmaFrag?: string;
996
+ onlyRemoveTypeImports?: boolean;
997
+ allowNamespaces?: boolean;
998
+ /**
999
+ * When enabled, type-only class fields are only removed if they are prefixed with the declare modifier:
1000
+ *
1001
+ * @deprecated
1002
+ *
1003
+ * Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields
1004
+ * without initializer, you can use `remove_class_fields_without_initializer: true` instead.
1005
+ */
1006
+ allowDeclareFields?: boolean;
1007
+ /**
1008
+ * When enabled, class fields without initializers are removed.
1009
+ *
1010
+ * For example:
1011
+ * ```ts
1012
+ * class Foo {
1013
+ * x: number;
1014
+ * y: number = 0;
1015
+ * }
1016
+ * ```
1017
+ * // transform into
1018
+ * ```js
1019
+ * class Foo {
1020
+ * x: number;
1021
+ * }
1022
+ * ```
1023
+ *
1024
+ * The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option.
1025
+ * When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`]
1026
+ * to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is
1027
+ * equivalent to `useDefineForClassFields: false` in TypeScript.
1028
+ *
1029
+ * When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into:
1030
+ *
1031
+ * ```js
1032
+ * class Foo {
1033
+ * constructor() {
1034
+ * this.y = 0;
1035
+ * }
1036
+ * }
1037
+ * ```
1038
+ *
1039
+ * Defaults to `false`.
1040
+ */
1041
+ removeClassFieldsWithoutInitializer?: boolean;
1042
+ /**
1043
+ * Also generate a `.d.ts` declaration file for TypeScript files.
1044
+ *
1045
+ * The source file must be compliant with all
1046
+ * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
1047
+ * requirements.
1048
+ *
1049
+ * @default false
1050
+ */
1051
+ declaration?: IsolatedDeclarationsOptions;
1052
+ /**
1053
+ * Rewrite or remove TypeScript import/export declaration extensions.
1054
+ *
1055
+ * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
1056
+ * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
1057
+ * - When set to `true`, it's equivalent to `rewrite`.
1058
+ * - When set to `false` or omitted, no changes will be made to the extensions.
1059
+ *
1060
+ * @default false
1061
+ */
1062
+ rewriteImportExtensions?: 'rewrite' | 'remove' | boolean;
1063
+ }
1064
+ declare class BindingBundleEndEventData {
1065
+ output: string;
1066
+ duration: number;
1067
+ get result(): BindingBundlerImpl;
1068
+ }
1069
+ declare class BindingBundleErrorEventData {
1070
+ get result(): BindingBundlerImpl;
1071
+ get error(): Array<Error | BindingError>;
1072
+ }
1073
+ declare class BindingBundlerImpl {
1074
+ write(): Promise<BindingOutputs>;
1075
+ generate(): Promise<BindingOutputs>;
1076
+ scan(): Promise<BindingOutputs>;
1077
+ close(): Promise<void>;
1078
+ get closed(): boolean;
1079
+ getWatchFiles(): Promise<Array<string>>;
1080
+ generateHmrPatch(changedFiles: Array<string>): Promise<BindingGenerateHmrPatchReturn>;
1081
+ hmrInvalidate(caller: string, firstInvalidatedBy?: string | undefined | null): Promise<BindingHmrOutput>;
1082
+ }
1083
+ declare class BindingHmrOutput {
1084
+ get patch(): BindingHmrUpdate | null;
1085
+ get errors(): Array<Error | BindingError>;
1086
+ }
1087
+ declare class BindingOutputAsset {
1088
+ get fileName(): string;
1089
+ get originalFileName(): string | null;
1090
+ get originalFileNames(): Array<string>;
1091
+ get source(): BindingAssetSource;
1092
+ get name(): string | null;
1093
+ get names(): Array<string>;
1094
+ }
1095
+ declare class BindingOutputChunk {
1096
+ get isEntry(): boolean;
1097
+ get isDynamicEntry(): boolean;
1098
+ get facadeModuleId(): string | null;
1099
+ get moduleIds(): Array<string>;
1100
+ get exports(): Array<string>;
1101
+ get fileName(): string;
1102
+ get modules(): BindingModules;
1103
+ get imports(): Array<string>;
1104
+ get dynamicImports(): Array<string>;
1105
+ get code(): string;
1106
+ get map(): string | null;
1107
+ get sourcemapFileName(): string | null;
1108
+ get preliminaryFileName(): string;
1109
+ get name(): string;
1110
+ }
1111
+ declare class BindingOutputs {
1112
+ get chunks(): Array<BindingOutputChunk>;
1113
+ get assets(): Array<BindingOutputAsset>;
1114
+ get errors(): Array<Error | BindingError>;
1115
+ }
1116
+ declare class BindingRenderedChunk {
1117
+ get name(): string;
1118
+ get isEntry(): boolean;
1119
+ get isDynamicEntry(): boolean;
1120
+ get facadeModuleId(): string | null;
1121
+ get moduleIds(): Array<string>;
1122
+ get exports(): Array<string>;
1123
+ get fileName(): string;
1124
+ get modules(): BindingModules;
1125
+ get imports(): Array<string>;
1126
+ get dynamicImports(): Array<string>;
1127
+ }
1128
+ declare class BindingRenderedModule {
1129
+ get code(): string | null;
1130
+ get renderedExports(): Array<string>;
1131
+ }
1132
+ declare class BindingWatcherChangeData {
1133
+ path: string;
1134
+ kind: string;
1135
+ }
1136
+ declare class BindingWatcherEvent {
1137
+ eventKind(): string;
1138
+ watchChangeData(): BindingWatcherChangeData;
1139
+ bundleEndData(): BindingBundleEndEventData;
1140
+ bundleEventKind(): string;
1141
+ bundleErrorData(): BindingBundleErrorEventData;
1142
+ }
1143
+ interface BindingAssetPluginConfig {
1144
+ isLib?: boolean;
1145
+ urlBase?: string;
1146
+ publicDir?: string;
1147
+ isSkipAssets?: boolean;
1148
+ assetsInclude?: Array<BindingStringOrRegex>;
1149
+ assetInlineLimit?: number;
1150
+ }
1151
+ interface BindingAssetSource {
1152
+ inner: string | Uint8Array;
1153
+ }
1154
+ interface BindingBuildImportAnalysisPluginConfig {
1155
+ preloadCode: string;
1156
+ insertPreload: boolean;
1157
+ optimizeModulePreloadRelativePaths: boolean;
1158
+ renderBuiltUrl: boolean;
1159
+ isRelativeBase: boolean;
1160
+ }
1161
+ type BindingBuiltinPluginName = 'builtin:alias' | 'builtin:asset' | 'builtin:asset-import-meta-url' | 'builtin:build-import-analysis' | 'builtin:dynamic-import-vars' | 'builtin:import-glob' | 'builtin:isolated-declaration' | 'builtin:json' | 'builtin:load-fallback' | 'builtin:manifest' | 'builtin:module-preload-polyfill' | 'builtin:oxc-runtime' | 'builtin:reporter' | 'builtin:replace' | 'builtin:transform' | 'builtin:vite-resolve' | 'builtin:wasm-fallback' | 'builtin:wasm-helper' | 'builtin:web-worker-post';
1162
+ interface BindingDynamicImportVarsPluginConfig {
1163
+ include?: Array<BindingStringOrRegex>;
1164
+ exclude?: Array<BindingStringOrRegex>;
1165
+ resolver?: (id: string, importer: string) => MaybePromise<string | undefined>;
1166
+ }
1167
+ interface BindingError {
1168
+ kind: string;
1169
+ message: string;
1170
+ }
1171
+ type BindingGenerateHmrPatchReturn = {
1172
+ type: 'Ok';
1173
+ field0: Array<BindingHmrUpdate>;
1174
+ } | {
1175
+ type: 'Error';
1176
+ field0: Array<Error | BindingError>;
1177
+ };
1178
+ interface BindingHmrBoundaryOutput {
1179
+ boundary: string;
1180
+ acceptedVia: string;
1181
+ }
1182
+ type BindingHmrUpdate = {
1183
+ type: 'Patch';
1184
+ code: string;
1185
+ filename: string;
1186
+ sourcemap?: string;
1187
+ sourcemapFilename?: string;
1188
+ hmrBoundaries: Array<BindingHmrBoundaryOutput>;
1189
+ } | {
1190
+ type: 'FullReload';
1191
+ reason?: string;
1192
+ } | {
1193
+ type: 'Noop';
1194
+ };
1195
+ interface BindingHookResolveIdExtraArgs {
1196
+ custom?: number;
1197
+ isEntry: boolean;
1198
+ /**
1199
+ * - `import-statement`: `import { foo } from './lib.js';`
1200
+ * - `dynamic-import`: `import('./lib.js')`
1201
+ * - `require-call`: `require('./lib.js')`
1202
+ * - `import-rule`: `@import 'bg-color.css'`
1203
+ * - `url-token`: `url('./icon.png')`
1204
+ * - `new-url`: `new URL('./worker.js', import.meta.url)`
1205
+ * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
1206
+ */
1207
+ kind: 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept';
1208
+ }
1209
+ interface BindingImportGlobPluginConfig {
1210
+ root?: string;
1211
+ restoreQueryExtension?: boolean;
1212
+ }
1213
+ interface BindingIsolatedDeclarationPluginConfig {
1214
+ stripInternal?: boolean;
1215
+ }
1216
+ interface BindingJsonPluginConfig {
1217
+ minify?: boolean;
1218
+ namedExports?: boolean;
1219
+ stringify?: BindingJsonPluginStringify;
1220
+ }
1221
+ type BindingJsonPluginStringify = boolean | string;
1222
+ interface BindingManifestPluginConfig {
1223
+ root: string;
1224
+ outPath: string;
1225
+ }
1226
+ interface BindingMinifyOptions {
1227
+ mangle?: boolean;
1228
+ compress?: boolean;
1229
+ removeWhitespace?: boolean;
1230
+ }
1231
+ interface BindingModulePreloadPolyfillPluginConfig {
1232
+ isServer?: boolean;
1233
+ }
1234
+ interface BindingModules {
1235
+ values: Array<BindingRenderedModule>;
1236
+ keys: Array<string>;
1237
+ }
1238
+ interface BindingReplacePluginConfig {
1239
+ values: Record<string, string>;
1240
+ delimiters?: [string, string];
1241
+ preventAssignment?: boolean;
1242
+ objectGuards?: boolean;
1243
+ sourcemap?: boolean;
1244
+ }
1245
+ interface BindingReporterPluginConfig {
1246
+ isTty: boolean;
1247
+ isLib: boolean;
1248
+ assetsDir: string;
1249
+ chunkLimit: number;
1250
+ shouldLogInfo: boolean;
1251
+ reportCompressedSize: boolean;
1252
+ }
1253
+ interface BindingTransformHookExtraArgs {
1254
+ moduleType: string;
1255
+ }
1256
+ interface BindingTransformPluginConfig {
1257
+ include?: Array<BindingStringOrRegex>;
1258
+ exclude?: Array<BindingStringOrRegex>;
1259
+ jsxRefreshInclude?: Array<BindingStringOrRegex>;
1260
+ jsxRefreshExclude?: Array<BindingStringOrRegex>;
1261
+ isServerConsumer?: boolean;
1262
+ runtimeResolveBase?: string;
1263
+ jsxInject?: string;
1264
+ transformOptions?: TransformOptions;
1265
+ }
1266
+ interface BindingViteResolvePluginConfig {
1267
+ resolveOptions: BindingViteResolvePluginResolveOptions;
1268
+ environmentConsumer: string;
1269
+ environmentName: string;
1270
+ builtins: Array<BindingStringOrRegex>;
1271
+ external: true | string[];
1272
+ noExternal: true | Array<string | RegExp>;
1273
+ dedupe: Array<string>;
1274
+ finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>;
1275
+ finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>;
1276
+ resolveSubpathImports: (id: string, importer: string, isRequire: boolean, scan: boolean) => VoidNullable<string>;
1277
+ onWarn?: (message: string) => void;
1278
+ onDebug?: (message: string) => void;
1279
+ }
1280
+ interface BindingViteResolvePluginResolveOptions {
1281
+ isBuild: boolean;
1282
+ isProduction: boolean;
1283
+ asSrc: boolean;
1284
+ preferRelative: boolean;
1285
+ isRequire?: boolean;
1286
+ root: string;
1287
+ scan: boolean;
1288
+ mainFields: Array<string>;
1289
+ conditions: Array<string>;
1290
+ externalConditions: Array<string>;
1291
+ extensions: Array<string>;
1292
+ tryIndex: boolean;
1293
+ tryPrefix?: string;
1294
+ preserveSymlinks: boolean;
1295
+ tsconfigPaths: boolean;
1296
+ }
1297
+ interface BindingWasmHelperPluginConfig {
1298
+ decodedBase: string;
1299
+ }
1300
+ interface PreRenderedChunk {
1301
+ name: string;
1302
+ isEntry: boolean;
1303
+ isDynamicEntry: boolean;
1304
+ facadeModuleId?: string;
1305
+ moduleIds: Array<string>;
1306
+ exports: Array<string>;
1307
+ }
1308
+ //#endregion
1309
+ export { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingDynamicImportVarsPluginConfig, BindingHmrUpdate, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMinifyOptions, BindingModulePreloadPolyfillPluginConfig, BindingRenderedChunk, BindingReplacePluginConfig, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingTransformPluginConfig, BindingViteResolvePluginConfig, BindingWasmHelperPluginConfig, BindingWatcherEvent, IsolatedDeclarationsOptions, IsolatedDeclarationsResult, NapiResolveOptions, ParseResult, ParserOptions, PreRenderedChunk, ResolveResult, ResolverFactory, TransformOptions, TransformResult, isolatedDeclaration, moduleRunnerTransform, transform };