vite-plus 0.1.22 → 0.1.23

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 (62) hide show
  1. package/binding/index.cjs +119 -52
  2. package/binding/index.d.cts +3222 -2
  3. package/dist/agent-aSGY0osq.js +2461 -0
  4. package/dist/bin.js +6 -5
  5. package/dist/cli-truncate-CWsmbK3p.js +867 -0
  6. package/dist/{compat-OlmU9EQz.js → compat-DXZgnEyq.js} +1 -1
  7. package/dist/config/bin.js +18 -5
  8. package/dist/{constants-kDaYqyWd.js → constants-DCBWlNrn.js} +7 -2
  9. package/dist/create/bin.js +135 -64
  10. package/dist/{define-config-IMCGDS2K.d.ts → define-config-COdn-tsn.d.ts} +7 -5
  11. package/dist/define-config.cjs +1 -1
  12. package/dist/define-config.d.ts +1 -1
  13. package/dist/define-config.js +1 -1
  14. package/dist/dist-Bapm49IR.js +3 -0
  15. package/dist/{dist-owlRxmBM.js → dist-BgQuvbtq.js} +136 -110
  16. package/dist/fmt.d.ts +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/is-fullwidth-code-point-BUNlIICg.js +8 -0
  21. package/dist/lint.d.ts +1 -1
  22. package/dist/{log-update-NRrY6krx.js → log-update-lyIiuflf.js} +111 -24
  23. package/dist/migration/bin.js +71 -30
  24. package/dist/{oxlint-plugin-config-BkQeR4FR.js → oxlint-plugin-config-B89iKTKN.js} +1 -1
  25. package/dist/oxlint-plugin.d.ts +2 -4
  26. package/dist/oxlint-plugin.js +1 -1
  27. package/dist/pack-bin.js +1 -1
  28. package/dist/pack.d.ts +1 -1
  29. package/dist/{package-BoLLED6j.js → package-PmBUZ-ve.js} +2 -2
  30. package/dist/staged/bin.js +10 -10
  31. package/dist/strip-ansi-C3wrWz9t.js +853 -0
  32. package/dist/{agent-BWLe0i9g.js → tsconfig-DlUVXT3J.js} +648 -2089
  33. package/dist/version.js +5 -5
  34. package/dist/versions.js +6 -6
  35. package/dist/{workspace-Bi_9spVt.js → workspace-DElv730L.js} +13 -12
  36. package/dist/wrap-ansi-CeQuiQ31.js +2 -0
  37. package/dist/{wrap-ansi-DtUeUCjE.js → wrap-ansi-k7Dn4VtV.js} +1 -1
  38. package/docs/config/run.md +39 -4
  39. package/docs/guide/cache.md +10 -1
  40. package/docs/guide/env.md +3 -0
  41. package/docs/guide/ide-integration.md +2 -2
  42. package/docs/guide/install.md +2 -0
  43. package/docs/guide/run.md +2 -0
  44. package/docs/guide/troubleshooting.md +5 -2
  45. package/package.json +18 -18
  46. package/templates/monorepo/_gitignore +1 -0
  47. package/dist/cli-truncate-B62YnW2m.js +0 -138
  48. package/dist/dist-DZfItHAr.js +0 -3
  49. package/dist/slice-ansi-e4todZeH.js +0 -113
  50. package/dist/strip-ansi-D-eYYcD2.js +0 -198
  51. package/dist/tsconfig-BVyzXJ_o.js +0 -517
  52. package/dist/wrap-ansi-3S3qJ7j8.js +0 -2
  53. /package/dist/{chunk-q7NCDQ7-.js → chunk-DnnnRqeS.js} +0 -0
  54. /package/dist/{define-config-GqLoRwH9.cjs → define-config-BR1Y88zz.cjs} +0 -0
  55. /package/dist/{define-config-CzWdQTt2.js → define-config-BRC7qPNE.js} +0 -0
  56. /package/dist/{help-DK5wuu34.js → help-YP84FSEz.js} +0 -0
  57. /package/dist/{lib-DpwyUJWo.js → lib-L3DWSRQp.js} +0 -0
  58. /package/dist/{main-DhsO6ndq.js → main-DpJl3LoU.js} +0 -0
  59. /package/dist/{pack-K7H72Cum.d.ts → pack-Ciiho0Tq.d.ts} +0 -0
  60. /package/dist/{report-CYPv1VK1.js → report-DgSBQUdz.js} +0 -0
  61. /package/dist/{resolve-vite-config-C5AjksTj.js → resolve-vite-config-TTvhycU1.js} +0 -0
  62. /package/dist/{terminal-D_Kg-AA6.js → terminal-uTv0ZaMr.js} +0 -0
@@ -1,5 +1,3225 @@
1
- /* auto-generated by NAPI-RS */
2
- /* eslint-disable */
1
+ type BindingErrorsOr<T> = T | BindingErrors;
2
+ type FxHashSet<T> = Set<T>;
3
+ type FxHashMap<K, V> = Map<K, V>;
4
+ type MaybePromise<T> = T | Promise<T>;
5
+ type Nullable<T> = T | null | undefined;
6
+ type VoidNullable<T = void> = T | null | undefined | void;
7
+ export type BindingStringOrRegex = string | RegExp;
8
+ export type BindingResult<T> = { errors: BindingError[]; isBindingErrors: boolean } | T;
9
+
10
+ export interface CodegenOptions {
11
+ /**
12
+ * Remove whitespace.
13
+ *
14
+ * @default true
15
+ */
16
+ removeWhitespace?: boolean;
17
+ /**
18
+ * How to handle legal comments (comments containing `@license`, `@preserve`, or starting with `//!`/`/*!`).
19
+ *
20
+ * * `"none"` - Do not preserve any legal comments.
21
+ * * `"inline"` - Preserve all legal comments inline.
22
+ * * `"eof"` - Move all legal comments to the end of the file.
23
+ * * `"external"` - Extract legal comments without linking.
24
+ * * `{ linked: "path/to/legal.txt" }` - Extract legal comments and add a link comment to the given path.
25
+ *
26
+ * @default "none" (when minifying)
27
+ */
28
+ legalComments?: 'none' | 'inline' | 'eof' | 'external' | { linked: string };
29
+ }
30
+
31
+ export interface CompressOptions {
32
+ /**
33
+ * Set desired EcmaScript standard version for output.
34
+ *
35
+ * Set `esnext` to enable all target highering.
36
+ *
37
+ * Example:
38
+ *
39
+ * * `'es2015'`
40
+ * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
41
+ *
42
+ * @default 'esnext'
43
+ *
44
+ * @see [esbuild#target](https://esbuild.github.io/api/#target)
45
+ */
46
+ target?: string | Array<string>;
47
+ /**
48
+ * Pass true to discard calls to `console.*`.
49
+ *
50
+ * @default false
51
+ */
52
+ dropConsole?: boolean;
53
+ /**
54
+ * Remove `debugger;` statements.
55
+ *
56
+ * @default true
57
+ */
58
+ dropDebugger?: boolean;
59
+ /**
60
+ * Pass `true` to drop unreferenced functions and variables.
61
+ *
62
+ * Simple direct variable assignments do not count as references unless set to `keep_assign`.
63
+ * @default true
64
+ */
65
+ unused?: boolean | 'keep_assign';
66
+ /** Keep function / class names. */
67
+ keepNames?: CompressOptionsKeepNames;
68
+ /**
69
+ * Join consecutive var, let and const statements.
70
+ *
71
+ * @default true
72
+ */
73
+ joinVars?: boolean;
74
+ /**
75
+ * Join consecutive simple statements using the comma operator.
76
+ *
77
+ * `a; b` -> `a, b`
78
+ *
79
+ * @default true
80
+ */
81
+ sequences?: boolean;
82
+ /**
83
+ * Set of label names to drop from the code.
84
+ *
85
+ * Labeled statements matching these names will be removed during minification.
86
+ *
87
+ * @default []
88
+ */
89
+ dropLabels?: Array<string>;
90
+ /** Limit the maximum number of iterations for debugging purpose. */
91
+ maxIterations?: number;
92
+ /** Treeshake options. */
93
+ treeshake?: TreeShakeOptions;
94
+ }
95
+
96
+ export interface CompressOptionsKeepNames {
97
+ /**
98
+ * Keep function names so that `Function.prototype.name` is preserved.
99
+ *
100
+ * This does not guarantee that the `undefined` name is preserved.
101
+ *
102
+ * @default false
103
+ */
104
+ function: boolean;
105
+ /**
106
+ * Keep class names so that `Class.prototype.name` is preserved.
107
+ *
108
+ * This does not guarantee that the `undefined` name is preserved.
109
+ *
110
+ * @default false
111
+ */
112
+ class: boolean;
113
+ }
114
+
115
+ export interface LegalCommentsLinked {
116
+ /**
117
+ * Extract legal comments and write them to the given path, with a link
118
+ * comment appended to the generated code.
119
+ */
120
+ linked: string;
121
+ }
122
+
123
+ export declare const enum LegalCommentsMode {
124
+ /** Do not preserve any legal comments. */
125
+ None = 'none',
126
+ /** Preserve all legal comments inline. */
127
+ Inline = 'inline',
128
+ /** Move all legal comments to the end of the file. */
129
+ Eof = 'eof',
130
+ /** Extract legal comments without linking. */
131
+ External = 'external',
132
+ }
133
+
134
+ export interface MangleOptions {
135
+ /**
136
+ * Pass `true` to mangle names declared in the top level scope.
137
+ *
138
+ * @default true for modules and commonjs, otherwise false
139
+ */
140
+ toplevel?: boolean;
141
+ /**
142
+ * Preserve `name` property for functions and classes.
143
+ *
144
+ * @default false
145
+ */
146
+ keepNames?: boolean | MangleOptionsKeepNames;
147
+ /** Debug mangled names. */
148
+ debug?: boolean;
149
+ }
150
+
151
+ export interface MangleOptionsKeepNames {
152
+ /**
153
+ * Preserve `name` property for functions.
154
+ *
155
+ * @default false
156
+ */
157
+ function: boolean;
158
+ /**
159
+ * Preserve `name` property for classes.
160
+ *
161
+ * @default false
162
+ */
163
+ class: boolean;
164
+ }
165
+
166
+ /**
167
+ * Minify asynchronously.
168
+ *
169
+ * Note: This function can be slower than `minifySync` due to the overhead of spawning a thread.
170
+ */
171
+ export declare function minify(
172
+ filename: string,
173
+ sourceText: string,
174
+ options?: MinifyOptions | undefined | null,
175
+ ): Promise<MinifyResult>;
176
+
177
+ export interface MinifyOptions {
178
+ /** Use when minifying an ES module. */
179
+ module?: boolean;
180
+ compress?: boolean | CompressOptions;
181
+ mangle?: boolean | MangleOptions;
182
+ codegen?: boolean | CodegenOptions;
183
+ sourcemap?: boolean;
184
+ }
185
+
186
+ export interface MinifyResult {
187
+ code: string;
188
+ map?: SourceMap;
189
+ errors: Array<OxcError>;
190
+ /**
191
+ * Legal comments extracted from the source code.
192
+ * Only populated when `codegen.legalComments` is `"linked"` or `"external"`.
193
+ */
194
+ legalComments: Array<string>;
195
+ }
196
+
197
+ /** Minify synchronously. */
198
+ export declare function minifySync(
199
+ filename: string,
200
+ sourceText: string,
201
+ options?: MinifyOptions | undefined | null,
202
+ ): MinifyResult;
203
+
204
+ export interface TreeShakeOptions {
205
+ /**
206
+ * Whether to respect the pure annotations.
207
+ *
208
+ * Pure annotations are comments that mark an expression as pure.
209
+ * For example: @__PURE__ or #__NO_SIDE_EFFECTS__.
210
+ *
211
+ * @default true
212
+ */
213
+ annotations?: boolean;
214
+ /**
215
+ * Whether to treat this function call as pure.
216
+ *
217
+ * This function is called for normal function calls, new calls, and
218
+ * tagged template calls.
219
+ */
220
+ manualPureFunctions?: Array<string>;
221
+ /**
222
+ * Whether property read accesses have side effects.
223
+ *
224
+ * @default 'always'
225
+ */
226
+ propertyReadSideEffects?: boolean | 'always';
227
+ /**
228
+ * Whether property write accesses (assignments to member expressions) have side effects.
229
+ *
230
+ * When false, assignments like `obj.prop = value` are considered side-effect-free
231
+ * (assuming the object and value expressions themselves are side-effect-free).
232
+ *
233
+ * @default true
234
+ */
235
+ propertyWriteSideEffects?: boolean;
236
+ /**
237
+ * Whether accessing a global variable has side effects.
238
+ *
239
+ * Accessing a non-existing global variable will throw an error.
240
+ * Global variable may be a getter that has side effects.
241
+ *
242
+ * @default true
243
+ */
244
+ unknownGlobalSideEffects?: boolean;
245
+ /**
246
+ * Whether invalid import statements have side effects.
247
+ *
248
+ * Accessing a non-existing import name will throw an error.
249
+ * Also import statements that cannot be resolved will throw an error.
250
+ *
251
+ * @default true
252
+ */
253
+ invalidImportSideEffects?: boolean;
254
+ }
255
+ export interface Comment {
256
+ type: 'Line' | 'Block';
257
+ value: string;
258
+ start: number;
259
+ end: number;
260
+ }
261
+
262
+ export interface ErrorLabel {
263
+ message: string | null;
264
+ start: number;
265
+ end: number;
266
+ }
267
+
268
+ export interface OxcError {
269
+ severity: Severity;
270
+ message: string;
271
+ labels: Array<ErrorLabel>;
272
+ helpMessage: string | null;
273
+ codeframe: string | null;
274
+ }
275
+
276
+ export declare const enum Severity {
277
+ Error = 'Error',
278
+ Warning = 'Warning',
279
+ Advice = 'Advice',
280
+ }
281
+ export declare class ParseResult {
282
+ get program(): import('@oxc-project/types').Program;
283
+ get module(): EcmaScriptModule;
284
+ get comments(): Array<Comment>;
285
+ get errors(): Array<OxcError>;
286
+ }
287
+
288
+ export interface DynamicImport {
289
+ start: number;
290
+ end: number;
291
+ moduleRequest: Span;
292
+ }
293
+
294
+ export interface EcmaScriptModule {
295
+ /**
296
+ * Has ESM syntax.
297
+ *
298
+ * i.e. `import` and `export` statements, and `import.meta`.
299
+ *
300
+ * Dynamic imports `import('foo')` are ignored since they can be used in non-ESM files.
301
+ */
302
+ hasModuleSyntax: boolean;
303
+ /** Import statements. */
304
+ staticImports: Array<StaticImport>;
305
+ /** Export statements. */
306
+ staticExports: Array<StaticExport>;
307
+ /** Dynamic import expressions. */
308
+ dynamicImports: Array<DynamicImport>;
309
+ /** Span positions` of `import.meta` */
310
+ importMetas: Array<Span>;
311
+ }
312
+
313
+ export interface ExportExportName {
314
+ kind: ExportExportNameKind;
315
+ name: string | null;
316
+ start: number | null;
317
+ end: number | null;
318
+ }
319
+
320
+ export declare const enum ExportExportNameKind {
321
+ /** `export { name } */
322
+ Name = 'Name',
323
+ /** `export default expression` */
324
+ Default = 'Default',
325
+ /** `export * from "mod" */
326
+ None = 'None',
327
+ }
328
+
329
+ export interface ExportImportName {
330
+ kind: ExportImportNameKind;
331
+ name: string | null;
332
+ start: number | null;
333
+ end: number | null;
334
+ }
335
+
336
+ export declare const enum ExportImportNameKind {
337
+ /** `export { name } */
338
+ Name = 'Name',
339
+ /** `export * as ns from "mod"` */
340
+ All = 'All',
341
+ /** `export * from "mod"` */
342
+ AllButDefault = 'AllButDefault',
343
+ /** Does not have a specifier. */
344
+ None = 'None',
345
+ }
346
+
347
+ export interface ExportLocalName {
348
+ kind: ExportLocalNameKind;
349
+ name: string | null;
350
+ start: number | null;
351
+ end: number | null;
352
+ }
353
+
354
+ export declare const enum ExportLocalNameKind {
355
+ /** `export { name } */
356
+ Name = 'Name',
357
+ /** `export default expression` */
358
+ Default = 'Default',
359
+ /**
360
+ * If the exported value is not locally accessible from within the module.
361
+ * `export default function () {}`
362
+ */
363
+ None = 'None',
364
+ }
365
+
366
+ export interface ImportName {
367
+ kind: ImportNameKind;
368
+ name: string | null;
369
+ start: number | null;
370
+ end: number | null;
371
+ }
372
+
373
+ export declare const enum ImportNameKind {
374
+ /** `import { x } from "mod"` */
375
+ Name = 'Name',
376
+ /** `import * as ns from "mod"` */
377
+ NamespaceObject = 'NamespaceObject',
378
+ /** `import defaultExport from "mod"` */
379
+ Default = 'Default',
380
+ }
381
+
382
+ /**
383
+ * Parse JS/TS source asynchronously on a separate thread.
384
+ *
385
+ * Note that not all of the workload can happen on a separate thread.
386
+ * Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
387
+ * has to happen on current thread. This synchronous deserialization work typically outweighs
388
+ * the asynchronous parsing by a factor of between 3 and 20.
389
+ *
390
+ * i.e. the majority of the workload cannot be parallelized by using this method.
391
+ *
392
+ * Generally `parseSync` is preferable to use as it does not have the overhead of spawning a thread.
393
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads.
394
+ */
395
+ export declare function parse(
396
+ filename: string,
397
+ sourceText: string,
398
+ options?: ParserOptions | undefined | null,
399
+ ): Promise<ParseResult>;
400
+
401
+ export interface ParserOptions {
402
+ /** Treat the source text as `js`, `jsx`, `ts`, `tsx` or `dts`. */
403
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
404
+ /** Treat the source text as `script` or `module` code. */
405
+ sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined;
406
+ /**
407
+ * Return an AST which includes TypeScript-related properties, or excludes them.
408
+ *
409
+ * `'js'` is default for JS / JSX files.
410
+ * `'ts'` is default for TS / TSX files.
411
+ * The type of the file is determined from `lang` option, or extension of provided `filename`.
412
+ */
413
+ astType?: 'js' | 'ts';
414
+ /**
415
+ * Controls whether the `range` property is included on AST nodes.
416
+ * The `range` property is a `[number, number]` which indicates the start/end offsets
417
+ * of the node in the file contents.
418
+ *
419
+ * @default false
420
+ */
421
+ range?: boolean;
422
+ /**
423
+ * Emit `ParenthesizedExpression` and `TSParenthesizedType` in AST.
424
+ *
425
+ * If this option is true, parenthesized expressions are represented by
426
+ * (non-standard) `ParenthesizedExpression` and `TSParenthesizedType` nodes that
427
+ * have a single `expression` property containing the expression inside parentheses.
428
+ *
429
+ * @default true
430
+ */
431
+ preserveParens?: boolean;
432
+ /**
433
+ * Produce semantic errors with an additional AST pass.
434
+ * Semantic errors depend on symbols and scopes, where the parser does not construct.
435
+ * This adds a small performance overhead.
436
+ *
437
+ * @default false
438
+ */
439
+ showSemanticErrors?: boolean;
440
+ }
441
+
442
+ /**
443
+ * Parse JS/TS source synchronously on current thread.
444
+ *
445
+ * This is generally preferable over `parse` (async) as it does not have the overhead
446
+ * of spawning a thread, and the majority of the workload cannot be parallelized anyway
447
+ * (see `parse` documentation for details).
448
+ *
449
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads
450
+ * with `parseSync` rather than using `parse`.
451
+ */
452
+ export declare function parseSync(
453
+ filename: string,
454
+ sourceText: string,
455
+ options?: ParserOptions | undefined | null,
456
+ ): ParseResult;
457
+
458
+ /** Returns `true` if raw transfer is supported on this platform. */
459
+ export declare function rawTransferSupported(): boolean;
460
+
461
+ export interface Span {
462
+ start: number;
463
+ end: number;
464
+ }
465
+
466
+ export interface StaticExport {
467
+ start: number;
468
+ end: number;
469
+ entries: Array<StaticExportEntry>;
470
+ }
471
+
472
+ export interface StaticExportEntry {
473
+ start: number;
474
+ end: number;
475
+ moduleRequest: ValueSpan | null;
476
+ /** The name under which the desired binding is exported by the module`. */
477
+ importName: ExportImportName;
478
+ /** The name used to export this binding by this module. */
479
+ exportName: ExportExportName;
480
+ /** The name that is used to locally access the exported value from within the importing module. */
481
+ localName: ExportLocalName;
482
+ /**
483
+ * Whether the export is a TypeScript `export type`.
484
+ *
485
+ * Examples:
486
+ *
487
+ * ```ts
488
+ * export type * from 'mod';
489
+ * export type * as ns from 'mod';
490
+ * export type { foo };
491
+ * export { type foo }:
492
+ * export type { foo } from 'mod';
493
+ * ```
494
+ */
495
+ isType: boolean;
496
+ }
497
+
498
+ export interface StaticImport {
499
+ /** Start of import statement. */
500
+ start: number;
501
+ /** End of import statement. */
502
+ end: number;
503
+ /**
504
+ * Import source.
505
+ *
506
+ * ```js
507
+ * import { foo } from "mod";
508
+ * // ^^^
509
+ * ```
510
+ */
511
+ moduleRequest: ValueSpan;
512
+ /**
513
+ * Import specifiers.
514
+ *
515
+ * Empty for `import "mod"`.
516
+ */
517
+ entries: Array<StaticImportEntry>;
518
+ }
519
+
520
+ export interface StaticImportEntry {
521
+ /**
522
+ * The name under which the desired binding is exported by the module.
523
+ *
524
+ * ```js
525
+ * import { foo } from "mod";
526
+ * // ^^^
527
+ * import { foo as bar } from "mod";
528
+ * // ^^^
529
+ * ```
530
+ */
531
+ importName: ImportName;
532
+ /**
533
+ * The name that is used to locally access the imported value from within the importing module.
534
+ * ```js
535
+ * import { foo } from "mod";
536
+ * // ^^^
537
+ * import { foo as bar } from "mod";
538
+ * // ^^^
539
+ * ```
540
+ */
541
+ localName: ValueSpan;
542
+ /**
543
+ * Whether this binding is for a TypeScript type-only import.
544
+ *
545
+ * `true` for the following imports:
546
+ * ```ts
547
+ * import type { foo } from "mod";
548
+ * import { type foo } from "mod";
549
+ * ```
550
+ */
551
+ isType: boolean;
552
+ }
553
+
554
+ export interface ValueSpan {
555
+ value: string;
556
+ start: number;
557
+ end: number;
558
+ }
559
+ export declare class ResolverFactory {
560
+ constructor(options?: NapiResolveOptions | undefined | null);
561
+ static default(): ResolverFactory;
562
+ /** Clone the resolver using the same underlying cache. */
563
+ cloneWithOptions(options: NapiResolveOptions): ResolverFactory;
564
+ /**
565
+ * Clear the underlying cache.
566
+ *
567
+ * Warning: The caller must ensure that there're no ongoing resolution operations when calling this method. Otherwise, it may cause those operations to return an incorrect result.
568
+ */
569
+ clearCache(): void;
570
+ /** Synchronously resolve `specifier` at an absolute path to a `directory`. */
571
+ sync(directory: string, request: string): ResolveResult;
572
+ /** Asynchronously resolve `specifier` at an absolute path to a `directory`. */
573
+ async(directory: string, request: string): Promise<ResolveResult>;
574
+ /**
575
+ * Synchronously resolve `specifier` at an absolute path to a `file`.
576
+ *
577
+ * This method automatically discovers tsconfig.json by traversing parent directories.
578
+ */
579
+ resolveFileSync(file: string, request: string): ResolveResult;
580
+ /**
581
+ * Asynchronously resolve `specifier` at an absolute path to a `file`.
582
+ *
583
+ * This method automatically discovers tsconfig.json by traversing parent directories.
584
+ */
585
+ resolveFileAsync(file: string, request: string): Promise<ResolveResult>;
586
+ /**
587
+ * Synchronously resolve `specifier` for TypeScript declaration files.
588
+ *
589
+ * `file` is the absolute path to the containing file.
590
+ * Uses TypeScript's `moduleResolution: "bundler"` algorithm.
591
+ */
592
+ resolveDtsSync(file: string, request: string): ResolveResult;
593
+ /**
594
+ * Asynchronously resolve `specifier` for TypeScript declaration files.
595
+ *
596
+ * `file` is the absolute path to the containing file.
597
+ * Uses TypeScript's `moduleResolution: "bundler"` algorithm.
598
+ */
599
+ resolveDtsAsync(file: string, request: string): Promise<ResolveResult>;
600
+ }
601
+
602
+ /** Node.js builtin module when `Options::builtin_modules` is enabled. */
603
+ export interface Builtin {
604
+ /**
605
+ * Resolved module.
606
+ *
607
+ * Always prefixed with "node:" in compliance with the ESM specification.
608
+ */
609
+ resolved: string;
610
+ /**
611
+ * Whether the request was prefixed with `node:` or not.
612
+ * `fs` -> `false`.
613
+ * `node:fs` returns `true`.
614
+ */
615
+ isRuntimeModule: boolean;
616
+ }
617
+
618
+ export declare const enum EnforceExtension {
619
+ Auto = 0,
620
+ Enabled = 1,
621
+ Disabled = 2,
622
+ }
623
+
624
+ export declare const enum ModuleType {
625
+ Module = 'module',
626
+ CommonJs = 'commonjs',
627
+ Json = 'json',
628
+ Wasm = 'wasm',
629
+ Addon = 'addon',
630
+ }
631
+
632
+ /**
633
+ * Module Resolution Options
634
+ *
635
+ * Options are directly ported from [enhanced-resolve](https://github.com/webpack/enhanced-resolve#resolver-options).
636
+ *
637
+ * See [webpack resolve](https://webpack.js.org/configuration/resolve/) for information and examples
638
+ */
639
+ export interface NapiResolveOptions {
640
+ /**
641
+ * Discover tsconfig automatically or use the specified tsconfig.json path.
642
+ *
643
+ * Default `None`
644
+ */
645
+ tsconfig?: 'auto' | TsconfigOptions;
646
+ /**
647
+ * Alias for [ResolveOptions::alias] and [ResolveOptions::fallback].
648
+ *
649
+ * For the second value of the tuple, `None -> AliasValue::Ignore`, Some(String) ->
650
+ * AliasValue::Path(String)`
651
+ * Create aliases to import or require certain modules more easily.
652
+ * A trailing $ can also be added to the given object's keys to signify an exact match.
653
+ * Default `{}`
654
+ */
655
+ alias?: Record<string, Array<string | undefined | null>>;
656
+ /**
657
+ * A list of alias fields in description files.
658
+ * Specify a field, such as `browser`, to be parsed according to [this specification](https://github.com/defunctzombie/package-browser-field-spec).
659
+ * Can be a path to json object such as `["path", "to", "exports"]`.
660
+ *
661
+ * Default `[]`
662
+ */
663
+ aliasFields?: (string | string[])[];
664
+ /**
665
+ * Condition names for exports field which defines entry points of a package.
666
+ * The key order in the exports field is significant. During condition matching, earlier entries have higher priority and take precedence over later entries.
667
+ *
668
+ * Default `[]`
669
+ */
670
+ conditionNames?: Array<string>;
671
+ /**
672
+ * If true, it will not allow extension-less files.
673
+ * So by default `require('./foo')` works if `./foo` has a `.js` extension,
674
+ * but with this enabled only `require('./foo.js')` will work.
675
+ *
676
+ * Default to `true` when [ResolveOptions::extensions] contains an empty string.
677
+ * Use `Some(false)` to disable the behavior.
678
+ * See <https://github.com/webpack/enhanced-resolve/pull/285>
679
+ *
680
+ * Default None, which is the same as `Some(false)` when the above empty rule is not applied.
681
+ */
682
+ enforceExtension?: EnforceExtension;
683
+ /**
684
+ * A list of exports fields in description files.
685
+ * Can be a path to json object such as `["path", "to", "exports"]`.
686
+ *
687
+ * Default `[["exports"]]`.
688
+ */
689
+ exportsFields?: (string | string[])[];
690
+ /**
691
+ * Fields from `package.json` which are used to provide the internal requests of a package
692
+ * (requests starting with # are considered internal).
693
+ *
694
+ * Can be a path to a JSON object such as `["path", "to", "imports"]`.
695
+ *
696
+ * Default `[["imports"]]`.
697
+ */
698
+ importsFields?: (string | string[])[];
699
+ /**
700
+ * An object which maps extension to extension aliases.
701
+ *
702
+ * Default `{}`
703
+ */
704
+ extensionAlias?: Record<string, Array<string>>;
705
+ /**
706
+ * Attempt to resolve these extensions in order.
707
+ * If multiple files share the same name but have different extensions,
708
+ * will resolve the one with the extension listed first in the array and skip the rest.
709
+ *
710
+ * Default `[".js", ".json", ".node"]`
711
+ */
712
+ extensions?: Array<string>;
713
+ /**
714
+ * Redirect module requests when normal resolving fails.
715
+ *
716
+ * Default `{}`
717
+ */
718
+ fallback?: Record<string, Array<string | undefined | null>>;
719
+ /**
720
+ * 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).
721
+ *
722
+ * See also webpack configuration [resolve.fullySpecified](https://webpack.js.org/configuration/module/#resolvefullyspecified)
723
+ *
724
+ * Default `false`
725
+ */
726
+ fullySpecified?: boolean;
727
+ /**
728
+ * A list of main fields in description files
729
+ *
730
+ * Default `["main"]`.
731
+ */
732
+ mainFields?: string | string[];
733
+ /**
734
+ * The filename to be used while resolving directories.
735
+ *
736
+ * Default `["index"]`
737
+ */
738
+ mainFiles?: Array<string>;
739
+ /**
740
+ * A list of directories to resolve modules from, can be absolute path or folder name.
741
+ *
742
+ * Default `["node_modules"]`
743
+ */
744
+ modules?: string | string[];
745
+ /**
746
+ * Resolve to a context instead of a file.
747
+ *
748
+ * Default `false`
749
+ */
750
+ resolveToContext?: boolean;
751
+ /**
752
+ * Prefer to resolve module requests as relative requests instead of using modules from node_modules directories.
753
+ *
754
+ * Default `false`
755
+ */
756
+ preferRelative?: boolean;
757
+ /**
758
+ * Prefer to resolve server-relative urls as absolute paths before falling back to resolve in ResolveOptions::roots.
759
+ *
760
+ * Default `false`
761
+ */
762
+ preferAbsolute?: boolean;
763
+ /**
764
+ * A list of resolve restrictions to restrict the paths that a request can be resolved on.
765
+ *
766
+ * Default `[]`
767
+ */
768
+ restrictions?: Array<Restriction>;
769
+ /**
770
+ * A list of directories where requests of server-relative URLs (starting with '/') are resolved.
771
+ * On non-Windows systems these requests are resolved as an absolute path first.
772
+ *
773
+ * Default `[]`
774
+ */
775
+ roots?: Array<string>;
776
+ /**
777
+ * Whether to resolve symlinks to their symlinked location.
778
+ * When enabled, symlinked resources are resolved to their real path, not their symlinked location.
779
+ * Note that this may cause module resolution to fail when using tools that symlink packages (like npm link).
780
+ *
781
+ * Default `true`
782
+ */
783
+ symlinks?: boolean;
784
+ /**
785
+ * Whether to read the `NODE_PATH` environment variable and append its entries to `modules`.
786
+ *
787
+ * `NODE_PATH` is a deprecated Node.js feature that is not part of ESM resolution.
788
+ * Set this to `false` to disable the behavior.
789
+ *
790
+ * Default `true`
791
+ */
792
+ nodePath?: boolean;
793
+ /**
794
+ * Whether to parse [module.builtinModules](https://nodejs.org/api/module.html#modulebuiltinmodules) or not.
795
+ * For example, "zlib" will throw [crate::ResolveError::Builtin] when set to true.
796
+ *
797
+ * Default `false`
798
+ */
799
+ builtinModules?: boolean;
800
+ /**
801
+ * Resolve [ResolveResult::moduleType].
802
+ *
803
+ * Default `false`
804
+ */
805
+ moduleType?: boolean;
806
+ /**
807
+ * Allow `exports` field in `require('../directory')`.
808
+ *
809
+ * This is not part of the spec but some vite projects rely on this behavior.
810
+ * See
811
+ * * <https://github.com/vitejs/vite/pull/20252>
812
+ * * <https://github.com/nodejs/node/issues/58827>
813
+ *
814
+ * Default: `false`
815
+ */
816
+ allowPackageExportsInDirectoryResolve?: boolean;
817
+ }
818
+
819
+ export interface ResolveResult {
820
+ path?: string;
821
+ error?: string;
822
+ builtin?: Builtin;
823
+ /**
824
+ * Module type for this path.
825
+ *
826
+ * Enable with `ResolveOptions#moduleType`.
827
+ *
828
+ * 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).
829
+ *
830
+ * The algorithm uses the file extension or finds the closest `package.json` with the `type` field.
831
+ */
832
+ moduleType?: ModuleType;
833
+ /** `package.json` path for the given module. */
834
+ packageJsonPath?: string;
835
+ }
836
+
837
+ /**
838
+ * Alias Value for [ResolveOptions::alias] and [ResolveOptions::fallback].
839
+ * Use struct because napi don't support structured union now
840
+ */
841
+ export interface Restriction {
842
+ path?: string;
843
+ regex?: string;
844
+ }
845
+
846
+ export declare function sync(path: string, request: string): ResolveResult;
847
+
848
+ /**
849
+ * Tsconfig Options
850
+ *
851
+ * Derived from [tsconfig-paths-webpack-plugin](https://github.com/dividab/tsconfig-paths-webpack-plugin#options)
852
+ */
853
+ export interface TsconfigOptions {
854
+ /**
855
+ * Allows you to specify where to find the TypeScript configuration file.
856
+ * You may provide
857
+ * * a relative path to the configuration file. It will be resolved relative to cwd.
858
+ * * an absolute path to the configuration file.
859
+ */
860
+ configFile: string;
861
+ /**
862
+ * Support for Typescript Project References.
863
+ *
864
+ * * `'auto'`: use the `references` field from tsconfig of `config_file`.
865
+ */
866
+ references?: 'auto';
867
+ }
868
+ export interface SourceMap {
869
+ file?: string;
870
+ mappings: string;
871
+ names: Array<string>;
872
+ sourceRoot?: string;
873
+ sources: Array<string>;
874
+ sourcesContent?: Array<string>;
875
+ version: number;
876
+ x_google_ignoreList?: Array<number>;
877
+ }
878
+ export interface ArrowFunctionsOptions {
879
+ /**
880
+ * This option enables the following:
881
+ * * Wrap the generated function in .bind(this) and keeps uses of this inside the function as-is, instead of using a renamed this.
882
+ * * Add a runtime check to ensure the functions are not instantiated.
883
+ * * Add names to arrow functions.
884
+ *
885
+ * @default false
886
+ */
887
+ spec?: boolean;
888
+ }
889
+
890
+ export interface CompilerAssumptions {
891
+ ignoreFunctionLength?: boolean;
892
+ noDocumentAll?: boolean;
893
+ objectRestNoSymbols?: boolean;
894
+ pureGetters?: boolean;
895
+ /**
896
+ * When using public class fields, assume that they don't shadow any getter in the current class,
897
+ * in its subclasses or in its superclass. Thus, it's safe to assign them rather than using
898
+ * `Object.defineProperty`.
899
+ *
900
+ * For example:
901
+ *
902
+ * Input:
903
+ * ```js
904
+ * class Test {
905
+ * field = 2;
906
+ *
907
+ * static staticField = 3;
908
+ * }
909
+ * ```
910
+ *
911
+ * When `set_public_class_fields` is `true`, the output will be:
912
+ * ```js
913
+ * class Test {
914
+ * constructor() {
915
+ * this.field = 2;
916
+ * }
917
+ * }
918
+ * Test.staticField = 3;
919
+ * ```
920
+ *
921
+ * Otherwise, the output will be:
922
+ * ```js
923
+ * import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
924
+ * class Test {
925
+ * constructor() {
926
+ * _defineProperty(this, "field", 2);
927
+ * }
928
+ * }
929
+ * _defineProperty(Test, "staticField", 3);
930
+ * ```
931
+ *
932
+ * NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should
933
+ * set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`]
934
+ * to `true`.
935
+ */
936
+ setPublicClassFields?: boolean;
937
+ }
938
+
939
+ export interface DecoratorOptions {
940
+ /**
941
+ * Enables experimental support for decorators, which is a version of decorators that predates the TC39 standardization process.
942
+ *
943
+ * Decorators are a language feature which hasn’t yet been fully ratified into the JavaScript specification.
944
+ * This means that the implementation version in TypeScript may differ from the implementation in JavaScript when it it decided by TC39.
945
+ *
946
+ * @see https://www.typescriptlang.org/tsconfig/#experimentalDecorators
947
+ * @default false
948
+ */
949
+ legacy?: boolean;
950
+ /**
951
+ * Enables emitting decorator metadata.
952
+ *
953
+ * This option the same as [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata)
954
+ * in TypeScript, and it only works when `legacy` is true.
955
+ *
956
+ * @see https://www.typescriptlang.org/tsconfig/#emitDecoratorMetadata
957
+ * @default false
958
+ */
959
+ emitDecoratorMetadata?: boolean;
960
+ /**
961
+ * Aligns nullable-union `design:type` emission with `--strictNullChecks`.
962
+ *
963
+ * When `true` (default), `T | null` and `T | undefined` emit `Object`, matching tsc strict.
964
+ * When `false`, `null` and `undefined` are elided from the union so the underlying
965
+ * primitive constructor is emitted, matching tsc with `--strictNullChecks=false`
966
+ * and `babel-plugin-transform-typescript-metadata`.
967
+ *
968
+ * @see https://www.typescriptlang.org/tsconfig/#strictNullChecks
969
+ * @default true
970
+ */
971
+ strictNullChecks?: boolean;
972
+ }
973
+
974
+ export interface Es2015Options {
975
+ /** Transform arrow functions into function expressions. */
976
+ arrowFunction?: ArrowFunctionsOptions;
977
+ }
978
+
979
+ export declare const enum HelperMode {
980
+ /**
981
+ * Runtime mode (default): Helper functions are imported from a runtime package.
982
+ *
983
+ * Example:
984
+ *
985
+ * ```js
986
+ * import helperName from "@oxc-project/runtime/helpers/helperName";
987
+ * helperName(...arguments);
988
+ * ```
989
+ */
990
+ Runtime = 'Runtime',
991
+ /**
992
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
993
+ *
994
+ * Example:
995
+ *
996
+ * ```js
997
+ * babelHelpers.helperName(...arguments);
998
+ * ```
999
+ */
1000
+ External = 'External',
1001
+ }
1002
+
1003
+ export interface Helpers {
1004
+ mode?: HelperMode;
1005
+ }
1006
+
1007
+ /**
1008
+ * TypeScript Isolated Declarations for Standalone DTS Emit (async)
1009
+ *
1010
+ * Note: This function can be slower than `isolatedDeclarationSync` due to the overhead of spawning a thread.
1011
+ */
1012
+ export declare function isolatedDeclaration(
1013
+ filename: string,
1014
+ sourceText: string,
1015
+ options?: IsolatedDeclarationsOptions | undefined | null,
1016
+ ): Promise<IsolatedDeclarationsResult>;
1017
+
1018
+ export interface IsolatedDeclarationsOptions {
1019
+ /**
1020
+ * Do not emit declarations for code that has an @internal annotation in its JSDoc comment.
1021
+ * This is an internal compiler option; use at your own risk, because the compiler does not check that the result is valid.
1022
+ *
1023
+ * Default: `false`
1024
+ *
1025
+ * See <https://www.typescriptlang.org/tsconfig/#stripInternal>
1026
+ */
1027
+ stripInternal?: boolean;
1028
+ sourcemap?: boolean;
1029
+ }
1030
+
1031
+ export interface IsolatedDeclarationsResult {
1032
+ code: string;
1033
+ map?: SourceMap;
1034
+ errors: Array<OxcError>;
1035
+ }
1036
+
1037
+ /** TypeScript Isolated Declarations for Standalone DTS Emit */
1038
+ export declare function isolatedDeclarationSync(
1039
+ filename: string,
1040
+ sourceText: string,
1041
+ options?: IsolatedDeclarationsOptions | undefined | null,
1042
+ ): IsolatedDeclarationsResult;
1043
+
1044
+ /**
1045
+ * Configure how TSX and JSX are transformed.
1046
+ *
1047
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
1048
+ */
1049
+ export interface JsxOptions {
1050
+ /**
1051
+ * Decides which runtime to use.
1052
+ *
1053
+ * - 'automatic' - auto-import the correct JSX factories
1054
+ * - 'classic' - no auto-import
1055
+ *
1056
+ * @default 'automatic'
1057
+ */
1058
+ runtime?: 'classic' | 'automatic';
1059
+ /**
1060
+ * Emit development-specific information, such as `__source` and `__self`.
1061
+ *
1062
+ * @default false
1063
+ */
1064
+ development?: boolean;
1065
+ /**
1066
+ * Toggles whether or not to throw an error if an XML namespaced tag name
1067
+ * is used.
1068
+ *
1069
+ * Though the JSX spec allows this, it is disabled by default since React's
1070
+ * JSX does not currently have support for it.
1071
+ *
1072
+ * @default true
1073
+ */
1074
+ throwIfNamespace?: boolean;
1075
+ /**
1076
+ * Mark JSX elements and top-level React method calls as pure for tree shaking.
1077
+ *
1078
+ * @default true
1079
+ */
1080
+ pure?: boolean;
1081
+ /**
1082
+ * Replaces the import source when importing functions.
1083
+ *
1084
+ * @default 'react'
1085
+ */
1086
+ importSource?: string;
1087
+ /**
1088
+ * Replace the function used when compiling JSX expressions. It should be a
1089
+ * qualified name (e.g. `React.createElement`) or an identifier (e.g.
1090
+ * `createElement`).
1091
+ *
1092
+ * Only used for `classic` {@link runtime}.
1093
+ *
1094
+ * @default 'React.createElement'
1095
+ */
1096
+ pragma?: string;
1097
+ /**
1098
+ * Replace the component used when compiling JSX fragments. It should be a
1099
+ * valid JSX tag name.
1100
+ *
1101
+ * Only used for `classic` {@link runtime}.
1102
+ *
1103
+ * @default 'React.Fragment'
1104
+ */
1105
+ pragmaFrag?: string;
1106
+ /**
1107
+ * Enable React Fast Refresh .
1108
+ *
1109
+ * Conforms to the implementation in {@link https://github.com/facebook/react/tree/v18.3.1/packages/react-refresh}
1110
+ *
1111
+ * @default false
1112
+ */
1113
+ refresh?: boolean | ReactRefreshOptions;
1114
+ }
1115
+
1116
+ /**
1117
+ * Transform JavaScript code to a Vite Node runnable module.
1118
+ *
1119
+ * @param filename The name of the file being transformed.
1120
+ * @param sourceText the source code itself
1121
+ * @param options The options for the transformation. See {@link
1122
+ * ModuleRunnerTransformOptions} for more information.
1123
+ *
1124
+ * @returns an object containing the transformed code, source maps, and any
1125
+ * errors that occurred during parsing or transformation.
1126
+ *
1127
+ * Note: This function can be slower than `moduleRunnerTransformSync` due to the overhead of spawning a thread.
1128
+ *
1129
+ * @deprecated Only works for Vite.
1130
+ */
1131
+ export declare function moduleRunnerTransform(
1132
+ filename: string,
1133
+ sourceText: string,
1134
+ options?: ModuleRunnerTransformOptions | undefined | null,
1135
+ ): Promise<ModuleRunnerTransformResult>;
1136
+
1137
+ export interface ModuleRunnerTransformOptions {
1138
+ /**
1139
+ * Enable source map generation.
1140
+ *
1141
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
1142
+ *
1143
+ * @default false
1144
+ *
1145
+ * @see {@link SourceMap}
1146
+ */
1147
+ sourcemap?: boolean;
1148
+ }
1149
+
1150
+ export interface ModuleRunnerTransformResult {
1151
+ /**
1152
+ * The transformed code.
1153
+ *
1154
+ * If parsing failed, this will be an empty string.
1155
+ */
1156
+ code: string;
1157
+ /**
1158
+ * The source map for the transformed code.
1159
+ *
1160
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
1161
+ */
1162
+ map?: SourceMap;
1163
+ deps: Array<string>;
1164
+ dynamicDeps: Array<string>;
1165
+ /**
1166
+ * Parse and transformation errors.
1167
+ *
1168
+ * Oxc's parser recovers from common syntax errors, meaning that
1169
+ * transformed code may still be available even if there are errors in this
1170
+ * list.
1171
+ */
1172
+ errors: Array<OxcError>;
1173
+ }
1174
+
1175
+ /** @deprecated Only works for Vite. */
1176
+ export declare function moduleRunnerTransformSync(
1177
+ filename: string,
1178
+ sourceText: string,
1179
+ options?: ModuleRunnerTransformOptions | undefined | null,
1180
+ ): ModuleRunnerTransformResult;
1181
+
1182
+ export interface PluginsOptions {
1183
+ styledComponents?: StyledComponentsOptions;
1184
+ taggedTemplateEscape?: boolean;
1185
+ }
1186
+
1187
+ export interface ReactRefreshOptions {
1188
+ /**
1189
+ * Specify the identifier of the refresh registration variable.
1190
+ *
1191
+ * @default `$RefreshReg$`.
1192
+ */
1193
+ refreshReg?: string;
1194
+ /**
1195
+ * Specify the identifier of the refresh signature variable.
1196
+ *
1197
+ * @default `$RefreshSig$`.
1198
+ */
1199
+ refreshSig?: string;
1200
+ emitFullSignatures?: boolean;
1201
+ }
1202
+
1203
+ /**
1204
+ * Configure how styled-components are transformed.
1205
+ *
1206
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins#styled-components}
1207
+ */
1208
+ export interface StyledComponentsOptions {
1209
+ /**
1210
+ * Enhances the attached CSS class name on each component with richer output to help
1211
+ * identify your components in the DOM without React DevTools.
1212
+ *
1213
+ * @default true
1214
+ */
1215
+ displayName?: boolean;
1216
+ /**
1217
+ * Controls whether the `displayName` of a component will be prefixed with the filename
1218
+ * to make the component name as unique as possible.
1219
+ *
1220
+ * @default true
1221
+ */
1222
+ fileName?: boolean;
1223
+ /**
1224
+ * Adds a unique identifier to every styled component to avoid checksum mismatches
1225
+ * due to different class generation on the client and server during server-side rendering.
1226
+ *
1227
+ * @default true
1228
+ */
1229
+ ssr?: boolean;
1230
+ /**
1231
+ * Transpiles styled-components tagged template literals to a smaller representation
1232
+ * than what Babel normally creates, helping to reduce bundle size.
1233
+ *
1234
+ * @default true
1235
+ */
1236
+ transpileTemplateLiterals?: boolean;
1237
+ /**
1238
+ * Minifies CSS content by removing all whitespace and comments from your CSS,
1239
+ * keeping valuable bytes out of your bundles.
1240
+ *
1241
+ * @default true
1242
+ */
1243
+ minify?: boolean;
1244
+ /**
1245
+ * Enables transformation of JSX `css` prop when using styled-components.
1246
+ *
1247
+ * **Note: This feature is not yet implemented in oxc.**
1248
+ *
1249
+ * @default true
1250
+ */
1251
+ cssProp?: boolean;
1252
+ /**
1253
+ * Enables "pure annotation" to aid dead code elimination by bundlers.
1254
+ *
1255
+ * @default false
1256
+ */
1257
+ pure?: boolean;
1258
+ /**
1259
+ * Adds a namespace prefix to component identifiers to ensure class names are unique.
1260
+ *
1261
+ * Example: With `namespace: "my-app"`, generates `componentId: "my-app__sc-3rfj0a-1"`
1262
+ */
1263
+ namespace?: string;
1264
+ /**
1265
+ * List of file names that are considered meaningless for component naming purposes.
1266
+ *
1267
+ * When the `fileName` option is enabled and a component is in a file with a name
1268
+ * from this list, the directory name will be used instead of the file name for
1269
+ * the component's display name.
1270
+ *
1271
+ * @default `["index"]`
1272
+ */
1273
+ meaninglessFileNames?: Array<string>;
1274
+ /**
1275
+ * Import paths to be considered as styled-components imports at the top level.
1276
+ *
1277
+ * **Note: This feature is not yet implemented in oxc.**
1278
+ */
1279
+ topLevelImportPaths?: Array<string>;
1280
+ }
1281
+
1282
+ /**
1283
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
1284
+ *
1285
+ * Note: This function can be slower than `transform` due to the overhead of spawning a thread.
1286
+ *
1287
+ * @param filename The name of the file being transformed. If this is a
1288
+ * relative path, consider setting the {@link TransformOptions#cwd} option.
1289
+ * @param sourceText the source code itself
1290
+ * @param options The options for the transformation. See {@link
1291
+ * TransformOptions} for more information.
1292
+ *
1293
+ * @returns a promise that resolves to an object containing the transformed code,
1294
+ * source maps, and any errors that occurred during parsing or transformation.
1295
+ */
1296
+ export declare function transform(
1297
+ filename: string,
1298
+ sourceText: string,
1299
+ options?: TransformOptions | undefined | null,
1300
+ ): Promise<TransformResult>;
1301
+
1302
+ /**
1303
+ * Options for transforming a JavaScript or TypeScript file.
1304
+ *
1305
+ * @see {@link transform}
1306
+ */
1307
+ export interface TransformOptions {
1308
+ /** Treat the source text as `js`, `jsx`, `ts`, `tsx`, or `dts`. */
1309
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
1310
+ /** Treat the source text as `script` or `module` code. */
1311
+ sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined;
1312
+ /**
1313
+ * The current working directory. Used to resolve relative paths in other
1314
+ * options.
1315
+ */
1316
+ cwd?: string;
1317
+ /**
1318
+ * Enable source map generation.
1319
+ *
1320
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
1321
+ *
1322
+ * @default false
1323
+ *
1324
+ * @see {@link SourceMap}
1325
+ */
1326
+ sourcemap?: boolean;
1327
+ /** Set assumptions in order to produce smaller output. */
1328
+ assumptions?: CompilerAssumptions;
1329
+ /**
1330
+ * Configure how TypeScript is transformed.
1331
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
1332
+ */
1333
+ typescript?: TypeScriptOptions;
1334
+ /**
1335
+ * Configure how TSX and JSX are transformed.
1336
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
1337
+ */
1338
+ jsx?: 'preserve' | JsxOptions;
1339
+ /**
1340
+ * Sets the target environment for the generated JavaScript.
1341
+ *
1342
+ * The lowest target is `es2015`.
1343
+ *
1344
+ * Example:
1345
+ *
1346
+ * * `'es2015'`
1347
+ * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
1348
+ *
1349
+ * @default `esnext` (No transformation)
1350
+ *
1351
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target}
1352
+ */
1353
+ target?: string | Array<string>;
1354
+ /** Behaviour for runtime helpers. */
1355
+ helpers?: Helpers;
1356
+ /**
1357
+ * Define Plugin
1358
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
1359
+ */
1360
+ define?: Record<string, string>;
1361
+ /**
1362
+ * Inject Plugin
1363
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
1364
+ */
1365
+ inject?: Record<string, string | [string, string]>;
1366
+ /** Decorator plugin */
1367
+ decorator?: DecoratorOptions;
1368
+ /**
1369
+ * Third-party plugins to use.
1370
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
1371
+ */
1372
+ plugins?: PluginsOptions;
1373
+ }
1374
+
1375
+ export interface TransformResult {
1376
+ /**
1377
+ * The transformed code.
1378
+ *
1379
+ * If parsing failed, this will be an empty string.
1380
+ */
1381
+ code: string;
1382
+ /**
1383
+ * The source map for the transformed code.
1384
+ *
1385
+ * This will be set if {@link TransformOptions#sourcemap} is `true`.
1386
+ */
1387
+ map?: SourceMap;
1388
+ /**
1389
+ * The `.d.ts` declaration file for the transformed code. Declarations are
1390
+ * only generated if `declaration` is set to `true` and a TypeScript file
1391
+ * is provided.
1392
+ *
1393
+ * If parsing failed and `declaration` is set, this will be an empty string.
1394
+ *
1395
+ * @see {@link TypeScriptOptions#declaration}
1396
+ * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
1397
+ */
1398
+ declaration?: string;
1399
+ /**
1400
+ * Declaration source map. Only generated if both
1401
+ * {@link TypeScriptOptions#declaration declaration} and
1402
+ * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
1403
+ */
1404
+ declarationMap?: SourceMap;
1405
+ /**
1406
+ * Helpers used.
1407
+ *
1408
+ * @internal
1409
+ *
1410
+ * Example:
1411
+ *
1412
+ * ```text
1413
+ * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
1414
+ * ```
1415
+ */
1416
+ helpersUsed: Record<string, string>;
1417
+ /**
1418
+ * Parse and transformation errors.
1419
+ *
1420
+ * Oxc's parser recovers from common syntax errors, meaning that
1421
+ * transformed code may still be available even if there are errors in this
1422
+ * list.
1423
+ */
1424
+ errors: Array<OxcError>;
1425
+ }
1426
+
1427
+ /**
1428
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
1429
+ *
1430
+ * @param filename The name of the file being transformed. If this is a
1431
+ * relative path, consider setting the {@link TransformOptions#cwd} option..
1432
+ * @param sourceText the source code itself
1433
+ * @param options The options for the transformation. See {@link
1434
+ * TransformOptions} for more information.
1435
+ *
1436
+ * @returns an object containing the transformed code, source maps, and any
1437
+ * errors that occurred during parsing or transformation.
1438
+ */
1439
+ export declare function transformSync(
1440
+ filename: string,
1441
+ sourceText: string,
1442
+ options?: TransformOptions | undefined | null,
1443
+ ): TransformResult;
1444
+
1445
+ export interface TypeScriptOptions {
1446
+ jsxPragma?: string;
1447
+ jsxPragmaFrag?: string;
1448
+ onlyRemoveTypeImports?: boolean;
1449
+ allowNamespaces?: boolean;
1450
+ /**
1451
+ * When enabled, type-only class fields are only removed if they are prefixed with the declare modifier:
1452
+ *
1453
+ * @deprecated
1454
+ *
1455
+ * Allowing `declare` fields is built-in support in Oxc without any option. If you want to remove class fields
1456
+ * without initializer, you can use `remove_class_fields_without_initializer: true` instead.
1457
+ */
1458
+ allowDeclareFields?: boolean;
1459
+ /**
1460
+ * When enabled, class fields without initializers are removed.
1461
+ *
1462
+ * For example:
1463
+ * ```ts
1464
+ * class Foo {
1465
+ * x: number;
1466
+ * y: number = 0;
1467
+ * }
1468
+ * ```
1469
+ * // transform into
1470
+ * ```js
1471
+ * class Foo {
1472
+ * x: number;
1473
+ * }
1474
+ * ```
1475
+ *
1476
+ * The option is used to align with the behavior of TypeScript's `useDefineForClassFields: false` option.
1477
+ * When you want to enable this, you also need to set [`crate::CompilerAssumptions::set_public_class_fields`]
1478
+ * to `true`. The `set_public_class_fields: true` + `remove_class_fields_without_initializer: true` is
1479
+ * equivalent to `useDefineForClassFields: false` in TypeScript.
1480
+ *
1481
+ * When `set_public_class_fields` is true and class-properties plugin is enabled, the above example transforms into:
1482
+ *
1483
+ * ```js
1484
+ * class Foo {
1485
+ * constructor() {
1486
+ * this.y = 0;
1487
+ * }
1488
+ * }
1489
+ * ```
1490
+ *
1491
+ * Defaults to `false`.
1492
+ */
1493
+ removeClassFieldsWithoutInitializer?: boolean;
1494
+ /**
1495
+ * When true, optimize const enums by inlining their values at usage sites
1496
+ * and removing the enum declaration.
1497
+ *
1498
+ * @default false
1499
+ */
1500
+ optimizeConstEnums?: boolean;
1501
+ /**
1502
+ * When true, optimize regular (non-const) enums by inlining their member
1503
+ * accesses at usage sites when the member value is statically known.
1504
+ *
1505
+ * Non-exported enum declarations are also removed when all members are
1506
+ * evaluable and no references to the enum as a runtime value exist
1507
+ * (e.g., `console.log(Foo)`, `typeof Foo`, or passing the enum as an argument).
1508
+ *
1509
+ * @default false
1510
+ */
1511
+ optimizeEnums?: boolean;
1512
+ /**
1513
+ * Also generate a `.d.ts` declaration file for TypeScript files.
1514
+ *
1515
+ * The source file must be compliant with all
1516
+ * [`isolatedDeclarations`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
1517
+ * requirements.
1518
+ *
1519
+ * @default false
1520
+ */
1521
+ declaration?: IsolatedDeclarationsOptions;
1522
+ /**
1523
+ * Rewrite or remove TypeScript import/export declaration extensions.
1524
+ *
1525
+ * - When set to `rewrite`, it will change `.ts`, `.mts`, `.cts` extensions to `.js`, `.mjs`, `.cjs` respectively.
1526
+ * - When set to `remove`, it will remove `.ts`/`.mts`/`.cts`/`.tsx` extension entirely.
1527
+ * - When set to `true`, it's equivalent to `rewrite`.
1528
+ * - When set to `false` or omitted, no changes will be made to the extensions.
1529
+ *
1530
+ * @default false
1531
+ */
1532
+ rewriteImportExtensions?: 'rewrite' | 'remove' | boolean;
1533
+ }
1534
+ export declare class BindingBundleEndEventData {
1535
+ output: string;
1536
+ duration: number;
1537
+ get result(): BindingWatcherBundler;
1538
+ }
1539
+
1540
+ export declare class BindingBundleErrorEventData {
1541
+ get result(): BindingWatcherBundler;
1542
+ get error(): Array<BindingError>;
1543
+ }
1544
+
1545
+ export declare class BindingBundler {
1546
+ constructor();
1547
+ generate(options: BindingBundlerOptions): Promise<BindingResult<BindingOutputs>>;
1548
+ write(options: BindingBundlerOptions): Promise<BindingResult<BindingOutputs>>;
1549
+ scan(options: BindingBundlerOptions): Promise<BindingResult<undefined>>;
1550
+ close(): Promise<undefined>;
1551
+ get closed(): boolean;
1552
+ getWatchFiles(): Array<string>;
1553
+ }
1554
+
1555
+ export declare class BindingCallableBuiltinPlugin {
1556
+ constructor(plugin: BindingBuiltinPlugin);
1557
+ getOrder(hookName: string): string | null;
1558
+ resolveId(
1559
+ id: string,
1560
+ importer?: string | undefined | null,
1561
+ options?: BindingHookJsResolveIdOptions | undefined | null,
1562
+ ): Promise<BindingHookJsResolveIdOutput | undefined | null>;
1563
+ load(id: string): Promise<BindingHookJsLoadOutput | undefined | null>;
1564
+ transform(
1565
+ code: string,
1566
+ id: string,
1567
+ options: BindingTransformHookExtraArgs,
1568
+ ): Promise<BindingHookTransformOutput | undefined | null>;
1569
+ watchChange(path: string, event: BindingJsWatchChangeEvent): Promise<undefined>;
1570
+ }
1571
+
1572
+ export declare class BindingChunkingContext {
1573
+ getModuleInfo(moduleId: string): BindingModuleInfo | null;
1574
+ }
1575
+
1576
+ /** A decoded source map with mappings as an array of arrays instead of VLQ-encoded string. */
1577
+ export declare class BindingDecodedMap {
1578
+ /** The source map version (always 3). */
1579
+ get version(): number;
1580
+ /** The generated file name. */
1581
+ get file(): string | null;
1582
+ /** The list of original source files. */
1583
+ get sources(): Array<string>;
1584
+ /** The original source contents (if `includeContent` was true). */
1585
+ get sourcesContent(): Array<string | undefined | null>;
1586
+ /** The list of symbol names used in mappings. */
1587
+ get names(): Array<string>;
1588
+ /**
1589
+ * The decoded mappings as an array of line arrays.
1590
+ * Each line is an array of segments, where each segment is [generatedColumn, sourceIndex, originalLine, originalColumn, nameIndex?].
1591
+ */
1592
+ get mappings(): Array<Array<Array<number>>>;
1593
+ /** The list of source indices that should be excluded from debugging. */
1594
+ get x_google_ignoreList(): Array<number> | null;
1595
+ }
1596
+
1597
+ export declare class BindingDevEngine {
1598
+ constructor(options: BindingBundlerOptions, devOptions?: BindingDevOptions | undefined | null);
1599
+ run(): Promise<void>;
1600
+ ensureCurrentBuildFinish(): Promise<void>;
1601
+ getBundleState(): Promise<BindingBundleState>;
1602
+ ensureLatestBuildOutput(): Promise<void>;
1603
+ triggerFullBuild(): void;
1604
+ invalidate(
1605
+ caller: string,
1606
+ firstInvalidatedBy?: string | undefined | null,
1607
+ ): Promise<Array<BindingClientHmrUpdate>>;
1608
+ registerModules(clientId: string, modules: Array<string>): Promise<void>;
1609
+ removeClient(clientId: string): Promise<void>;
1610
+ close(): Promise<void>;
1611
+ /**
1612
+ * Compile a lazy entry module and return HMR-style patch code.
1613
+ *
1614
+ * This is called when a dynamically imported module is first requested at runtime.
1615
+ * The module was previously stubbed with a proxy, and now we need to compile the
1616
+ * actual module and its dependencies.
1617
+ */
1618
+ compileEntry(moduleId: string, clientId: string): Promise<string>;
1619
+ }
1620
+
1621
+ export declare class BindingLoadPluginContext {
1622
+ inner(): BindingPluginContext;
1623
+ addWatchFile(file: string): void;
1624
+ }
1625
+
1626
+ export declare class BindingMagicString {
1627
+ constructor(source: string, options?: BindingMagicStringOptions | undefined | null);
1628
+ get original(): string;
1629
+ get filename(): string | null;
1630
+ get indentExclusionRanges(): Array<Array<number>> | Array<number> | null;
1631
+ get ignoreList(): boolean;
1632
+ get offset(): number;
1633
+ set offset(offset: number);
1634
+ replace(from: string, to: string): this;
1635
+ replaceAll(from: string, to: string): this;
1636
+ /**
1637
+ * Returns the UTF-16 offset past the last match, or -1 if no match was found.
1638
+ * The JS wrapper uses this to update `lastIndex` on the caller's RegExp.
1639
+ * Global/sticky behavior is derived from the regex's own flags.
1640
+ */
1641
+ replaceRegex(from: RegExp, to: string): number;
1642
+ prepend(content: string): this;
1643
+ append(content: string): this;
1644
+ prependLeft(index: number, content: string): this;
1645
+ prependRight(index: number, content: string): this;
1646
+ appendLeft(index: number, content: string): this;
1647
+ appendRight(index: number, content: string): this;
1648
+ overwrite(
1649
+ start: number,
1650
+ end: number,
1651
+ content: string,
1652
+ options?: BindingOverwriteOptions | undefined | null,
1653
+ ): this;
1654
+ toString(): string;
1655
+ hasChanged(): boolean;
1656
+ length(): number;
1657
+ isEmpty(): boolean;
1658
+ remove(start: number, end: number): this;
1659
+ update(
1660
+ start: number,
1661
+ end: number,
1662
+ content: string,
1663
+ options?: BindingUpdateOptions | undefined | null,
1664
+ ): this;
1665
+ relocate(start: number, end: number, to: number): this;
1666
+ /**
1667
+ * Alias for `relocate` to match the original magic-string API.
1668
+ * Moves the characters from `start` to `end` to `index`.
1669
+ * Returns `this` for method chaining.
1670
+ */
1671
+ move(start: number, end: number, index: number): this;
1672
+ indent(
1673
+ indentor?: string | undefined | null,
1674
+ options?: BindingIndentOptions | undefined | null,
1675
+ ): this;
1676
+ /** Trims whitespace or specified characters from the start and end. */
1677
+ trim(charType?: string | undefined | null): this;
1678
+ /** Trims whitespace or specified characters from the start. */
1679
+ trimStart(charType?: string | undefined | null): this;
1680
+ /** Trims whitespace or specified characters from the end. */
1681
+ trimEnd(charType?: string | undefined | null): this;
1682
+ /** Trims newlines from the start and end. */
1683
+ trimLines(): this;
1684
+ /**
1685
+ * Deprecated method that throws an error directing users to use prependRight or appendLeft.
1686
+ * This matches the original magic-string API which deprecated this method.
1687
+ */
1688
+ insert(index: number, content: string): void;
1689
+ /** Returns a clone of the MagicString instance. */
1690
+ clone(): BindingMagicString;
1691
+ /** Returns the last character of the generated string, or an empty string if empty. */
1692
+ lastChar(): string;
1693
+ /** Returns the content after the last newline in the generated string. */
1694
+ lastLine(): string;
1695
+ /** Returns the guessed indentation string, or `\t` if none is found. */
1696
+ getIndentString(): string;
1697
+ /** Returns a clone with content outside the specified range removed. */
1698
+ snip(start: number, end: number): BindingMagicString;
1699
+ /**
1700
+ * Resets the portion of the string from `start` to `end` to its original content.
1701
+ * This undoes any modifications made to that range.
1702
+ * Supports negative indices (counting from the end).
1703
+ */
1704
+ reset(start: number, end: number): this;
1705
+ /**
1706
+ * Returns the content between the specified UTF-16 code unit positions (JS string indices).
1707
+ * Supports negative indices (counting from the end).
1708
+ *
1709
+ * When an index falls in the middle of a surrogate pair, the lone surrogate is
1710
+ * included in the result (matching the original magic-string / JS behavior).
1711
+ * This is done by returning a UTF-16 encoded JS string via `napi_create_string_utf16`.
1712
+ */
1713
+ slice(start?: number | undefined | null, end?: number | undefined | null): string;
1714
+ /**
1715
+ * Generates a source map for the transformations applied to this MagicString.
1716
+ * Returns a BindingSourceMap object with version, file, sources, sourcesContent, names, mappings.
1717
+ */
1718
+ generateMap(options?: BindingSourceMapOptions | undefined | null): BindingSourceMap;
1719
+ /**
1720
+ * Generates a decoded source map for the transformations applied to this MagicString.
1721
+ * Returns a BindingDecodedMap object with mappings as an array of arrays.
1722
+ */
1723
+ generateDecodedMap(options?: BindingSourceMapOptions | undefined | null): BindingDecodedMap;
1724
+ }
1725
+
1726
+ export declare class BindingModuleInfo {
1727
+ id: string;
1728
+ importers: Array<string>;
1729
+ dynamicImporters: Array<string>;
1730
+ importedIds: Array<string>;
1731
+ dynamicallyImportedIds: Array<string>;
1732
+ exports: Array<string>;
1733
+ isEntry: boolean;
1734
+ inputFormat: 'es' | 'cjs' | 'unknown';
1735
+ get code(): string | null;
1736
+ }
1737
+
1738
+ export declare class BindingNormalizedOptions {
1739
+ get input(): Array<string> | Record<string, string>;
1740
+ get cwd(): string;
1741
+ get platform(): 'node' | 'browser' | 'neutral';
1742
+ get shimMissingExports(): boolean;
1743
+ get name(): string | null;
1744
+ get entryFilenames(): string | undefined;
1745
+ get chunkFilenames(): string | undefined;
1746
+ get assetFilenames(): string | undefined;
1747
+ get dir(): string | null;
1748
+ get file(): string | null;
1749
+ get format(): 'es' | 'cjs' | 'iife' | 'umd';
1750
+ get exports(): 'default' | 'named' | 'none' | 'auto';
1751
+ get esModule(): boolean | 'if-default-prop';
1752
+ get codeSplitting(): boolean;
1753
+ get dynamicImportInCjs(): boolean;
1754
+ get sourcemap(): boolean | 'inline' | 'hidden';
1755
+ get sourcemapBaseUrl(): string | null;
1756
+ get banner(): string | undefined | null | undefined;
1757
+ get footer(): string | undefined | null | undefined;
1758
+ get intro(): string | undefined | null | undefined;
1759
+ get outro(): string | undefined | null | undefined;
1760
+ get postBanner(): string | undefined | null | undefined;
1761
+ get postFooter(): string | undefined | null | undefined;
1762
+ get externalLiveBindings(): boolean;
1763
+ get extend(): boolean;
1764
+ get globals(): Record<string, string> | undefined;
1765
+ get hashCharacters(): 'base64' | 'base36' | 'hex';
1766
+ get sourcemapDebugIds(): boolean;
1767
+ get sourcemapExcludeSources(): boolean;
1768
+ get polyfillRequire(): boolean;
1769
+ get minify(): false | 'dce-only' | MinifyOptions;
1770
+ get legalComments(): 'none' | 'inline';
1771
+ get comments(): BindingCommentsOptions;
1772
+ get preserveModules(): boolean;
1773
+ get preserveModulesRoot(): string | undefined;
1774
+ get virtualDirname(): string;
1775
+ get topLevelVar(): boolean;
1776
+ get minifyInternalExports(): boolean;
1777
+ get context(): string;
1778
+ }
1779
+
1780
+ export declare class BindingOutputAsset {
1781
+ dropInner(): ExternalMemoryStatus;
1782
+ getFileName(): string;
1783
+ getOriginalFileName(): string | null;
1784
+ getOriginalFileNames(): Array<string>;
1785
+ getSource(): BindingAssetSource;
1786
+ getName(): string | null;
1787
+ getNames(): Array<string>;
1788
+ }
1789
+
1790
+ export declare class BindingOutputChunk {
1791
+ dropInner(): ExternalMemoryStatus;
1792
+ getIsEntry(): boolean;
1793
+ getIsDynamicEntry(): boolean;
1794
+ getFacadeModuleId(): string | null;
1795
+ getModuleIds(): Array<string>;
1796
+ getExports(): Array<string>;
1797
+ getFileName(): string;
1798
+ getModules(): BindingModules;
1799
+ getImports(): Array<string>;
1800
+ getDynamicImports(): Array<string>;
1801
+ getCode(): string;
1802
+ getMap(): string | null;
1803
+ getSourcemapFileName(): string | null;
1804
+ getPreliminaryFileName(): string;
1805
+ getName(): string;
1806
+ }
1807
+
1808
+ export declare class BindingPluginContext {
1809
+ load(
1810
+ specifier: string,
1811
+ sideEffects: boolean | 'no-treeshake' | undefined,
1812
+ packageJsonPath?: string,
1813
+ ): Promise<void>;
1814
+ resolve(
1815
+ specifier: string,
1816
+ importer?: string | undefined | null,
1817
+ extraOptions?: BindingPluginContextResolveOptions | undefined | null,
1818
+ ): Promise<BindingPluginContextResolvedId | null>;
1819
+ emitFile(
1820
+ file: BindingEmittedAsset,
1821
+ assetFilename?: string | undefined | null,
1822
+ fnSanitizedFileName?: string | undefined | null,
1823
+ ): string;
1824
+ emitChunk(file: BindingEmittedChunk): string;
1825
+ emitPrebuiltChunk(file: BindingEmittedPrebuiltChunk): string;
1826
+ getFileName(referenceId: string): string;
1827
+ getModuleInfo(moduleId: string): BindingModuleInfo | null;
1828
+ getModuleIds(): Array<string>;
1829
+ addWatchFile(file: string): void;
1830
+ }
1831
+
1832
+ export declare class BindingRenderedChunk {
1833
+ get name(): string;
1834
+ get isEntry(): boolean;
1835
+ get isDynamicEntry(): boolean;
1836
+ get facadeModuleId(): string | null;
1837
+ get moduleIds(): Array<string>;
1838
+ get exports(): Array<string>;
1839
+ get fileName(): string;
1840
+ get modules(): BindingModules;
1841
+ get imports(): Array<string>;
1842
+ get dynamicImports(): Array<string>;
1843
+ }
1844
+
1845
+ export declare class BindingRenderedChunkMeta {
1846
+ get chunks(): Record<string, BindingRenderedChunk>;
1847
+ }
1848
+
1849
+ export declare class BindingRenderedModule {
1850
+ get code(): string | null;
1851
+ get renderedExports(): Array<string>;
1852
+ }
1853
+
1854
+ /** A source map object with properties matching the SourceMap V3 specification. */
1855
+ export declare class BindingSourceMap {
1856
+ /** The source map version (always 3). */
1857
+ get version(): number;
1858
+ /** The generated file name. */
1859
+ get file(): string | null;
1860
+ /** The list of original source files. */
1861
+ get sources(): Array<string>;
1862
+ /** The original source contents (if `includeContent` was true). */
1863
+ get sourcesContent(): Array<string | undefined | null>;
1864
+ /** The list of symbol names used in mappings. */
1865
+ get names(): Array<string>;
1866
+ /** The VLQ-encoded mappings string. */
1867
+ get mappings(): string;
1868
+ /** The list of source indices that should be excluded from debugging. */
1869
+ get x_google_ignoreList(): Array<number> | null;
1870
+ /** Returns the source map as a JSON string. */
1871
+ toString(): string;
1872
+ /** Returns the source map as a base64-encoded data URL. */
1873
+ toUrl(): string;
1874
+ }
1875
+
1876
+ export declare class BindingTransformPluginContext {
1877
+ getCombinedSourcemap(): string;
1878
+ inner(): BindingPluginContext;
1879
+ addWatchFile(file: string): void;
1880
+ sendMagicString(magicString: BindingMagicString): string | null;
1881
+ }
1882
+
1883
+ export declare class BindingWatcher {
1884
+ constructor(options: BindingBundlerOptions[], listener: (data: BindingWatcherEvent) => void);
1885
+ run(): Promise<void>;
1886
+ /**
1887
+ * Gives consumers a reliable way to await the watcher's completion.
1888
+ * The Node.js layer relies on the pending Promise to keep the process from exiting.
1889
+ */
1890
+ waitForClose(): Promise<void>;
1891
+ close(): Promise<void>;
1892
+ }
1893
+
1894
+ /**
1895
+ * Minimal wrapper around a `BundleHandle` for watcher events.
1896
+ * This is returned from watcher event data to allow calling `result.close()`.
1897
+ */
1898
+ export declare class BindingWatcherBundler {
1899
+ close(): Promise<void>;
1900
+ }
1901
+
1902
+ export declare class BindingWatcherChangeData {
1903
+ path: string;
1904
+ kind: string;
1905
+ }
1906
+
1907
+ export declare class BindingWatcherEvent {
1908
+ eventKind(): string;
1909
+ bundleEventKind(): string;
1910
+ bundleEndData(): BindingBundleEndEventData;
1911
+ bundleErrorData(): BindingBundleErrorEventData;
1912
+ watchChangeData(): BindingWatcherChangeData;
1913
+ }
1914
+
1915
+ export declare class ParallelJsPluginRegistry {
1916
+ id: number;
1917
+ workerCount: number;
1918
+ constructor(workerCount: number);
1919
+ }
1920
+
1921
+ export declare class ScheduledBuild {
1922
+ wait(): Promise<void>;
1923
+ alreadyScheduled(): boolean;
1924
+ }
1925
+
1926
+ export declare class TraceSubscriberGuard {
1927
+ close(): void;
1928
+ }
1929
+
1930
+ export declare class TsconfigCache {
1931
+ /** Create a new transform cache with auto tsconfig discovery enabled. */
1932
+ constructor(yarnPnp: boolean);
1933
+ /**
1934
+ * Clear the cache.
1935
+ *
1936
+ * Call this when tsconfig files have changed to ensure fresh resolution.
1937
+ */
1938
+ clear(): void;
1939
+ /** Get the number of cached entries. */
1940
+ size(): number;
1941
+ }
1942
+
1943
+ export interface AliasItem {
1944
+ find: string;
1945
+ replacements: Array<string | undefined | null>;
1946
+ }
1947
+
1948
+ export interface BindingAssetSource {
1949
+ inner: string | Uint8Array;
1950
+ }
1951
+
1952
+ export declare const enum BindingAttachDebugInfo {
1953
+ None = 0,
1954
+ Simple = 1,
1955
+ Full = 2,
1956
+ }
1957
+
1958
+ export interface BindingBuiltinPlugin {
1959
+ __name: BindingBuiltinPluginName;
1960
+ options?: unknown;
1961
+ }
1962
+
1963
+ export declare const enum BindingBuiltinPluginName {
1964
+ BundleAnalyzer = 'builtin:bundle-analyzer',
1965
+ EsmExternalRequire = 'builtin:esm-external-require',
1966
+ IsolatedDeclaration = 'builtin:isolated-declaration',
1967
+ Replace = 'builtin:replace',
1968
+ ViteAlias = 'builtin:vite-alias',
1969
+ ViteBuildImportAnalysis = 'builtin:vite-build-import-analysis',
1970
+ ViteDynamicImportVars = 'builtin:vite-dynamic-import-vars',
1971
+ ViteImportGlob = 'builtin:vite-import-glob',
1972
+ ViteJson = 'builtin:vite-json',
1973
+ ViteLoadFallback = 'builtin:vite-load-fallback',
1974
+ ViteManifest = 'builtin:vite-manifest',
1975
+ ViteModulePreloadPolyfill = 'builtin:vite-module-preload-polyfill',
1976
+ ViteReactRefreshWrapper = 'builtin:vite-react-refresh-wrapper',
1977
+ ViteReporter = 'builtin:vite-reporter',
1978
+ ViteResolve = 'builtin:vite-resolve',
1979
+ ViteTransform = 'builtin:vite-transform',
1980
+ ViteWasmFallback = 'builtin:vite-wasm-fallback',
1981
+ ViteWebWorkerPost = 'builtin:vite-web-worker-post',
1982
+ OxcRuntime = 'builtin:oxc-runtime',
1983
+ }
1984
+
1985
+ export interface BindingBundleAnalyzerPluginConfig {
1986
+ /** Output filename for the bundle analysis data (default: "analyze-data.json") */
1987
+ fileName?: string;
1988
+ /** Output format: "json" (default) or "md" for LLM-friendly markdown */
1989
+ format?: 'json' | 'md';
1990
+ }
1991
+
1992
+ export interface BindingBundlerOptions {
1993
+ inputOptions: BindingInputOptions;
1994
+ outputOptions: BindingOutputOptions;
1995
+ parallelPluginsRegistry?: ParallelJsPluginRegistry;
1996
+ }
1997
+
1998
+ export interface BindingBundleState {
1999
+ lastFullBuildFailed: boolean;
2000
+ hasStaleOutput: boolean;
2001
+ }
2002
+
2003
+ export interface BindingChecksOptions {
2004
+ circularDependency?: boolean;
2005
+ eval?: boolean;
2006
+ missingGlobalName?: boolean;
2007
+ missingNameOptionForIifeExport?: boolean;
2008
+ invalidAnnotation?: boolean;
2009
+ mixedExports?: boolean;
2010
+ unresolvedEntry?: boolean;
2011
+ unresolvedImport?: boolean;
2012
+ filenameConflict?: boolean;
2013
+ commonJsVariableInEsm?: boolean;
2014
+ importIsUndefined?: boolean;
2015
+ emptyImportMeta?: boolean;
2016
+ toleratedTransform?: boolean;
2017
+ cannotCallNamespace?: boolean;
2018
+ configurationFieldConflict?: boolean;
2019
+ preferBuiltinFeature?: boolean;
2020
+ couldNotCleanDirectory?: boolean;
2021
+ pluginTimings?: boolean;
2022
+ duplicateShebang?: boolean;
2023
+ unsupportedTsconfigOption?: boolean;
2024
+ ineffectiveDynamicImport?: boolean;
2025
+ largeBarrelModules?: boolean;
2026
+ }
2027
+
2028
+ export interface BindingChunkImportMap {
2029
+ baseUrl?: string;
2030
+ fileName?: string;
2031
+ }
2032
+
2033
+ export declare const enum BindingChunkModuleOrderBy {
2034
+ ModuleId = 0,
2035
+ ExecOrder = 1,
2036
+ }
2037
+
2038
+ export interface BindingChunkOptimizationOptions {
2039
+ mergeCommonChunks?: boolean;
2040
+ avoidRedundantChunkLoads?: boolean;
2041
+ }
2042
+
2043
+ export interface BindingClientHmrUpdate {
2044
+ clientId: string;
2045
+ update: BindingHmrUpdate;
2046
+ }
2047
+
2048
+ export interface BindingCommentsOptions {
2049
+ legal?: boolean;
2050
+ annotation?: boolean;
2051
+ jsdoc?: boolean;
2052
+ }
2053
+
2054
+ export interface BindingCompilerOptions {
2055
+ baseUrl?: string;
2056
+ paths?: Record<string, Array<string>>;
2057
+ experimentalDecorators?: boolean;
2058
+ emitDecoratorMetadata?: boolean;
2059
+ useDefineForClassFields?: boolean;
2060
+ rewriteRelativeImportExtensions?: boolean;
2061
+ jsx?: string;
2062
+ jsxFactory?: string;
2063
+ jsxFragmentFactory?: string;
2064
+ jsxImportSource?: string;
2065
+ verbatimModuleSyntax?: boolean;
2066
+ preserveValueImports?: boolean;
2067
+ importsNotUsedAsValues?: string;
2068
+ target?: string;
2069
+ module?: string;
2070
+ allowJs?: boolean;
2071
+ rootDirs?: Array<string>;
2072
+ }
2073
+
2074
+ export interface BindingDeferSyncScanData {
2075
+ /** ModuleId */
2076
+ id: string;
2077
+ sideEffects?: boolean | 'no-treeshake';
2078
+ }
2079
+
2080
+ export interface BindingDevOptions {
2081
+ onHmrUpdates?:
2082
+ | undefined
2083
+ | ((result: BindingResult<[BindingClientHmrUpdate[], string[]]>) => void | Promise<void>);
2084
+ onOutput?: undefined | ((result: BindingResult<BindingOutputs>) => void | Promise<void>);
2085
+ rebuildStrategy?: BindingRebuildStrategy;
2086
+ watch?: BindingDevWatchOptions;
2087
+ }
2088
+
2089
+ export interface BindingDevtoolsOptions {
2090
+ sessionId?: string;
2091
+ }
2092
+
2093
+ export interface BindingDevWatchOptions {
2094
+ skipWrite?: boolean;
2095
+ usePolling?: boolean;
2096
+ pollInterval?: number;
2097
+ useDebounce?: boolean;
2098
+ debounceDuration?: number;
2099
+ compareContentsForPolling?: boolean;
2100
+ debounceTickRate?: number;
2101
+ include?: Array<BindingStringOrRegex>;
2102
+ exclude?: Array<BindingStringOrRegex>;
2103
+ }
2104
+
2105
+ export interface BindingEmittedAsset {
2106
+ name?: string;
2107
+ fileName?: string;
2108
+ originalFileName?: string;
2109
+ source: BindingAssetSource;
2110
+ }
2111
+
2112
+ export interface BindingEmittedChunk {
2113
+ name?: string;
2114
+ fileName?: string;
2115
+ id: string;
2116
+ importer?: string;
2117
+ preserveEntrySignatures?: BindingPreserveEntrySignatures;
2118
+ }
2119
+
2120
+ export interface BindingEmittedPrebuiltChunk {
2121
+ fileName: string;
2122
+ name?: string;
2123
+ code: string;
2124
+ exports?: Array<string>;
2125
+ map?: BindingSourcemap;
2126
+ sourcemapFileName?: string;
2127
+ facadeModuleId?: string;
2128
+ isEntry?: boolean;
2129
+ isDynamicEntry?: boolean;
2130
+ }
2131
+
2132
+ /** Enhanced transform options with tsconfig and inputMap support. */
2133
+ export interface BindingEnhancedTransformOptions {
2134
+ /** Treat the source text as 'js', 'jsx', 'ts', 'tsx', or 'dts'. */
2135
+ lang?: 'js' | 'jsx' | 'ts' | 'tsx' | 'dts';
2136
+ /** Treat the source text as 'script', 'module', 'commonjs', or 'unambiguous'. */
2137
+ sourceType?: 'script' | 'module' | 'commonjs' | 'unambiguous' | undefined;
2138
+ /**
2139
+ * The current working directory. Used to resolve relative paths in other
2140
+ * options.
2141
+ */
2142
+ cwd?: string;
2143
+ /**
2144
+ * Enable source map generation.
2145
+ *
2146
+ * When `true`, the `sourceMap` field of transform result objects will be populated.
2147
+ *
2148
+ * @default false
2149
+ */
2150
+ sourcemap?: boolean;
2151
+ /** Set assumptions in order to produce smaller output. */
2152
+ assumptions?: CompilerAssumptions;
2153
+ /**
2154
+ * Configure how TypeScript is transformed.
2155
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/typescript}
2156
+ */
2157
+ typescript?: TypeScriptOptions;
2158
+ /**
2159
+ * Configure how TSX and JSX are transformed.
2160
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/jsx}
2161
+ */
2162
+ jsx?: 'preserve' | JsxOptions;
2163
+ /**
2164
+ * Sets the target environment for the generated JavaScript.
2165
+ *
2166
+ * The lowest target is `es2015`.
2167
+ *
2168
+ * Example:
2169
+ *
2170
+ * * `'es2015'`
2171
+ * * `['es2020', 'chrome58', 'edge16', 'firefox57', 'node12', 'safari11']`
2172
+ *
2173
+ * @default `esnext` (No transformation)
2174
+ *
2175
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/lowering#target}
2176
+ */
2177
+ target?: string | Array<string>;
2178
+ /** Behaviour for runtime helpers. */
2179
+ helpers?: Helpers;
2180
+ /**
2181
+ * Define Plugin
2182
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#define}
2183
+ */
2184
+ define?: Record<string, string>;
2185
+ /**
2186
+ * Inject Plugin
2187
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/global-variable-replacement#inject}
2188
+ */
2189
+ inject?: Record<string, string | [string, string]>;
2190
+ /** Decorator plugin */
2191
+ decorator?: DecoratorOptions;
2192
+ /**
2193
+ * Third-party plugins to use.
2194
+ * @see {@link https://oxc.rs/docs/guide/usage/transformer/plugins}
2195
+ */
2196
+ plugins?: PluginsOptions;
2197
+ /**
2198
+ * Configure tsconfig handling.
2199
+ * - true: Auto-discover and load the nearest tsconfig.json
2200
+ * - TsconfigRawOptions: Use the provided inline tsconfig options
2201
+ */
2202
+ tsconfig?: boolean | BindingTsconfigRawOptions;
2203
+ /** An input source map to collapse with the output source map. */
2204
+ inputMap?: SourceMap;
2205
+ }
2206
+
2207
+ /** Result of the enhanced transform API. */
2208
+ export interface BindingEnhancedTransformResult {
2209
+ /**
2210
+ * The transformed code.
2211
+ *
2212
+ * If parsing failed, this will be an empty string.
2213
+ */
2214
+ code: string;
2215
+ /**
2216
+ * The source map for the transformed code.
2217
+ *
2218
+ * This will be set if {@link BindingEnhancedTransformOptions#sourcemap} is `true`.
2219
+ */
2220
+ map?: SourceMap;
2221
+ /**
2222
+ * The `.d.ts` declaration file for the transformed code. Declarations are
2223
+ * only generated if `declaration` is set to `true` and a TypeScript file
2224
+ * is provided.
2225
+ *
2226
+ * If parsing failed and `declaration` is set, this will be an empty string.
2227
+ *
2228
+ * @see {@link TypeScriptOptions#declaration}
2229
+ * @see [declaration tsconfig option](https://www.typescriptlang.org/tsconfig/#declaration)
2230
+ */
2231
+ declaration?: string;
2232
+ /**
2233
+ * Declaration source map. Only generated if both
2234
+ * {@link TypeScriptOptions#declaration declaration} and
2235
+ * {@link BindingEnhancedTransformOptions#sourcemap sourcemap} are set to `true`.
2236
+ */
2237
+ declarationMap?: SourceMap;
2238
+ /**
2239
+ * Helpers used.
2240
+ *
2241
+ * @internal
2242
+ *
2243
+ * Example:
2244
+ *
2245
+ * ```text
2246
+ * { "_objectSpread": "@oxc-project/runtime/helpers/objectSpread2" }
2247
+ * ```
2248
+ */
2249
+ helpersUsed: Record<string, string>;
2250
+ /** Parse and transformation errors. */
2251
+ errors: Array<BindingError>;
2252
+ /** Parse and transformation warnings. */
2253
+ warnings: Array<BindingError>;
2254
+ /** Paths to tsconfig files that were loaded during transformation. */
2255
+ tsconfigFilePaths: Array<string>;
2256
+ }
2257
+
2258
+ export type BindingError =
2259
+ | { type: 'JsError'; field0: Error }
2260
+ | { type: 'NativeError'; field0: NativeError };
2261
+
2262
+ export interface BindingErrors {
2263
+ errors: Array<BindingError>;
2264
+ isBindingErrors: boolean;
2265
+ }
2266
+
2267
+ export interface BindingEsmExternalRequirePluginConfig {
2268
+ external: Array<BindingStringOrRegex>;
2269
+ skipDuplicateCheck?: boolean;
2270
+ }
2271
+
2272
+ export interface BindingExperimentalDevModeOptions {
2273
+ host?: string;
2274
+ port?: number;
2275
+ implement?: string;
2276
+ lazy?: boolean;
2277
+ }
2278
+
2279
+ export interface BindingExperimentalOptions {
2280
+ viteMode?: boolean;
2281
+ resolveNewUrlToAsset?: boolean;
2282
+ devMode?: BindingExperimentalDevModeOptions;
2283
+ attachDebugInfo?: BindingAttachDebugInfo;
2284
+ chunkModulesOrder?: BindingChunkModuleOrderBy;
2285
+ chunkImportMap?: boolean | BindingChunkImportMap;
2286
+ onDemandWrapping?: boolean;
2287
+ incrementalBuild?: boolean;
2288
+ nativeMagicString?: boolean;
2289
+ chunkOptimization?: boolean | BindingChunkOptimizationOptions;
2290
+ lazyBarrel?: boolean;
2291
+ }
2292
+
2293
+ export interface BindingFilterToken {
2294
+ kind: FilterTokenKind;
2295
+ payload?: BindingStringOrRegex | number | boolean;
2296
+ }
2297
+
2298
+ export interface BindingGeneratedCodeOptions {
2299
+ symbols?: boolean;
2300
+ preset?: string;
2301
+ }
2302
+
2303
+ export type BindingGenerateHmrPatchReturn =
2304
+ | { type: 'Ok'; field0: Array<BindingHmrUpdate> }
2305
+ | { type: 'Error'; field0: Array<BindingError> };
2306
+
2307
+ export interface BindingHmrBoundaryOutput {
2308
+ boundary: string;
2309
+ acceptedVia: string;
2310
+ }
2311
+
2312
+ export type BindingHmrUpdate =
2313
+ | {
2314
+ type: 'Patch';
2315
+ code: string;
2316
+ filename: string;
2317
+ sourcemap?: string;
2318
+ sourcemapFilename?: string;
2319
+ hmrBoundaries: Array<BindingHmrBoundaryOutput>;
2320
+ }
2321
+ | { type: 'FullReload'; reason?: string }
2322
+ | { type: 'Noop' };
2323
+
2324
+ export interface BindingHookFilter {
2325
+ value?: Array<Array<BindingFilterToken>>;
2326
+ }
2327
+
2328
+ export interface BindingHookJsLoadOutput {
2329
+ code: string;
2330
+ map?: string;
2331
+ moduleSideEffects?: boolean | 'no-treeshake';
2332
+ }
2333
+
2334
+ export interface BindingHookJsResolveIdOptions {
2335
+ isEntry?: boolean;
2336
+ scan?: boolean;
2337
+ custom?: BindingVitePluginCustom;
2338
+ }
2339
+
2340
+ export interface BindingHookJsResolveIdOutput {
2341
+ id: string;
2342
+ external?: boolean | 'absolute' | 'relative';
2343
+ moduleSideEffects?: boolean | 'no-treeshake';
2344
+ }
2345
+
2346
+ export interface BindingHookLoadOutput {
2347
+ code: string;
2348
+ moduleSideEffects?: boolean | 'no-treeshake';
2349
+ map?: BindingSourcemap;
2350
+ moduleType?: string;
2351
+ }
2352
+
2353
+ export interface BindingHookRenderChunkOutput {
2354
+ code: string;
2355
+ map?: BindingSourcemap;
2356
+ }
2357
+
2358
+ export interface BindingHookResolveIdExtraArgs {
2359
+ custom?: number;
2360
+ isEntry: boolean;
2361
+ /**
2362
+ * - `import-statement`: `import { foo } from './lib.js';`
2363
+ * - `dynamic-import`: `import('./lib.js')`
2364
+ * - `require-call`: `require('./lib.js')`
2365
+ * - `import-rule`: `@import 'bg-color.css'`
2366
+ * - `url-token`: `url('./icon.png')`
2367
+ * - `new-url`: `new URL('./worker.js', import.meta.url)`
2368
+ * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
2369
+ */
2370
+ kind:
2371
+ | 'import-statement'
2372
+ | 'dynamic-import'
2373
+ | 'require-call'
2374
+ | 'import-rule'
2375
+ | 'url-token'
2376
+ | 'new-url'
2377
+ | 'hot-accept';
2378
+ }
2379
+
2380
+ export interface BindingHookResolveIdOutput {
2381
+ id: string;
2382
+ external?: BindingResolvedExternal;
2383
+ normalizeExternalId?: boolean;
2384
+ moduleSideEffects?: boolean | 'no-treeshake';
2385
+ /**
2386
+ * @internal Used to store package json path resolved by oxc resolver,
2387
+ * we could get the related package json object via the path string.
2388
+ */
2389
+ packageJsonPath?: string | null;
2390
+ }
2391
+
2392
+ export type BindingHookSideEffects = boolean | string;
2393
+
2394
+ export interface BindingHookTransformOutput {
2395
+ code?: string;
2396
+ moduleSideEffects?: BindingHookSideEffects;
2397
+ /**
2398
+ * A sourcemap, or `null` to explicitly signal "no sourcemap" (distinct from
2399
+ * omitting the field, which mirrors Rollup's "possibly broken" semantics).
2400
+ */
2401
+ map?: BindingSourcemap | null;
2402
+ moduleType?: string;
2403
+ }
2404
+
2405
+ export interface BindingIndentOptions {
2406
+ exclude?: Array<Array<number>> | Array<number>;
2407
+ }
2408
+
2409
+ export interface BindingInjectImportNamed {
2410
+ tagNamed: true;
2411
+ imported: string;
2412
+ alias?: string;
2413
+ from: string;
2414
+ }
2415
+
2416
+ export interface BindingInjectImportNamespace {
2417
+ tagNamespace: true;
2418
+ alias: string;
2419
+ from: string;
2420
+ }
2421
+
2422
+ export interface BindingInlineConstConfig {
2423
+ mode?: string;
2424
+ pass?: number;
2425
+ }
2426
+
2427
+ export interface BindingInputItem {
2428
+ name?: string;
2429
+ import: string;
2430
+ }
2431
+
2432
+ export interface BindingInputOptions {
2433
+ external?:
2434
+ | Array<string | RegExp>
2435
+ | ((source: string, importer: string | undefined, isResolved: boolean) => boolean);
2436
+ input: Array<BindingInputItem>;
2437
+ plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[];
2438
+ resolve?: BindingResolveOptions;
2439
+ shimMissingExports?: boolean;
2440
+ platform?: 'node' | 'browser' | 'neutral';
2441
+ logLevel: BindingLogLevel;
2442
+ onLog: (logLevel: 'debug' | 'warn' | 'info', log: BindingLog) => void;
2443
+ cwd: string;
2444
+ treeshake?: BindingTreeshake;
2445
+ moduleTypes?: Record<string, string>;
2446
+ define?: Array<[string, string]>;
2447
+ dropLabels?: Array<string>;
2448
+ inject?: Array<BindingInjectImportNamed | BindingInjectImportNamespace>;
2449
+ experimental?: BindingExperimentalOptions;
2450
+ profilerNames?: boolean;
2451
+ transform?: TransformOptions;
2452
+ watch?: BindingWatchOption;
2453
+ keepNames?: boolean;
2454
+ checks?: BindingChecksOptions;
2455
+ deferSyncScanData?: undefined | (() => BindingDeferSyncScanData[]);
2456
+ makeAbsoluteExternalsRelative?: BindingMakeAbsoluteExternalsRelative;
2457
+ devtools?: BindingDevtoolsOptions;
2458
+ invalidateJsSideCache?: () => void;
2459
+ preserveEntrySignatures?: BindingPreserveEntrySignatures;
2460
+ optimization?: BindingOptimization;
2461
+ context?: string;
2462
+ tsconfig?: boolean | string;
2463
+ }
2464
+
2465
+ export interface BindingIsolatedDeclarationPluginConfig {
2466
+ stripInternal?: boolean;
2467
+ }
2468
+
2469
+ export interface BindingJsonSourcemap {
2470
+ file?: string;
2471
+ mappings?: string;
2472
+ sourceRoot?: string;
2473
+ sources?: Array<string | undefined | null>;
2474
+ sourcesContent?: Array<string | undefined | null>;
2475
+ names?: Array<string>;
2476
+ debugId?: string;
2477
+ x_google_ignoreList?: Array<number>;
2478
+ }
2479
+
2480
+ export interface BindingJsWatchChangeEvent {
2481
+ event: string;
2482
+ }
2483
+
2484
+ export interface BindingLog {
2485
+ message: string;
2486
+ id?: string;
2487
+ code?: string;
2488
+ exporter?: string;
2489
+ plugin?: string;
2490
+ /** Location information (line, column, file) */
2491
+ loc?: BindingLogLocation;
2492
+ /** Position in the source file in UTF-16 code units */
2493
+ pos?: number;
2494
+ /** List of module IDs (used for CIRCULAR_DEPENDENCY warnings) */
2495
+ ids?: Array<string>;
2496
+ }
2497
+
2498
+ export declare const enum BindingLogLevel {
2499
+ Silent = 0,
2500
+ Warn = 1,
2501
+ Info = 2,
2502
+ Debug = 3,
2503
+ }
2504
+
2505
+ export interface BindingLogLocation {
2506
+ /** 1-based */
2507
+ line: number;
2508
+ /** 0-based position in the line in UTF-16 code units */
2509
+ column: number;
2510
+ file?: string;
2511
+ }
2512
+
2513
+ export interface BindingMagicStringOptions {
2514
+ filename?: string;
2515
+ offset?: number;
2516
+ indentExclusionRanges?: Array<Array<number>> | Array<number>;
2517
+ ignoreList?: boolean;
2518
+ }
2519
+
2520
+ export type BindingMakeAbsoluteExternalsRelative =
2521
+ | { type: 'Bool'; field0: boolean }
2522
+ | { type: 'IfRelativeSource' };
2523
+
2524
+ export interface BindingManualCodeSplittingOptions {
2525
+ includeDependenciesRecursively?: boolean;
2526
+ minSize?: number;
2527
+ minShareCount?: number;
2528
+ groups?: Array<BindingMatchGroup>;
2529
+ maxSize?: number;
2530
+ minModuleSize?: number;
2531
+ maxModuleSize?: number;
2532
+ }
2533
+
2534
+ export interface BindingMatchGroup {
2535
+ name: string | ((id: string, ctx: BindingChunkingContext) => VoidNullable<string>);
2536
+ test?: string | RegExp | ((id: string) => VoidNullable<boolean>);
2537
+ priority?: number;
2538
+ minSize?: number;
2539
+ minShareCount?: number;
2540
+ minModuleSize?: number;
2541
+ maxModuleSize?: number;
2542
+ maxSize?: number;
2543
+ entriesAware?: boolean;
2544
+ entriesAwareMergeThreshold?: number;
2545
+ tags?: Array<string>;
2546
+ }
2547
+
2548
+ export interface BindingModulePreloadOptions {
2549
+ polyfill: boolean;
2550
+ resolveDependencies?: (
2551
+ filename: string,
2552
+ deps: string[],
2553
+ context: { hostId: string; hostType: 'html' | 'js' },
2554
+ ) => string[];
2555
+ }
2556
+
2557
+ export interface BindingModules {
2558
+ values: Array<BindingRenderedModule>;
2559
+ keys: Array<string>;
2560
+ }
2561
+
2562
+ export interface BindingModuleSideEffectsRule {
2563
+ test?: RegExp | undefined;
2564
+ sideEffects: boolean;
2565
+ external?: boolean | undefined;
2566
+ }
2567
+
2568
+ export interface BindingOptimization {
2569
+ inlineConst?: boolean | BindingInlineConstConfig;
2570
+ pifeForModuleWrappers?: boolean;
2571
+ }
2572
+
2573
+ export interface BindingOutputOptions {
2574
+ name?: string;
2575
+ assetFileNames?: string | ((chunk: BindingPreRenderedAsset) => string);
2576
+ entryFileNames?: string | ((chunk: PreRenderedChunk) => string);
2577
+ chunkFileNames?: string | ((chunk: PreRenderedChunk) => string);
2578
+ sanitizeFileName?: boolean | ((name: string) => string);
2579
+ banner?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>);
2580
+ postBanner?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>);
2581
+ footer?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>);
2582
+ postFooter?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>);
2583
+ dir?: string;
2584
+ file?: string;
2585
+ esModule?: boolean | 'if-default-prop';
2586
+ exports?: 'default' | 'named' | 'none' | 'auto';
2587
+ extend?: boolean;
2588
+ externalLiveBindings?: boolean;
2589
+ format?: 'es' | 'cjs' | 'iife' | 'umd';
2590
+ generatedCode?: BindingGeneratedCodeOptions;
2591
+ globals?: Record<string, string> | ((name: string) => string);
2592
+ hashCharacters?: 'base64' | 'base36' | 'hex';
2593
+ inlineDynamicImports?: boolean;
2594
+ dynamicImportInCjs?: boolean;
2595
+ intro?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>);
2596
+ outro?: string | ((chunk: BindingRenderedChunk) => MaybePromise<VoidNullable<string>>);
2597
+ paths?: Record<string, string> | ((id: string) => string);
2598
+ plugins: (BindingBuiltinPlugin | BindingPluginOptions | undefined)[];
2599
+ sourcemap?: 'file' | 'inline' | 'hidden';
2600
+ sourcemapBaseUrl?: string;
2601
+ sourcemapIgnoreList?:
2602
+ | boolean
2603
+ | string
2604
+ | RegExp
2605
+ | ((source: string, sourcemapPath: string) => boolean);
2606
+ sourcemapDebugIds?: boolean;
2607
+ sourcemapPathTransform?: (source: string, sourcemapPath: string) => string;
2608
+ sourcemapExcludeSources?: boolean;
2609
+ strict?: boolean | 'auto';
2610
+ minify?: boolean | 'dce-only' | MinifyOptions;
2611
+ manualCodeSplitting?: BindingManualCodeSplittingOptions;
2612
+ legalComments?: 'none' | 'inline';
2613
+ comments?: boolean | BindingCommentsOptions;
2614
+ polyfillRequire?: boolean;
2615
+ preserveModules?: boolean;
2616
+ virtualDirname?: string;
2617
+ preserveModulesRoot?: string;
2618
+ topLevelVar?: boolean;
2619
+ minifyInternalExports?: boolean;
2620
+ cleanDir?: boolean;
2621
+ strictExecutionOrder?: boolean;
2622
+ }
2623
+
2624
+ export interface BindingOutputs {
2625
+ chunks: Array<BindingOutputChunk>;
2626
+ assets: Array<BindingOutputAsset>;
2627
+ }
2628
+
2629
+ export interface BindingOverwriteOptions {
2630
+ contentOnly?: boolean;
2631
+ }
2632
+
2633
+ export interface BindingPluginContextResolvedId {
2634
+ id: string;
2635
+ packageJsonPath?: string;
2636
+ external: boolean | 'absolute' | 'relative';
2637
+ moduleSideEffects?: boolean | 'no-treeshake';
2638
+ }
2639
+
2640
+ export interface BindingPluginContextResolveOptions {
2641
+ /**
2642
+ * - `import-statement`: `import { foo } from './lib.js';`
2643
+ * - `dynamic-import`: `import('./lib.js')`
2644
+ * - `require-call`: `require('./lib.js')`
2645
+ * - `import-rule`: `@import 'bg-color.css'`
2646
+ * - `url-token`: `url('./icon.png')`
2647
+ * - `new-url`: `new URL('./worker.js', import.meta.url)`
2648
+ * - `hot-accept`: `import.meta.hot.accept('./lib.js', () => {})`
2649
+ */
2650
+ importKind?:
2651
+ | 'import-statement'
2652
+ | 'dynamic-import'
2653
+ | 'require-call'
2654
+ | 'import-rule'
2655
+ | 'url-token'
2656
+ | 'new-url'
2657
+ | 'hot-accept';
2658
+ isEntry?: boolean;
2659
+ skipSelf?: boolean;
2660
+ custom?: number;
2661
+ vitePluginCustom?: BindingVitePluginCustom;
2662
+ }
2663
+
2664
+ export interface BindingPluginHookMeta {
2665
+ order?: BindingPluginOrder;
2666
+ }
2667
+
2668
+ export interface BindingPluginOptions {
2669
+ name: string;
2670
+ hookUsage: number;
2671
+ buildStart?: (
2672
+ ctx: BindingPluginContext,
2673
+ opts: BindingNormalizedOptions,
2674
+ ) => MaybePromise<VoidNullable>;
2675
+ buildStartMeta?: BindingPluginHookMeta;
2676
+ resolveId?: (
2677
+ ctx: BindingPluginContext,
2678
+ specifier: string,
2679
+ importer: Nullable<string>,
2680
+ options: BindingHookResolveIdExtraArgs,
2681
+ ) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>;
2682
+ resolveIdMeta?: BindingPluginHookMeta;
2683
+ resolveIdFilter?: BindingHookFilter;
2684
+ resolveDynamicImport?: (
2685
+ ctx: BindingPluginContext,
2686
+ specifier: string,
2687
+ importer: Nullable<string>,
2688
+ ) => MaybePromise<VoidNullable<BindingHookResolveIdOutput>>;
2689
+ resolveDynamicImportMeta?: BindingPluginHookMeta;
2690
+ load?: (
2691
+ ctx: BindingLoadPluginContext,
2692
+ id: string,
2693
+ ) => MaybePromise<VoidNullable<BindingHookLoadOutput>>;
2694
+ loadMeta?: BindingPluginHookMeta;
2695
+ loadFilter?: BindingHookFilter;
2696
+ transform?: (
2697
+ ctx: BindingTransformPluginContext,
2698
+ id: string,
2699
+ code: string,
2700
+ module_type: BindingTransformHookExtraArgs,
2701
+ ) => MaybePromise<VoidNullable<BindingHookTransformOutput>>;
2702
+ transformMeta?: BindingPluginHookMeta;
2703
+ transformFilter?: BindingHookFilter;
2704
+ moduleParsed?: (
2705
+ ctx: BindingPluginContext,
2706
+ module: BindingModuleInfo,
2707
+ ) => MaybePromise<VoidNullable>;
2708
+ moduleParsedMeta?: BindingPluginHookMeta;
2709
+ buildEnd?: (ctx: BindingPluginContext, error?: BindingError[]) => MaybePromise<VoidNullable>;
2710
+ buildEndMeta?: BindingPluginHookMeta;
2711
+ renderChunk?: (
2712
+ ctx: BindingPluginContext,
2713
+ code: string,
2714
+ chunk: BindingRenderedChunk,
2715
+ opts: BindingNormalizedOptions,
2716
+ meta: BindingRenderedChunkMeta,
2717
+ ) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>;
2718
+ renderChunkMeta?: BindingPluginHookMeta;
2719
+ renderChunkFilter?: BindingHookFilter;
2720
+ augmentChunkHash?: (
2721
+ ctx: BindingPluginContext,
2722
+ chunk: BindingRenderedChunk,
2723
+ ) => MaybePromise<void | string>;
2724
+ augmentChunkHashMeta?: BindingPluginHookMeta;
2725
+ renderStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => void;
2726
+ renderStartMeta?: BindingPluginHookMeta;
2727
+ renderError?: (ctx: BindingPluginContext, error: BindingError[]) => void;
2728
+ renderErrorMeta?: BindingPluginHookMeta;
2729
+ generateBundle?: (
2730
+ ctx: BindingPluginContext,
2731
+ bundle: BindingErrorsOr<BindingOutputs>,
2732
+ isWrite: boolean,
2733
+ opts: BindingNormalizedOptions,
2734
+ ) => MaybePromise<VoidNullable<JsChangedOutputs>>;
2735
+ generateBundleMeta?: BindingPluginHookMeta;
2736
+ writeBundle?: (
2737
+ ctx: BindingPluginContext,
2738
+ bundle: BindingErrorsOr<BindingOutputs>,
2739
+ opts: BindingNormalizedOptions,
2740
+ ) => MaybePromise<VoidNullable<JsChangedOutputs>>;
2741
+ writeBundleMeta?: BindingPluginHookMeta;
2742
+ closeBundle?: (ctx: BindingPluginContext, error?: BindingError[]) => MaybePromise<VoidNullable>;
2743
+ closeBundleMeta?: BindingPluginHookMeta;
2744
+ watchChange?: (
2745
+ ctx: BindingPluginContext,
2746
+ path: string,
2747
+ event: string,
2748
+ ) => MaybePromise<VoidNullable>;
2749
+ watchChangeMeta?: BindingPluginHookMeta;
2750
+ closeWatcher?: (ctx: BindingPluginContext) => MaybePromise<VoidNullable>;
2751
+ closeWatcherMeta?: BindingPluginHookMeta;
2752
+ banner?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void;
2753
+ bannerMeta?: BindingPluginHookMeta;
2754
+ footer?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void;
2755
+ footerMeta?: BindingPluginHookMeta;
2756
+ intro?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void;
2757
+ introMeta?: BindingPluginHookMeta;
2758
+ outro?: (ctx: BindingPluginContext, chunk: BindingRenderedChunk) => void;
2759
+ outroMeta?: BindingPluginHookMeta;
2760
+ }
2761
+
2762
+ export declare const enum BindingPluginOrder {
2763
+ Pre = 0,
2764
+ Post = 1,
2765
+ }
2766
+
2767
+ export interface BindingPluginWithIndex {
2768
+ index: number;
2769
+ plugin: BindingPluginOptions;
2770
+ }
2771
+
2772
+ export interface BindingPreRenderedAsset {
2773
+ name?: string;
2774
+ names: Array<string>;
2775
+ originalFileName?: string;
2776
+ originalFileNames: Array<string>;
2777
+ source: BindingAssetSource;
2778
+ }
2779
+
2780
+ export type BindingPreserveEntrySignatures =
2781
+ | { type: 'Bool'; field0: boolean }
2782
+ | { type: 'String'; field0: string };
2783
+
2784
+ export declare const enum BindingPropertyReadSideEffects {
2785
+ Always = 0,
2786
+ False = 1,
2787
+ }
2788
+
2789
+ export declare const enum BindingPropertyWriteSideEffects {
2790
+ Always = 0,
2791
+ False = 1,
2792
+ }
2793
+
2794
+ export declare const enum BindingRebuildStrategy {
2795
+ Always = 0,
2796
+ Auto = 1,
2797
+ Never = 2,
2798
+ }
2799
+
2800
+ export interface BindingRenderBuiltUrlConfig {
2801
+ ssr: boolean;
2802
+ type: 'asset' | 'public';
2803
+ hostId: string;
2804
+ hostType: 'js' | 'css' | 'html';
2805
+ }
2806
+
2807
+ export interface BindingRenderBuiltUrlRet {
2808
+ relative?: boolean;
2809
+ runtime?: string;
2810
+ }
2811
+
2812
+ export interface BindingReplacePluginConfig {
2813
+ values: Record<string, string>;
2814
+ delimiters?: [string, string];
2815
+ preventAssignment?: boolean;
2816
+ objectGuards?: boolean;
2817
+ sourcemap?: boolean;
2818
+ }
2819
+
2820
+ export interface BindingResolveDependenciesContext {
2821
+ hostId: string;
2822
+ hostType: string;
2823
+ }
2824
+
2825
+ export type BindingResolvedExternal = boolean | string;
2826
+
2827
+ export interface BindingResolveOptions {
2828
+ alias?: Array<AliasItem>;
2829
+ aliasFields?: Array<Array<string>>;
2830
+ conditionNames?: Array<string>;
2831
+ exportsFields?: Array<Array<string>>;
2832
+ extensions?: Array<string>;
2833
+ extensionAlias?: Array<ExtensionAliasItem>;
2834
+ mainFields?: Array<string>;
2835
+ mainFiles?: Array<string>;
2836
+ modules?: Array<string>;
2837
+ symlinks?: boolean;
2838
+ yarnPnp?: boolean;
2839
+ }
2840
+
2841
+ export interface BindingSourcemap {
2842
+ inner: string | BindingJsonSourcemap;
2843
+ }
2844
+
2845
+ export interface BindingSourceMapOptions {
2846
+ /** The filename for the generated file (goes into `map.file`) */
2847
+ file?: string;
2848
+ /** The filename of the original source (goes into `map.sources`) */
2849
+ source?: string;
2850
+ includeContent?: boolean;
2851
+ /**
2852
+ * Accepts boolean or string: true, false, "boundary"
2853
+ * - true: high-resolution sourcemaps (character-level)
2854
+ * - false: low-resolution sourcemaps (line-level) - default
2855
+ * - "boundary": high-resolution only at word boundaries
2856
+ */
2857
+ hires?: boolean | string;
2858
+ }
2859
+
2860
+ export interface BindingTransformHookExtraArgs {
2861
+ moduleType: string;
2862
+ }
2863
+
2864
+ export interface BindingTreeshake {
2865
+ moduleSideEffects:
2866
+ | boolean
2867
+ | ReadonlyArray<string>
2868
+ | BindingModuleSideEffectsRule[]
2869
+ | ((id: string, external: boolean) => boolean | undefined);
2870
+ annotations?: boolean;
2871
+ manualPureFunctions?: ReadonlyArray<string>;
2872
+ unknownGlobalSideEffects?: boolean;
2873
+ invalidImportSideEffects?: boolean;
2874
+ commonjs?: boolean;
2875
+ propertyReadSideEffects?: BindingPropertyReadSideEffects;
2876
+ propertyWriteSideEffects?: BindingPropertyWriteSideEffects;
2877
+ }
2878
+
2879
+ export interface BindingTsconfig {
2880
+ files?: Array<string>;
2881
+ include?: Array<string>;
2882
+ exclude?: Array<string>;
2883
+ compilerOptions: BindingCompilerOptions;
2884
+ }
2885
+
2886
+ /**
2887
+ * TypeScript compiler options for inline tsconfig configuration.
2888
+ *
2889
+ * @category Utilities
2890
+ */
2891
+ export interface BindingTsconfigCompilerOptions {
2892
+ /** Specifies the JSX factory function to use. */
2893
+ jsx?: 'react' | 'react-jsx' | 'react-jsxdev' | 'preserve' | 'react-native';
2894
+ /** Specifies the JSX factory function. */
2895
+ jsxFactory?: string;
2896
+ /** Specifies the JSX fragment factory function. */
2897
+ jsxFragmentFactory?: string;
2898
+ /** Specifies the module specifier for JSX imports. */
2899
+ jsxImportSource?: string;
2900
+ /** Enables experimental decorators. */
2901
+ experimentalDecorators?: boolean;
2902
+ /** Enables decorator metadata emission. */
2903
+ emitDecoratorMetadata?: boolean;
2904
+ /** Preserves module structure of imports/exports. */
2905
+ verbatimModuleSyntax?: boolean;
2906
+ /** Configures how class fields are emitted. */
2907
+ useDefineForClassFields?: boolean;
2908
+ /** The ECMAScript target version. */
2909
+ target?: string;
2910
+ /** @deprecated Use verbatimModuleSyntax instead. */
2911
+ preserveValueImports?: boolean;
2912
+ /** @deprecated Use verbatimModuleSyntax instead. */
2913
+ importsNotUsedAsValues?: 'remove' | 'preserve' | 'error';
2914
+ }
2915
+
2916
+ /**
2917
+ * Raw tsconfig options for inline configuration.
2918
+ *
2919
+ * @category Utilities
2920
+ */
2921
+ export interface BindingTsconfigRawOptions {
2922
+ /** TypeScript compiler options. */
2923
+ compilerOptions?: BindingTsconfigCompilerOptions;
2924
+ }
2925
+
2926
+ export interface BindingTsconfigResult {
2927
+ tsconfig: BindingTsconfig;
2928
+ tsconfigFilePaths: Array<string>;
2929
+ }
2930
+
2931
+ export interface BindingUpdateOptions {
2932
+ overwrite?: boolean;
2933
+ }
2934
+
2935
+ export interface BindingViteAliasPluginAlias {
2936
+ find: BindingStringOrRegex;
2937
+ replacement: string;
2938
+ }
2939
+
2940
+ export interface BindingViteAliasPluginConfig {
2941
+ entries: Array<BindingViteAliasPluginAlias>;
2942
+ }
2943
+
2944
+ export interface BindingViteBuildImportAnalysisPluginConfig {
2945
+ preloadCode: string;
2946
+ insertPreload: boolean;
2947
+ optimizeModulePreloadRelativePaths: boolean;
2948
+ renderBuiltUrl: boolean;
2949
+ isRelativeBase: boolean;
2950
+ v2?: BindingViteBuildImportAnalysisPluginV2Config;
2951
+ }
2952
+
2953
+ export interface BindingViteBuildImportAnalysisPluginV2Config {
2954
+ isSsr: boolean;
2955
+ urlBase: string;
2956
+ decodedBase: string;
2957
+ modulePreload: false | BindingModulePreloadOptions;
2958
+ renderBuiltUrl?: (
2959
+ filename: string,
2960
+ type: BindingRenderBuiltUrlConfig,
2961
+ ) => undefined | string | BindingRenderBuiltUrlRet;
2962
+ }
2963
+
2964
+ export interface BindingViteDynamicImportVarsPluginConfig {
2965
+ sourcemap?: boolean;
2966
+ include?: Array<BindingStringOrRegex>;
2967
+ exclude?: Array<BindingStringOrRegex>;
2968
+ resolver?: (id: string, importer: string) => MaybePromise<string | undefined>;
2969
+ }
2970
+
2971
+ export interface BindingViteImportGlobPluginConfig {
2972
+ root?: string;
2973
+ sourcemap?: boolean;
2974
+ restoreQueryExtension?: boolean;
2975
+ }
2976
+
2977
+ export interface BindingViteJsonPluginConfig {
2978
+ minify?: boolean;
2979
+ namedExports?: boolean;
2980
+ stringify?: BindingViteJsonPluginStringify;
2981
+ }
2982
+
2983
+ export type BindingViteJsonPluginStringify = boolean | string;
2984
+
2985
+ export interface BindingViteManifestPluginConfig {
2986
+ root: string;
2987
+ outPath: string;
2988
+ isEnableV2?: boolean;
2989
+ isLegacy?: (args: BindingNormalizedOptions) => boolean;
2990
+ cssEntries: () => Record<string, string>;
2991
+ }
2992
+
2993
+ export interface BindingViteModulePreloadPolyfillPluginConfig {
2994
+ isServer?: boolean;
2995
+ }
2996
+
2997
+ export interface BindingVitePluginCustom {
2998
+ 'vite:import-glob'?: ViteImportGlobMeta;
2999
+ }
3000
+
3001
+ export interface BindingViteReactRefreshWrapperPluginConfig {
3002
+ cwd: string;
3003
+ include?: Array<BindingStringOrRegex>;
3004
+ exclude?: Array<BindingStringOrRegex>;
3005
+ jsxImportSource: string;
3006
+ reactRefreshHost: string;
3007
+ }
3008
+
3009
+ export interface BindingViteReporterPluginConfig {
3010
+ root: string;
3011
+ isTty: boolean;
3012
+ isLib: boolean;
3013
+ assetsDir: string;
3014
+ chunkLimit: number;
3015
+ warnLargeChunks: boolean;
3016
+ reportCompressedSize: boolean;
3017
+ logInfo?: (msg: string) => void;
3018
+ }
3019
+
3020
+ export interface BindingViteResolvePluginConfig {
3021
+ resolveOptions: BindingViteResolvePluginResolveOptions;
3022
+ environmentConsumer: string;
3023
+ environmentName: string;
3024
+ builtins: Array<BindingStringOrRegex>;
3025
+ external: true | string[];
3026
+ noExternal: true | Array<string | RegExp>;
3027
+ dedupe: Array<string>;
3028
+ disableCache?: boolean;
3029
+ legacyInconsistentCjsInterop?: boolean;
3030
+ finalizeBareSpecifier?: (
3031
+ resolvedId: string,
3032
+ rawId: string,
3033
+ importer: string | null | undefined,
3034
+ ) => VoidNullable<string>;
3035
+ finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>;
3036
+ resolveSubpathImports: (
3037
+ id: string,
3038
+ importer: string,
3039
+ isRequire: boolean,
3040
+ scan: boolean,
3041
+ ) => VoidNullable<string>;
3042
+ onWarn?: (message: string) => void;
3043
+ onDebug?: (message: string) => void;
3044
+ yarnPnp: boolean;
3045
+ }
3046
+
3047
+ export interface BindingViteResolvePluginResolveOptions {
3048
+ isBuild: boolean;
3049
+ isProduction: boolean;
3050
+ asSrc: boolean;
3051
+ preferRelative: boolean;
3052
+ isRequire?: boolean;
3053
+ root: string;
3054
+ scan: boolean;
3055
+ mainFields: Array<string>;
3056
+ conditions: Array<string>;
3057
+ externalConditions: Array<string>;
3058
+ extensions: Array<string>;
3059
+ tryIndex: boolean;
3060
+ tryPrefix?: string;
3061
+ preserveSymlinks: boolean;
3062
+ tsconfigPaths: boolean;
3063
+ }
3064
+
3065
+ export interface BindingViteTransformPluginConfig {
3066
+ root: string;
3067
+ include?: Array<BindingStringOrRegex>;
3068
+ exclude?: Array<BindingStringOrRegex>;
3069
+ jsxRefreshInclude?: Array<BindingStringOrRegex>;
3070
+ jsxRefreshExclude?: Array<BindingStringOrRegex>;
3071
+ isServerConsumer?: boolean;
3072
+ jsxInject?: string;
3073
+ transformOptions?: TransformOptions;
3074
+ yarnPnp?: boolean;
3075
+ }
3076
+
3077
+ export interface BindingWatchOption {
3078
+ skipWrite?: boolean;
3079
+ include?: Array<BindingStringOrRegex>;
3080
+ exclude?: Array<BindingStringOrRegex>;
3081
+ buildDelay?: number;
3082
+ usePolling?: boolean;
3083
+ pollInterval?: number;
3084
+ compareContentsForPolling?: boolean;
3085
+ useDebounce?: boolean;
3086
+ debounceDelay?: number;
3087
+ debounceTickRate?: number;
3088
+ onInvalidate?: ((id: string) => void) | undefined;
3089
+ }
3090
+
3091
+ export declare function collapseSourcemaps(
3092
+ sourcemapChain: Array<BindingSourcemap>,
3093
+ ): BindingJsonSourcemap;
3094
+
3095
+ export declare function enhancedTransform(
3096
+ filename: string,
3097
+ sourceText: string,
3098
+ options: BindingEnhancedTransformOptions | undefined | null,
3099
+ cache: TsconfigCache | undefined | null,
3100
+ yarnPnp: boolean,
3101
+ ): Promise<BindingEnhancedTransformResult>;
3102
+
3103
+ export declare function enhancedTransformSync(
3104
+ filename: string,
3105
+ sourceText: string,
3106
+ options: BindingEnhancedTransformOptions | undefined | null,
3107
+ cache: TsconfigCache | undefined | null,
3108
+ yarnPnp: boolean,
3109
+ ): BindingEnhancedTransformResult;
3110
+
3111
+ export interface ExtensionAliasItem {
3112
+ target: string;
3113
+ replacements: Array<string>;
3114
+ }
3115
+
3116
+ export interface ExternalMemoryStatus {
3117
+ freed: boolean;
3118
+ reason?: string;
3119
+ }
3120
+
3121
+ export declare const enum FilterTokenKind {
3122
+ Id = 'Id',
3123
+ ImporterId = 'ImporterId',
3124
+ Code = 'Code',
3125
+ ModuleType = 'ModuleType',
3126
+ And = 'And',
3127
+ Or = 'Or',
3128
+ Not = 'Not',
3129
+ Include = 'Include',
3130
+ Exclude = 'Exclude',
3131
+ CleanUrl = 'CleanUrl',
3132
+ QueryKey = 'QueryKey',
3133
+ QueryValue = 'QueryValue',
3134
+ }
3135
+
3136
+ export declare function initTraceSubscriber(): TraceSubscriberGuard | null;
3137
+
3138
+ export interface JsChangedOutputs {
3139
+ deleted: Set<string>;
3140
+ changes: Record<string, JsOutputChunk | JsOutputAsset>;
3141
+ }
3142
+
3143
+ export interface JsOutputAsset {
3144
+ names: Array<string>;
3145
+ originalFileNames: Array<string>;
3146
+ filename: string;
3147
+ source: BindingAssetSource;
3148
+ }
3149
+
3150
+ export interface JsOutputChunk {
3151
+ name: string;
3152
+ isEntry: boolean;
3153
+ isDynamicEntry: boolean;
3154
+ facadeModuleId?: string;
3155
+ moduleIds: Array<string>;
3156
+ exports: Array<string>;
3157
+ filename: string;
3158
+ modules: Record<string, BindingRenderedModule>;
3159
+ imports: Array<string>;
3160
+ dynamicImports: Array<string>;
3161
+ code: string;
3162
+ map?: BindingSourcemap;
3163
+ sourcemapFilename?: string;
3164
+ preliminaryFilename: string;
3165
+ }
3166
+
3167
+ /** Error emitted from native side, it only contains kind and message, no stack trace. */
3168
+ export interface NativeError {
3169
+ kind: string;
3170
+ message: string;
3171
+ /** The id of the file associated with the error */
3172
+ id?: string;
3173
+ /** The exporter associated with the error (for import/export errors) */
3174
+ exporter?: string;
3175
+ /** Location information (line, column, file) */
3176
+ loc?: BindingLogLocation;
3177
+ /** Position in the source file in UTF-16 code units */
3178
+ pos?: number;
3179
+ }
3180
+
3181
+ export interface PreRenderedChunk {
3182
+ /** The name of this chunk, which is used in naming patterns. */
3183
+ name: string;
3184
+ /** Whether this chunk is a static entry point. */
3185
+ isEntry: boolean;
3186
+ /** Whether this chunk is a dynamic entry point. */
3187
+ isDynamicEntry: boolean;
3188
+ /** The id of a module that this chunk corresponds to. */
3189
+ facadeModuleId?: string;
3190
+ /** The list of ids of modules included in this chunk. */
3191
+ moduleIds: Array<string>;
3192
+ /** Exported variable names from this chunk. */
3193
+ exports: Array<string>;
3194
+ }
3195
+
3196
+ export declare function registerPlugins(id: number, plugins: Array<BindingPluginWithIndex>): void;
3197
+
3198
+ export declare function resolveTsconfig(
3199
+ filename: string,
3200
+ cache: TsconfigCache | undefined | null,
3201
+ yarnPnp: boolean,
3202
+ ): BindingTsconfigResult | null;
3203
+
3204
+ /**
3205
+ * Shutdown the tokio runtime manually.
3206
+ *
3207
+ * This is required for the wasm target with `tokio_unstable` cfg.
3208
+ * In the wasm runtime, the `park` threads will hang there until the tokio::Runtime is shutdown.
3209
+ */
3210
+ export declare function shutdownAsyncRuntime(): void;
3211
+
3212
+ /**
3213
+ * Start the async runtime manually.
3214
+ *
3215
+ * This is required when the async runtime is shutdown manually.
3216
+ * Usually it's used in test.
3217
+ */
3218
+ export declare function startAsyncRuntime(): void;
3219
+
3220
+ export interface ViteImportGlobMeta {
3221
+ isSubImportsPattern?: boolean;
3222
+ }
3
3223
  /** Error from batch import rewriting */
4
3224
  export interface BatchRewriteError {
5
3225
  /** The file path that had an error */