@visulima/packem 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (106) hide show
  1. package/CHANGELOG.md +263 -1
  2. package/README.md +15 -11
  3. package/dist/builder/typedoc/index.d.ts +8 -8
  4. package/dist/builder/typedoc/index.js +3 -0
  5. package/dist/cli/index.js +55 -0
  6. package/dist/config/index.d.ts +9 -10
  7. package/dist/index.d.ts +9 -8
  8. package/dist/index.js +1 -0
  9. package/dist/packem_shared/default-BYM_JvQL.js +1 -0
  10. package/dist/packem_shared/default-B_dUKZ_J.js +1 -0
  11. package/dist/packem_shared/default-DjNIGH2Y.js +1 -0
  12. package/dist/packem_shared/default-DpHYpsSt.js +1 -0
  13. package/dist/packem_shared/default-DqRcOUe1.js +1 -0
  14. package/dist/packem_shared/esbuildPlugin-CXr7ud3R-CwR2FCHj.js +3 -0
  15. package/dist/packem_shared/index-CFFENGTN.js +145 -0
  16. package/dist/packem_shared/{index-Sedl0fV9.d.mts → index-zrs6Po_w.d.ts} +2745 -58
  17. package/dist/packem_shared/oxcTransformPlugin-DfVQouIB-Cpfv95eA.js +4 -0
  18. package/dist/packem_shared/swcPlugin-Boip4lWG-CwJ-HVJc.js +1 -0
  19. package/dist/packem_shared/types-5psa8MJc.d.ts +165 -0
  20. package/dist/rollup/plugins/css/loaders/less.d.ts +1 -2
  21. package/dist/rollup/plugins/css/loaders/less.js +1 -0
  22. package/dist/rollup/plugins/css/loaders/lightningcss.d.ts +1 -2
  23. package/dist/rollup/plugins/css/loaders/lightningcss.js +1 -0
  24. package/dist/rollup/plugins/css/loaders/postcss.d.ts +1 -2
  25. package/dist/rollup/plugins/css/loaders/postcss.js +1 -0
  26. package/dist/rollup/plugins/css/loaders/sass.d.ts +1 -2
  27. package/dist/rollup/plugins/css/loaders/sass.js +1 -0
  28. package/dist/rollup/plugins/css/loaders/sourcemap.d.ts +9 -9
  29. package/dist/rollup/plugins/css/loaders/sourcemap.js +1 -0
  30. package/dist/rollup/plugins/css/loaders/stylus.d.ts +1 -2
  31. package/dist/rollup/plugins/css/loaders/stylus.js +1 -0
  32. package/dist/rollup/plugins/css/{minifiers/lightningcss.mjs → loaders/tailwindcss.d.ts} +1 -1
  33. package/dist/rollup/plugins/css/loaders/tailwindcss.js +1 -0
  34. package/dist/rollup/plugins/css/minifiers/cssnano.d.ts +1 -2
  35. package/dist/rollup/plugins/css/minifiers/cssnano.js +1 -0
  36. package/dist/rollup/plugins/css/minifiers/lightningcss.d.ts +1 -2
  37. package/dist/rollup/plugins/css/minifiers/lightningcss.js +1 -0
  38. package/dist/rollup/plugins/esbuild/index.d.ts +7 -5
  39. package/dist/rollup/plugins/esbuild/index.js +1 -0
  40. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.ts +25 -10
  41. package/dist/rollup/plugins/oxc/{isolated-declarations-oxc-transformer.mjs → isolated-declarations-oxc-transformer.js} +1 -1
  42. package/dist/rollup/plugins/oxc/oxc-transformer.d.ts +7 -6
  43. package/dist/rollup/plugins/oxc/{oxc-transformer.mjs → oxc-transformer.js} +1 -1
  44. package/dist/rollup/plugins/sucrase/index.d.ts +5 -4
  45. package/dist/rollup/plugins/sucrase/index.js +1 -0
  46. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.ts +6 -5
  47. package/dist/rollup/plugins/swc/{isolated-declarations-swc-transformer.mjs → isolated-declarations-swc-transformer.js} +1 -1
  48. package/dist/rollup/plugins/swc/swc-plugin.d.ts +26 -10
  49. package/dist/rollup/plugins/swc/swc-plugin.js +1 -0
  50. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.ts +6 -4
  51. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.js +1 -0
  52. package/files.d.ts +37 -0
  53. package/package.json +67 -55
  54. package/dist/builder/typedoc/index.d.mts +0 -27
  55. package/dist/builder/typedoc/index.mjs +0 -3
  56. package/dist/cli/index.mjs +0 -55
  57. package/dist/config/index.d.mts +0 -29
  58. package/dist/index.d.mts +0 -35
  59. package/dist/index.mjs +0 -1
  60. package/dist/packem_shared/default-CBa9Nwy_.mjs +0 -1
  61. package/dist/packem_shared/default-DlLVgYRF.mjs +0 -1
  62. package/dist/packem_shared/default-DrXMWF-8.mjs +0 -1
  63. package/dist/packem_shared/default-DuCyCmG2.mjs +0 -1
  64. package/dist/packem_shared/default-lC8LWTO_.mjs +0 -1
  65. package/dist/packem_shared/esbuildPlugin-BAwyhG6L-BTISgbUT.mjs +0 -3
  66. package/dist/packem_shared/index-CG57YXz-.mjs +0 -138
  67. package/dist/packem_shared/index-Sedl0fV9.d.ts +0 -2554
  68. package/dist/packem_shared/oxcTransformPlugin-DfVQouIB-Bxgxc0jX.mjs +0 -4
  69. package/dist/packem_shared/swcPlugin-Boip4lWG-DWNziB_j.mjs +0 -1
  70. package/dist/packem_shared/types-Bgf1bUQM.d.mts +0 -2765
  71. package/dist/packem_shared/types-C-wHDExv.d.ts +0 -2765
  72. package/dist/rollup/plugins/css/loaders/less.d.mts +0 -1
  73. package/dist/rollup/plugins/css/loaders/less.mjs +0 -1
  74. package/dist/rollup/plugins/css/loaders/lightningcss.d.mts +0 -1
  75. package/dist/rollup/plugins/css/loaders/lightningcss.mjs +0 -1
  76. package/dist/rollup/plugins/css/loaders/postcss.d.mts +0 -1
  77. package/dist/rollup/plugins/css/loaders/postcss.mjs +0 -1
  78. package/dist/rollup/plugins/css/loaders/sass.d.mts +0 -1
  79. package/dist/rollup/plugins/css/loaders/sass.mjs +0 -1
  80. package/dist/rollup/plugins/css/loaders/sourcemap.d.mts +0 -8
  81. package/dist/rollup/plugins/css/loaders/sourcemap.mjs +0 -1
  82. package/dist/rollup/plugins/css/loaders/stylus.d.mts +0 -1
  83. package/dist/rollup/plugins/css/loaders/stylus.mjs +0 -1
  84. package/dist/rollup/plugins/css/minifiers/cssnano.d.mts +0 -1
  85. package/dist/rollup/plugins/css/minifiers/cssnano.mjs +0 -1
  86. package/dist/rollup/plugins/css/minifiers/lightningcss.d.mts +0 -1
  87. package/dist/rollup/plugins/esbuild/index.d.mts +0 -22
  88. package/dist/rollup/plugins/esbuild/index.mjs +0 -1
  89. package/dist/rollup/plugins/oxc/isolated-declarations-oxc-transformer.d.mts +0 -23
  90. package/dist/rollup/plugins/oxc/oxc-transformer.d.mts +0 -18
  91. package/dist/rollup/plugins/sucrase/index.d.mts +0 -17
  92. package/dist/rollup/plugins/sucrase/index.mjs +0 -1
  93. package/dist/rollup/plugins/swc/isolated-declarations-swc-transformer.d.mts +0 -18
  94. package/dist/rollup/plugins/swc/swc-plugin.d.mts +0 -24
  95. package/dist/rollup/plugins/swc/swc-plugin.mjs +0 -1
  96. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.d.mts +0 -22
  97. package/dist/rollup/plugins/typescript/isolated-declarations-typescript-transformer.mjs +0 -1
  98. /package/dist/config/{index.mjs → index.js} +0 -0
  99. /package/dist/packem_shared/{browserslistToEsbuild-C0IWmbNe-C6xPL1oW.mjs → browserslistToEsbuild-C0IWmbNe-C6xPL1oW.js} +0 -0
  100. /package/dist/packem_shared/{create-or-update-key-storage-GwAIWW7R.mjs → create-or-update-key-storage-GwAIWW7R.js} +0 -0
  101. /package/dist/packem_shared/{index-CUp9WuCG.mjs → index-CUp9WuCG.js} +0 -0
  102. /package/dist/packem_shared/{isolatedDeclarationsOxcTransformer-WbfE6cGu-NeZOx2Y7.mjs → isolatedDeclarationsOxcTransformer-WbfE6cGu-NeZOx2Y7.js} +0 -0
  103. /package/dist/packem_shared/{isolatedDeclarationsSwcTransformer-Ch2AgtWC-B-0lOgFf.mjs → isolatedDeclarationsSwcTransformer-Ch2AgtWC-B-0lOgFf.js} +0 -0
  104. /package/dist/packem_shared/{isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.mjs → isolatedDeclarationsTypescriptTransformer-DkuEkofo-Cwe3ODMG.js} +0 -0
  105. /package/dist/packem_shared/{oxcResolvePlugin-BJpi-eSG-BsYx9cDO.mjs → oxcResolvePlugin-BJpi-eSG-BsYx9cDO.js} +0 -0
  106. /package/dist/packem_shared/{resolveTypescriptMjsCtsPlugin-DcZrZTmM-BEkYWTsH.mjs → resolveTypescriptMjsCtsPlugin-DcZrZTmM-BEkYWTsH.js} +0 -0
@@ -1,2554 +0,0 @@
1
- import { FilterPattern } from '@rollup/pluginutils';
2
- import { OutputOptions, Plugin as Plugin$1, RollupOptions } from 'rollup';
3
- import { RollupAliasOptions } from '@rollup/plugin-alias';
4
- import { RollupCommonJSOptions } from '@rollup/plugin-commonjs';
5
- import { RollupJsonOptions } from '@rollup/plugin-json';
6
- import { RollupNodeResolveOptions } from '@rollup/plugin-node-resolve';
7
- import { RollupReplaceOptions } from '@rollup/plugin-replace';
8
- import { RollupWasmOptions } from '@rollup/plugin-wasm';
9
- import { Options as Options$2 } from 'rollup-plugin-dts';
10
- import { NodePolyfillsOptions } from 'rollup-plugin-polyfill-node';
11
- import { PureAnnotationsOptions } from 'rollup-plugin-pure';
12
- import { PluginVisualizerOptions } from 'rollup-plugin-visualizer';
13
- import { TransformOptions, Loader, BuildOptions } from 'esbuild';
14
- import { NapiResolveOptions } from 'oxc-resolver';
15
- import { TransformOptions as TransformOptions$1, JsxOptions } from 'oxc-transform';
16
- import { Options as Options$3 } from 'sucrase';
17
-
18
- type AnsiColors = "bgBlack" | "bgBlackBright" | "bgBlue" | "bgBlueBright" | "bgCyan" | "bgCyanBright" | "bgGray" | "bgGreen" | "bgGreenBright" | "bgGrey" | "bgMagenta" | "bgMagentaBright" | "bgRed" | "bgRedBright" | "bgWhite" | "bgWhiteBright" | "bgYellow" | "bgYellowBright" | "black" | "blackBright" | "blue" | "blueBright" | "cyan" | "cyanBright" | "gray" | "green" | "greenBright" | "grey" | "magenta" | "magentaBright" | "red" | "redBright" | "white" | "whiteBright" | "yellow" | "yellowBright";
19
-
20
- /**
21
- Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
22
-
23
- @category Type
24
- */
25
- type Primitive =
26
- | null
27
- | undefined
28
- | string
29
- | number
30
- | boolean
31
- | symbol
32
- | bigint;
33
-
34
- declare global {
35
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
36
- interface SymbolConstructor {
37
- readonly observable: symbol;
38
- }
39
- }
40
-
41
- /**
42
- Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
43
-
44
- Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
45
-
46
- This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
47
-
48
- @example
49
- ```
50
- import type {LiteralUnion} from 'type-fest';
51
-
52
- // Before
53
-
54
- type Pet = 'dog' | 'cat' | string;
55
-
56
- const pet: Pet = '';
57
- // Start typing in your TypeScript-enabled IDE.
58
- // You **will not** get auto-completion for `dog` and `cat` literals.
59
-
60
- // After
61
-
62
- type Pet2 = LiteralUnion<'dog' | 'cat', string>;
63
-
64
- const pet: Pet2 = '';
65
- // You **will** get auto-completion for `dog` and `cat` literals.
66
- ```
67
-
68
- @category Type
69
- */
70
- type LiteralUnion<
71
- LiteralType,
72
- BaseType extends Primitive,
73
- > = LiteralType | (BaseType & Record<never, never>);
74
-
75
- declare class InteractiveStreamHook {
76
- #private;
77
- static readonly DRAIN = true;
78
- constructor(stream: NodeJS.WriteStream);
79
- active(): void;
80
- erase(count: number): void;
81
- inactive(separateHistory?: boolean): void;
82
- renew(): void;
83
- write(message: string): void;
84
- }
85
-
86
- type StreamType = "stderr" | "stdout";
87
- declare class InteractiveManager {
88
- #private;
89
- constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
90
- get lastLength(): number;
91
- get outside(): number;
92
- get isHooked(): boolean;
93
- get isSuspended(): boolean;
94
- erase(stream: StreamType, count?: number): void;
95
- hook(): boolean;
96
- resume(stream: StreamType, eraseRowCount?: number): void;
97
- suspend(stream: StreamType, erase?: boolean): void;
98
- unhook(separateHistory?: boolean): boolean;
99
- update(stream: StreamType, rows: string[], from?: number): void;
100
- private _clear;
101
- }
102
-
103
- declare global {
104
- namespace VisulimaPail {
105
- interface CustomMeta<L> {
106
- }
107
- }
108
- }
109
- interface Meta<L> extends VisulimaPail.CustomMeta<L> {
110
- badge: string | undefined;
111
- context: any[] | undefined;
112
- date: Date | string;
113
- error: Error | undefined;
114
- groups: string[];
115
- label: string | undefined;
116
- message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
117
- prefix: string | undefined;
118
- repeated?: number | undefined;
119
- scope: string[] | undefined;
120
- suffix: string | undefined;
121
- traceError: Error | undefined;
122
- type: {
123
- level: ExtendedRfc5424LogLevels | L;
124
- name: string;
125
- };
126
- }
127
- type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
128
- type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
129
- interface LoggerFunction {
130
- (message: Message): void;
131
- (...message: any[]): void;
132
- }
133
- interface LoggerConfiguration<L extends string> {
134
- badge?: string;
135
- color?: AnsiColors | undefined;
136
- label: string;
137
- logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
138
- }
139
- type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
140
- type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
141
- interface Reporter<L extends string> {
142
- log: (meta: ReadonlyMeta<L>) => void;
143
- }
144
- interface Processor<L extends string> {
145
- process: (meta: Meta<L>) => Meta<L>;
146
- }
147
- interface ConstructorOptions<T extends string, L extends string> {
148
- disabled?: boolean;
149
- logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
150
- logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
151
- messages?: {
152
- timerEnd?: string;
153
- timerStart?: string;
154
- };
155
- processors?: Processor<L>[];
156
- rawReporter?: Reporter<L>;
157
- reporters?: Reporter<L>[];
158
- scope?: string[] | string;
159
- throttle?: number;
160
- throttleMin?: number;
161
- types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
162
- }
163
- interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
164
- interactive?: boolean;
165
- stderr: NodeJS.WriteStream;
166
- stdout: NodeJS.WriteStream;
167
- }
168
- type Message = {
169
- context?: any[] | undefined;
170
- message: any;
171
- prefix?: string;
172
- suffix?: string;
173
- };
174
-
175
- type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
176
-
177
- interface StringifyOptions {
178
- bigint?: boolean,
179
- circularValue?: string | null | TypeErrorConstructor | ErrorConstructor,
180
- deterministic?: boolean | ((a: string, b: string) => number),
181
- maximumBreadth?: number,
182
- maximumDepth?: number,
183
- strict?: boolean,
184
- }
185
-
186
- declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined
187
- declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string
188
- declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
189
-
190
- declare namespace stringify {
191
- export function configure(options: StringifyOptions): typeof stringify
192
- }
193
-
194
- declare class PailBrowserImpl<T extends string = string, L extends string = string> {
195
- protected timersMap: Map<string, number>;
196
- protected countMap: Map<string, number>;
197
- protected seqTimers: Set<string>;
198
- protected readonly lastLog: {
199
- count?: number;
200
- object?: Meta<L>;
201
- serialized?: string;
202
- time?: Date;
203
- timeout?: ReturnType<typeof setTimeout>;
204
- };
205
- protected readonly logLevels: Record<string, number>;
206
- protected disabled: boolean;
207
- protected scopeName: string[];
208
- protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
209
- protected readonly longestLabel: string;
210
- protected readonly processors: Set<Processor<L>>;
211
- protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
212
- protected reporters: Set<Reporter<L>>;
213
- protected readonly throttle: number;
214
- protected readonly throttleMin: number;
215
- protected readonly stringify: typeof stringify;
216
- protected groups: string[];
217
- protected readonly startTimerMessage: string;
218
- protected readonly endTimerMessage: string;
219
- protected rawReporter: Reporter<L>;
220
- constructor(options: ConstructorOptions<T, L>);
221
- wrapConsole(): void;
222
- restoreConsole(): void;
223
- wrapException(): void;
224
- disable(): void;
225
- enable(): void;
226
- isEnabled(): boolean;
227
- scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
228
- unscope(): void;
229
- time(label?: string): void;
230
- timeLog(label?: string, ...data: unknown[]): void;
231
- timeEnd(label?: string): void;
232
- group(label?: string): void;
233
- groupEnd(): void;
234
- count(label?: string): void;
235
- countReset(label?: string): void;
236
- clear(): void;
237
- raw(message: string, ...arguments_: unknown[]): void;
238
- protected extendReporter(reporter: Reporter<L>): Reporter<L>;
239
- protected registerReporters(reporters: Reporter<L>[]): void;
240
- private _report;
241
- private registerProcessors;
242
- private _normalizeLogLevel;
243
- private _buildMeta;
244
- private _logger;
245
- }
246
- type PailBrowserType<T extends string = string, L extends string = string> = PailBrowserImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ConstructorOptions<TC, LC>) => PailBrowserType<TC, LC>);
247
-
248
- declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
249
- readonly options: ServerConstructorOptions<T, L>;
250
- protected readonly stdout: NodeJS.WriteStream;
251
- protected readonly stderr: NodeJS.WriteStream;
252
- protected interactiveManager: InteractiveManager | undefined;
253
- protected readonly interactive: boolean;
254
- constructor(options: ServerConstructorOptions<T, L>);
255
- scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
256
- getInteractiveManager(): InteractiveManager | undefined;
257
- wrapStd(): void;
258
- restoreStd(): void;
259
- wrapAll(): void;
260
- restoreAll(): void;
261
- clear(): void;
262
- protected extendReporter(reporter: Reporter<L>): Reporter<L>;
263
- private _wrapStream;
264
- private _restoreStream;
265
- }
266
- type PailServerType<T extends string = string, L extends string = string> = PailServerImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ServerConstructorOptions<TC, LC>) => PailServerType<TC, LC>);
267
-
268
- interface CJSInteropOptions {
269
- addDefaultProperty?: boolean;
270
- }
271
-
272
- type CopyPluginOptions = {
273
- copyOnce?: boolean;
274
- exactFileNames?: boolean;
275
- flatten?: boolean;
276
- targets: MultipleTargetsDesc;
277
- };
278
- type MultipleTargetsDesc = SingleTargetDesc | SingleTargetDesc[] | string[] | string;
279
- type SingleTargetDesc = {
280
- dest?: string;
281
- exclude?: string[] | string;
282
- src: string[] | string;
283
- };
284
-
285
- interface EsmShimCjsSyntaxOptions {
286
- exclude?: FilterPattern;
287
- include?: FilterPattern;
288
- }
289
-
290
- declare global {
291
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
292
- interface SymbolConstructor {
293
- readonly observable: symbol;
294
- }
295
- }
296
-
297
- type MarkOptional<Type, Keys extends keyof Type> = Type extends Type ? Omit<Type, Keys> & Partial<Pick<Type, Keys>> : never;
298
- type EsbuildPluginConfig = Options$1 & {
299
- logger: PailServerType;
300
- };
301
- type OptimizeDepsOptions = {
302
- cwd: string;
303
- esbuildOptions?: BuildOptions;
304
- exclude?: string[];
305
- include: string[];
306
- sourceMap: boolean;
307
- };
308
- type Options$1 = Omit<TransformOptions, "loader" | "sourcemap"> & {
309
- exclude?: FilterPattern;
310
- include?: FilterPattern;
311
- loaders?: Record<string, Loader | false>;
312
- optimizeDeps?: MarkOptional<OptimizeDepsOptions, "cwd" | "sourceMap">;
313
- sourceMap?: boolean;
314
- };
315
-
316
- type JSXRemoveAttributesPlugin = {
317
- attributes: string[];
318
- };
319
-
320
- interface LicenseOptions {
321
- dependenciesMarker?: string;
322
- dependenciesTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
323
- dtsMarker?: string;
324
- dtsTemplate?: (licenses: string[], dependencyLicenseTexts: string, packageName: string | undefined) => string;
325
- path?: string;
326
- }
327
-
328
- type InternalOXCTransformPluginConfig = TransformOptions$1 & {
329
- exclude?: FilterPattern;
330
- include?: FilterPattern;
331
- };
332
- type OXCTransformPluginConfig = Omit<TransformOptions$1, "cwd" | "sourcemap" | "target" | "typescript"> & {
333
- exclude?: FilterPattern;
334
- include?: FilterPattern;
335
- jsx?: Omit<JsxOptions, "refresh"> | "preserve";
336
- };
337
- type OxcResolveOptions = Omit<NapiResolveOptions, "tsconfig"> & {
338
- ignoreSideEffectsForRoot?: boolean;
339
- };
340
-
341
- interface RawLoaderOptions {
342
- exclude?: FilterPattern;
343
- include?: FilterPattern;
344
- }
345
-
346
- type ShebangOptions = {
347
- replace: boolean;
348
- shebang: string;
349
- };
350
-
351
- interface SourcemapsPluginOptions {
352
- exclude?: FilterPattern;
353
- include?: FilterPattern;
354
- }
355
-
356
- interface SucrasePluginConfig extends Options$3 {
357
- exclude?: FilterPattern;
358
- include?: FilterPattern;
359
- }
360
- declare const sucrasePlugin: TransformerFn;
361
-
362
- interface Assumptions {
363
- /**
364
- * https://babeljs.io/docs/en/assumptions#arraylikeisiterable
365
- */
366
- arrayLikeIsIterable?: boolean;
367
- /**
368
- * https://babeljs.io/docs/en/assumptions#constantreexports
369
- */
370
- constantReexports?: boolean;
371
- /**
372
- * https://babeljs.io/docs/en/assumptions#constantsuper
373
- */
374
- constantSuper?: boolean;
375
- /**
376
- * https://babeljs.io/docs/en/assumptions#enumerablemodulemeta
377
- */
378
- enumerableModuleMeta?: boolean;
379
- /**
380
- * https://babeljs.io/docs/en/assumptions#ignorefunctionlength
381
- */
382
- ignoreFunctionLength?: boolean;
383
- ignoreFunctionName?: boolean;
384
- /**
385
- * https://babeljs.io/docs/en/assumptions#ignoretoprimitivehint
386
- */
387
- ignoreToPrimitiveHint?: boolean;
388
- /**
389
- * https://babeljs.io/docs/en/assumptions#iterableisarray
390
- */
391
- iterableIsArray?: boolean;
392
- /**
393
- * https://babeljs.io/docs/en/assumptions#mutabletemplateobject
394
- */
395
- mutableTemplateObject?: boolean;
396
- /**
397
- * https://babeljs.io/docs/en/assumptions#noclasscalls
398
- */
399
- noClassCalls?: boolean;
400
- /**
401
- * https://babeljs.io/docs/en/assumptions#nodocumentall
402
- */
403
- noDocumentAll?: boolean;
404
- /**
405
- * https://babeljs.io/docs/en/assumptions#noincompletensimportdetection
406
- */
407
- noIncompleteNsImportDetection?: boolean;
408
- /**
409
- * https://babeljs.io/docs/en/assumptions#nonewarrows
410
- */
411
- noNewArrows?: boolean;
412
- /**
413
- * https://babeljs.io/docs/en/assumptions#objectrestnosymbols
414
- */
415
- objectRestNoSymbols?: boolean;
416
- /**
417
- * https://babeljs.io/docs/en/assumptions#privatefieldsasproperties
418
- */
419
- privateFieldsAsProperties?: boolean;
420
- /**
421
- * https://babeljs.io/docs/en/assumptions#puregetters
422
- */
423
- pureGetters?: boolean;
424
- /**
425
- * https://babeljs.io/docs/en/assumptions#setclassmethods
426
- */
427
- setClassMethods?: boolean;
428
- /**
429
- * https://babeljs.io/docs/en/assumptions#setcomputedproperties
430
- */
431
- setComputedProperties?: boolean;
432
- /**
433
- * https://babeljs.io/docs/en/assumptions#setpublicclassfields
434
- */
435
- setPublicClassFields?: boolean;
436
- /**
437
- * https://babeljs.io/docs/en/assumptions#setspreadproperties
438
- */
439
- setSpreadProperties?: boolean;
440
- /**
441
- * https://babeljs.io/docs/en/assumptions#skipforofiteratorclosing
442
- */
443
- skipForOfIteratorClosing?: boolean;
444
- /**
445
- * https://babeljs.io/docs/en/assumptions#superiscallableconstructor
446
- */
447
- superIsCallableConstructor?: boolean;
448
- /**
449
- * @deprecated This value will be always true
450
- */
451
- tsEnumIsReadonly?: boolean;
452
- }
453
-
454
- interface Plugin {
455
- (module: Program): Program;
456
- }
457
- type TerserEcmaVersion = 5 | 2015 | 2016 | string | number;
458
- interface JsMinifyOptions {
459
- compress?: TerserCompressOptions | boolean;
460
- format?: JsFormatOptions & ToSnakeCaseProperties<JsFormatOptions>;
461
- mangle?: TerserMangleOptions | boolean;
462
- ecma?: TerserEcmaVersion;
463
- keep_classnames?: boolean;
464
- keep_fnames?: boolean;
465
- module?: boolean | "unknown";
466
- safari10?: boolean;
467
- toplevel?: boolean;
468
- sourceMap?: boolean;
469
- outputPath?: string;
470
- inlineSourcesContent?: boolean;
471
- }
472
- /**
473
- * @example ToSnakeCase<'indentLevel'> == 'indent_level'
474
- */
475
- type ToSnakeCase<T extends string> = T extends `${infer A}${infer B}` ? `${A extends Lowercase<A> ? A : `_${Lowercase<A>}`}${ToSnakeCase<B>}` : T;
476
- /**
477
- * @example ToSnakeCaseProperties<{indentLevel: 3}> == {indent_level: 3}
478
- */
479
- type ToSnakeCaseProperties<T> = {
480
- [K in keyof T as K extends string ? ToSnakeCase<K> : K]: T[K];
481
- };
482
- /**
483
- * These properties are mostly not implemented yet,
484
- * but it exists to support passing terser config to swc minify
485
- * without modification.
486
- */
487
- interface JsFormatOptions {
488
- /**
489
- * Currently noop.
490
- * @default false
491
- * @alias ascii_only
492
- */
493
- asciiOnly?: boolean;
494
- /**
495
- * Currently noop.
496
- * @default false
497
- */
498
- beautify?: boolean;
499
- /**
500
- * Currently noop.
501
- * @default false
502
- */
503
- braces?: boolean;
504
- /**
505
- * - `false`: removes all comments
506
- * - `'some'`: preserves some comments
507
- * - `'all'`: preserves all comments
508
- * - `{ regex: string }`: preserves comments that match the regex
509
- * @default false
510
- */
511
- comments?: false | "some" | "all" | {
512
- regex: string;
513
- };
514
- /**
515
- * Currently noop.
516
- * @default 5
517
- */
518
- ecma?: TerserEcmaVersion;
519
- /**
520
- * Currently noop.
521
- * @alias indent_level
522
- */
523
- indentLevel?: number;
524
- /**
525
- * Currently noop.
526
- * @alias indent_start
527
- */
528
- indentStart?: number;
529
- /**
530
- * Currently noop.
531
- * @alias inline_script
532
- */
533
- inlineScript?: boolean;
534
- /**
535
- * Currently noop.
536
- * @alias keep_numbers
537
- */
538
- keepNumbers?: number;
539
- /**
540
- * Currently noop.
541
- * @alias keep_quoted_props
542
- */
543
- keepQuotedProps?: boolean;
544
- /**
545
- * Currently noop.
546
- * @alias max_line_len
547
- */
548
- maxLineLen?: number | false;
549
- /**
550
- * Currently noop.
551
- */
552
- preamble?: string;
553
- /**
554
- * Currently noop.
555
- * @alias quote_keys
556
- */
557
- quoteKeys?: boolean;
558
- /**
559
- * Currently noop.
560
- * @alias quote_style
561
- */
562
- quoteStyle?: boolean;
563
- /**
564
- * Currently noop.
565
- * @alias preserve_annotations
566
- */
567
- preserveAnnotations?: boolean;
568
- /**
569
- * Currently noop.
570
- */
571
- safari10?: boolean;
572
- /**
573
- * Currently noop.
574
- */
575
- semicolons?: boolean;
576
- /**
577
- * Currently noop.
578
- */
579
- shebang?: boolean;
580
- /**
581
- * Currently noop.
582
- */
583
- webkit?: boolean;
584
- /**
585
- * Currently noop.
586
- * @alias wrap_iife
587
- */
588
- wrapIife?: boolean;
589
- /**
590
- * Currently noop.
591
- * @alias wrap_func_args
592
- */
593
- wrapFuncArgs?: boolean;
594
- }
595
- interface TerserCompressOptions {
596
- arguments?: boolean;
597
- arrows?: boolean;
598
- booleans?: boolean;
599
- booleans_as_integers?: boolean;
600
- collapse_vars?: boolean;
601
- comparisons?: boolean;
602
- computed_props?: boolean;
603
- conditionals?: boolean;
604
- dead_code?: boolean;
605
- defaults?: boolean;
606
- directives?: boolean;
607
- drop_console?: boolean;
608
- drop_debugger?: boolean;
609
- ecma?: TerserEcmaVersion;
610
- evaluate?: boolean;
611
- expression?: boolean;
612
- global_defs?: any;
613
- hoist_funs?: boolean;
614
- hoist_props?: boolean;
615
- hoist_vars?: boolean;
616
- ie8?: boolean;
617
- if_return?: boolean;
618
- inline?: 0 | 1 | 2 | 3;
619
- join_vars?: boolean;
620
- keep_classnames?: boolean;
621
- keep_fargs?: boolean;
622
- keep_fnames?: boolean;
623
- keep_infinity?: boolean;
624
- loops?: boolean;
625
- negate_iife?: boolean;
626
- passes?: number;
627
- properties?: boolean;
628
- pure_getters?: any;
629
- pure_funcs?: string[];
630
- reduce_funcs?: boolean;
631
- reduce_vars?: boolean;
632
- sequences?: any;
633
- side_effects?: boolean;
634
- switches?: boolean;
635
- top_retain?: any;
636
- toplevel?: any;
637
- typeofs?: boolean;
638
- unsafe?: boolean;
639
- unsafe_passes?: boolean;
640
- unsafe_arrows?: boolean;
641
- unsafe_comps?: boolean;
642
- unsafe_function?: boolean;
643
- unsafe_math?: boolean;
644
- unsafe_symbols?: boolean;
645
- unsafe_methods?: boolean;
646
- unsafe_proto?: boolean;
647
- unsafe_regexp?: boolean;
648
- unsafe_undefined?: boolean;
649
- unused?: boolean;
650
- const_to_let?: boolean;
651
- module?: boolean;
652
- }
653
- interface TerserMangleOptions {
654
- props?: TerserManglePropertiesOptions;
655
- /**
656
- * Pass `true` to mangle names declared in the top level scope.
657
- */
658
- topLevel?: boolean;
659
- /**
660
- * @deprecated An alias for compatibility with terser.
661
- */
662
- toplevel?: boolean;
663
- /**
664
- * Pass `true` to not mangle class names.
665
- */
666
- keepClassNames?: boolean;
667
- /**
668
- * @deprecated An alias for compatibility with terser.
669
- */
670
- keep_classnames?: boolean;
671
- /**
672
- * Pass `true` to not mangle function names.
673
- */
674
- keepFnNames?: boolean;
675
- /**
676
- * @deprecated An alias for compatibility with terser.
677
- */
678
- keep_fnames?: boolean;
679
- /**
680
- * Pass `true` to not mangle private props.
681
- */
682
- keepPrivateProps?: boolean;
683
- /**
684
- * @deprecated An alias for compatibility with terser.
685
- */
686
- keep_private_props?: boolean;
687
- ie8?: boolean;
688
- safari10?: boolean;
689
- reserved?: string[];
690
- }
691
- interface TerserManglePropertiesOptions {
692
- }
693
- /**
694
- * Programmatic options.
695
- */
696
- interface Options extends Config {
697
- /**
698
- * If true, a file is parsed as a script instead of module.
699
- */
700
- script?: boolean;
701
- /**
702
- * The working directory that all paths in the programmatic
703
- * options will be resolved relative to.
704
- *
705
- * Defaults to `process.cwd()`.
706
- */
707
- cwd?: string;
708
- caller?: CallerOptions;
709
- /** The filename associated with the code currently being compiled,
710
- * if there is one. The filename is optional, but not all of Swc's
711
- * functionality is available when the filename is unknown, because a
712
- * subset of options rely on the filename for their functionality.
713
- *
714
- * The three primary cases users could run into are:
715
- *
716
- * - The filename is exposed to plugins. Some plugins may require the
717
- * presence of the filename.
718
- * - Options like "test", "exclude", and "ignore" require the filename
719
- * for string/RegExp matching.
720
- * - .swcrc files are loaded relative to the file being compiled.
721
- * If this option is omitted, Swc will behave as if swcrc: false has been set.
722
- */
723
- filename?: string;
724
- /**
725
- * The initial path that will be processed based on the "rootMode" to
726
- * determine the conceptual root folder for the current Swc project.
727
- * This is used in two primary cases:
728
- *
729
- * - The base directory when checking for the default "configFile" value
730
- * - The default value for "swcrcRoots".
731
- *
732
- * Defaults to `opts.cwd`
733
- */
734
- root?: string;
735
- /**
736
- * This option, combined with the "root" value, defines how Swc chooses
737
- * its project root. The different modes define different ways that Swc
738
- * can process the "root" value to get the final project root.
739
- *
740
- * "root" - Passes the "root" value through as unchanged.
741
- * "upward" - Walks upward from the "root" directory, looking for a directory
742
- * containing a swc.config.js file, and throws an error if a swc.config.js
743
- * is not found.
744
- * "upward-optional" - Walk upward from the "root" directory, looking for
745
- * a directory containing a swc.config.js file, and falls back to "root"
746
- * if a swc.config.js is not found.
747
- *
748
- *
749
- * "root" is the default mode because it avoids the risk that Swc
750
- * will accidentally load a swc.config.js that is entirely outside
751
- * of the current project folder. If you use "upward-optional",
752
- * be aware that it will walk up the directory structure all the
753
- * way to the filesystem root, and it is always possible that someone
754
- * will have a forgotten swc.config.js in their home directory,
755
- * which could cause unexpected errors in your builds.
756
- *
757
- *
758
- * Users with monorepo project structures that run builds/tests on a
759
- * per-package basis may well want to use "upward" since monorepos
760
- * often have a swc.config.js in the project root. Running Swc
761
- * in a monorepo subdirectory without "upward", will cause Swc
762
- * to skip loading any swc.config.js files in the project root,
763
- * which can lead to unexpected errors and compilation failure.
764
- */
765
- rootMode?: "root" | "upward" | "upward-optional";
766
- /**
767
- * The current active environment used during configuration loading.
768
- * This value is used as the key when resolving "env" configs,
769
- * and is also available inside configuration functions, plugins,
770
- * and presets, via the api.env() function.
771
- *
772
- * Defaults to `process.env.SWC_ENV || "production" || "development"`
773
- */
774
- envName?: string;
775
- /**
776
- * Defaults to searching for a default `.swcrc` file, but can
777
- * be passed the path of any JS or JSON5 config file.
778
- *
779
- *
780
- * NOTE: This option does not affect loading of .swcrc files,
781
- * so while it may be tempting to do configFile: "./foo/.swcrc",
782
- * it is not recommended. If the given .swcrc is loaded via the
783
- * standard file-relative logic, you'll end up loading the same
784
- * config file twice, merging it with itself. If you are linking
785
- * a specific config file, it is recommended to stick with a
786
- * naming scheme that is independent of the "swcrc" name.
787
- *
788
- * Defaults to `path.resolve(opts.root, ".swcrc")`
789
- */
790
- configFile?: string | boolean;
791
- /**
792
- * true will enable searching for configuration files relative to the "filename" provided to Swc.
793
- *
794
- * A swcrc value passed in the programmatic options will override one set within a configuration file.
795
- *
796
- * Note: .swcrc files are only loaded if the current "filename" is inside of
797
- * a package that matches one of the "swcrcRoots" packages.
798
- *
799
- *
800
- * Defaults to true as long as the filename option has been specified
801
- */
802
- swcrc?: boolean;
803
- /**
804
- * By default, Babel will only search for .babelrc files within the "root" package
805
- * because otherwise Babel cannot know if a given .babelrc is meant to be loaded,
806
- * or if it's "plugins" and "presets" have even been installed, since the file
807
- * being compiled could be inside node_modules, or have been symlinked into the project.
808
- *
809
- *
810
- * This option allows users to provide a list of other packages that should be
811
- * considered "root" packages when considering whether to load .babelrc files.
812
- *
813
- *
814
- * For example, a monorepo setup that wishes to allow individual packages
815
- * to have their own configs might want to do
816
- *
817
- *
818
- *
819
- * Defaults to `opts.root`
820
- */
821
- swcrcRoots?: boolean | MatchPattern | MatchPattern[];
822
- /**
823
- * `true` will attempt to load an input sourcemap from the file itself, if it
824
- * contains a //# sourceMappingURL=... comment. If no map is found, or the
825
- * map fails to load and parse, it will be silently discarded.
826
- *
827
- * If an object is provided, it will be treated as the source map object itself.
828
- *
829
- * Defaults to `true`.
830
- */
831
- inputSourceMap?: boolean | string;
832
- /**
833
- * The name to use for the file inside the source map object.
834
- *
835
- * Defaults to `path.basename(opts.filenameRelative)` when available, or `"unknown"`.
836
- */
837
- sourceFileName?: string;
838
- /**
839
- * The sourceRoot fields to set in the generated source map, if one is desired.
840
- */
841
- sourceRoot?: string;
842
- plugin?: Plugin;
843
- isModule?: boolean | "unknown";
844
- /**
845
- * Destination path. Note that this value is used only to fix source path
846
- * of source map files and swc does not write output to this path.
847
- */
848
- outputPath?: string;
849
- }
850
- interface CallerOptions {
851
- name: string;
852
- [key: string]: any;
853
- }
854
- /**
855
- * .swcrc
856
- */
857
- interface Config {
858
- /**
859
- * Note: The type is string because it follows rust's regex syntax.
860
- */
861
- test?: string | string[];
862
- /**
863
- * Note: The type is string because it follows rust's regex syntax.
864
- */
865
- exclude?: string | string[];
866
- env?: EnvConfig;
867
- jsc?: JscConfig;
868
- module?: ModuleConfig;
869
- minify?: boolean;
870
- /**
871
- * - true to generate a sourcemap for the code and include it in the result object.
872
- * - "inline" to generate a sourcemap and append it as a data URL to the end of the code, but not include it in the result object.
873
- *
874
- * `swc-cli` overloads some of these to also affect how maps are written to disk:
875
- *
876
- * - true will write the map to a .map file on disk
877
- * - "inline" will write the file directly, so it will have a data: containing the map
878
- * - Note: These options are bit weird, so it may make the most sense to just use true
879
- * and handle the rest in your own code, depending on your use case.
880
- */
881
- sourceMaps?: boolean | "inline";
882
- inlineSourcesContent?: boolean;
883
- }
884
- /**
885
- * Configuration ported from babel-preset-env
886
- */
887
- interface EnvConfig {
888
- mode?: "usage" | "entry";
889
- debug?: boolean;
890
- dynamicImport?: boolean;
891
- loose?: boolean;
892
- /**
893
- * Transpiles the broken syntax to the closest non-broken modern syntax
894
- *
895
- * Defaults to false.
896
- */
897
- bugfixes?: boolean;
898
- skip?: string[];
899
- include?: string[];
900
- exclude?: string[];
901
- /**
902
- * The version of the used core js.
903
- *
904
- */
905
- coreJs?: string;
906
- targets?: any;
907
- path?: string;
908
- shippedProposals?: boolean;
909
- /**
910
- * Enable all transforms
911
- */
912
- forceAllTransforms?: boolean;
913
- }
914
- interface JscConfig {
915
- assumptions?: Assumptions;
916
- loose?: boolean;
917
- /**
918
- * Defaults to EsParserConfig
919
- */
920
- parser?: ParserConfig;
921
- transform?: TransformConfig;
922
- /**
923
- * Use `@swc/helpers` instead of inline helpers.
924
- */
925
- externalHelpers?: boolean;
926
- /**
927
- * Defaults to `es3` (which enabled **all** pass).
928
- */
929
- target?: JscTarget;
930
- /**
931
- * Keep class names.
932
- */
933
- keepClassNames?: boolean;
934
- /**
935
- * This is experimental, and can be removed without a major version bump.
936
- */
937
- experimental?: {
938
- optimizeHygiene?: boolean;
939
- /**
940
- * Preserve `with` in imports and exports.
941
- *
942
- * @deprecated Use `keepImportAssertions` instead.
943
- */
944
- keepImportAttributes?: boolean;
945
- /**
946
- * Use `assert` instead of `with` for imports and exports.
947
- * This option only works when `keepImportAttributes` is `true`.
948
- */
949
- emitAssertForImportAttributes?: boolean;
950
- /**
951
- * Specify the location where SWC stores its intermediate cache files.
952
- * Currently only transform plugin uses this. If not specified, SWC will
953
- * create `.swc` directories.
954
- */
955
- cacheRoot?: string;
956
- /**
957
- * List of custom transform plugins written in WebAssembly.
958
- * First parameter of tuple indicates the name of the plugin - it can be either
959
- * a name of the npm package can be resolved, or absolute path to .wasm binary.
960
- *
961
- * Second parameter of tuple is JSON based configuration for the plugin.
962
- */
963
- plugins?: WasmPlugin[];
964
- /**
965
- * Run Wasm plugins before stripping TypeScript or decorators.
966
- *
967
- * See https://github.com/swc-project/swc/issues/9132 for more details.
968
- */
969
- runPluginFirst?: boolean;
970
- /**
971
- * Disable builtin transforms. If enabled, only Wasm plugins are used.
972
- */
973
- disableBuiltinTransformsForInternalTesting?: boolean;
974
- /**
975
- * Emit isolated dts files for each module.
976
- */
977
- emitIsolatedDts?: boolean;
978
- /**
979
- * Disable all lint rules.
980
- */
981
- disableAllLints?: boolean;
982
- /**
983
- * Keep import assertions.
984
- */
985
- keepImportAssertions?: boolean;
986
- };
987
- baseUrl?: string;
988
- paths?: {
989
- [from: string]: string[];
990
- };
991
- minify?: JsMinifyOptions;
992
- preserveAllComments?: boolean;
993
- output?: {
994
- /**
995
- * This can be used to keep the output ascii-only.
996
- * If this option is set, `minify.format.asciiOnly` will be ignored.
997
- * @default 'utf8'
998
- */
999
- charset?: 'utf8' | 'ascii';
1000
- };
1001
- }
1002
- type JscTarget = "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "es2023" | "es2024" | "esnext";
1003
- type ParserConfig = TsParserConfig | EsParserConfig;
1004
- interface TsParserConfig {
1005
- syntax: "typescript";
1006
- /**
1007
- * Defaults to `false`.
1008
- */
1009
- tsx?: boolean;
1010
- /**
1011
- * Defaults to `false`.
1012
- */
1013
- decorators?: boolean;
1014
- /**
1015
- * @deprecated Always true because it's in ecmascript spec.
1016
- */
1017
- dynamicImport?: boolean;
1018
- }
1019
- interface EsParserConfig {
1020
- syntax: "ecmascript";
1021
- /**
1022
- * Defaults to false.
1023
- */
1024
- jsx?: boolean;
1025
- /**
1026
- * @deprecated Always true because it's in ecmascript spec.
1027
- */
1028
- numericSeparator?: boolean;
1029
- /**
1030
- * @deprecated Always true because it's in ecmascript spec.
1031
- */
1032
- classPrivateProperty?: boolean;
1033
- /**
1034
- * @deprecated Always true because it's in ecmascript spec.
1035
- */
1036
- privateMethod?: boolean;
1037
- /**
1038
- * @deprecated Always true because it's in ecmascript spec.
1039
- */
1040
- classProperty?: boolean;
1041
- /**
1042
- * Defaults to `false`
1043
- */
1044
- functionBind?: boolean;
1045
- /**
1046
- * Defaults to `false`
1047
- */
1048
- decorators?: boolean;
1049
- /**
1050
- * Defaults to `false`
1051
- */
1052
- decoratorsBeforeExport?: boolean;
1053
- /**
1054
- * Defaults to `false`
1055
- */
1056
- exportDefaultFrom?: boolean;
1057
- /**
1058
- * @deprecated Always true because it's in ecmascript spec.
1059
- */
1060
- exportNamespaceFrom?: boolean;
1061
- /**
1062
- * @deprecated Always true because it's in ecmascript spec.
1063
- */
1064
- dynamicImport?: boolean;
1065
- /**
1066
- * @deprecated Always true because it's in ecmascript spec.
1067
- */
1068
- nullishCoalescing?: boolean;
1069
- /**
1070
- * @deprecated Always true because it's in ecmascript spec.
1071
- */
1072
- optionalChaining?: boolean;
1073
- /**
1074
- * @deprecated Always true because it's in ecmascript spec.
1075
- */
1076
- importMeta?: boolean;
1077
- /**
1078
- * @deprecated Always true because it's in ecmascript spec.
1079
- */
1080
- topLevelAwait?: boolean;
1081
- /**
1082
- * @deprecated An alias of `importAttributes`
1083
- */
1084
- importAssertions?: boolean;
1085
- /**
1086
- * Defaults to `false`
1087
- */
1088
- importAttributes?: boolean;
1089
- /**
1090
- * Defaults to `false`
1091
- */
1092
- allowSuperOutsideMethod?: boolean;
1093
- /**
1094
- * Defaults to `false`
1095
- */
1096
- allowReturnOutsideFunction?: boolean;
1097
- /**
1098
- * Defaults to `false`
1099
- */
1100
- autoAccessors?: boolean;
1101
- /**
1102
- * Defaults to `false`
1103
- */
1104
- explicitResourceManagement?: boolean;
1105
- }
1106
- /**
1107
- * Options for transform.
1108
- */
1109
- interface TransformConfig {
1110
- /**
1111
- * Effective only if `syntax` supports ƒ.
1112
- */
1113
- react?: ReactConfig;
1114
- constModules?: ConstModulesConfig;
1115
- /**
1116
- * Defaults to null, which skips optimizer pass.
1117
- */
1118
- optimizer?: OptimizerConfig;
1119
- /**
1120
- * https://swc.rs/docs/configuration/compilation#jsctransformlegacydecorator
1121
- */
1122
- legacyDecorator?: boolean;
1123
- /**
1124
- * https://swc.rs/docs/configuration/compilation#jsctransformdecoratormetadata
1125
- */
1126
- decoratorMetadata?: boolean;
1127
- /**
1128
- * https://swc.rs/docs/configuration/compilation#jsctransformdecoratorversion
1129
- */
1130
- decoratorVersion?: "2021-12" | "2022-03";
1131
- treatConstEnumAsEnum?: boolean;
1132
- /**
1133
- * https://www.typescriptlang.org/tsconfig#useDefineForClassFields
1134
- */
1135
- useDefineForClassFields?: boolean;
1136
- /**
1137
- * https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
1138
- */
1139
- verbatimModuleSyntax?: boolean;
1140
- }
1141
- interface ReactConfig {
1142
- /**
1143
- * Replace the function used when compiling JSX expressions.
1144
- *
1145
- * Defaults to `React.createElement`.
1146
- */
1147
- pragma?: string;
1148
- /**
1149
- * Replace the component used when compiling JSX fragments.
1150
- *
1151
- * Defaults to `React.Fragment`
1152
- */
1153
- pragmaFrag?: string;
1154
- /**
1155
- * Toggles whether or not to throw an error if a XML namespaced tag name is used. For example:
1156
- * `<f:image />`
1157
- *
1158
- * Though the JSX spec allows this, it is disabled by default since React's
1159
- * JSX does not currently have support for it.
1160
- *
1161
- */
1162
- throwIfNamespace?: boolean;
1163
- /**
1164
- * Toggles plugins that aid in development, such as @swc/plugin-transform-react-jsx-self
1165
- * and @swc/plugin-transform-react-jsx-source.
1166
- *
1167
- * Defaults to `false`,
1168
- *
1169
- */
1170
- development?: boolean;
1171
- /**
1172
- * Use `Object.assign()` instead of `_extends`. Defaults to false.
1173
- * @deprecated
1174
- */
1175
- useBuiltins?: boolean;
1176
- /**
1177
- * Enable fast refresh feature for React app
1178
- */
1179
- refresh?: boolean | {
1180
- /**
1181
- * Identifier for the `react-refresh` register function.
1182
- *
1183
- * Defaults to `$RefreshReg$`
1184
- */
1185
- refreshReg?: string;
1186
- /**
1187
- * Identifier for the `react-refresh` signature function.
1188
- *
1189
- * Defaults to `$RefreshSig$`
1190
- */
1191
- refreshSig?: string;
1192
- /**
1193
- * Flag to emit full signatures.
1194
- *
1195
- * Defaults to `false`
1196
- */
1197
- emitFullSignatures?: boolean;
1198
- };
1199
- /**
1200
- * jsx runtime
1201
- */
1202
- runtime?: "automatic" | "classic";
1203
- /**
1204
- * Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using `runtime` 'automatic'
1205
- */
1206
- importSource?: string;
1207
- }
1208
- /**
1209
- * - `import { DEBUG } from '@ember/env-flags';`
1210
- * - `import { FEATURE_A, FEATURE_B } from '@ember/features';`
1211
- *
1212
- * See: https://github.com/swc-project/swc/issues/18#issuecomment-466272558
1213
- */
1214
- interface ConstModulesConfig {
1215
- globals?: {
1216
- [module: string]: {
1217
- [name: string]: string;
1218
- };
1219
- };
1220
- }
1221
- interface OptimizerConfig {
1222
- simplify?: boolean;
1223
- globals?: GlobalPassOption;
1224
- jsonify?: {
1225
- minCost: number;
1226
- };
1227
- }
1228
- /**
1229
- * Options for inline-global pass.
1230
- */
1231
- interface GlobalPassOption {
1232
- /**
1233
- * Global variables that should be inlined with passed value.
1234
- *
1235
- * e.g. `{ __DEBUG__: true }`
1236
- */
1237
- vars?: Record<string, string>;
1238
- /**
1239
- * Names of environment variables that should be inlined with the value of corresponding env during build.
1240
- *
1241
- * Defaults to `["NODE_ENV", "SWC_ENV"]`
1242
- */
1243
- envs?: string[] | Record<string, string>;
1244
- /**
1245
- * Replaces typeof calls for passed variables with corresponding value
1246
- *
1247
- * e.g. `{ window: 'object' }`
1248
- */
1249
- typeofs?: Record<string, string>;
1250
- }
1251
- type ModuleConfig = Es6Config | CommonJsConfig | UmdConfig | AmdConfig | NodeNextConfig | SystemjsConfig;
1252
- interface BaseModuleConfig {
1253
- /**
1254
- * By default, when using exports with babel a non-enumerable `__esModule`
1255
- * property is exported. In some cases this property is used to determine
1256
- * if the import is the default export or if it contains the default export.
1257
- *
1258
- * In order to prevent the __esModule property from being exported, you
1259
- * can set the strict option to true.
1260
- *
1261
- * Defaults to `false`.
1262
- */
1263
- strict?: boolean;
1264
- /**
1265
- * Emits 'use strict' directive.
1266
- *
1267
- * Defaults to `true`.
1268
- */
1269
- strictMode?: boolean;
1270
- /**
1271
- * Changes Babel's compiled import statements to be lazily evaluated when their imported bindings are used for the first time.
1272
- *
1273
- * This can improve initial load time of your module because evaluating dependencies up
1274
- * front is sometimes entirely un-necessary. This is especially the case when implementing
1275
- * a library module.
1276
- *
1277
- *
1278
- * The value of `lazy` has a few possible effects:
1279
- *
1280
- * - `false` - No lazy initialization of any imported module.
1281
- * - `true` - Do not lazy-initialize local `./foo` imports, but lazy-init `foo` dependencies.
1282
- *
1283
- * Local paths are much more likely to have circular dependencies, which may break if loaded lazily,
1284
- * so they are not lazy by default, whereas dependencies between independent modules are rarely cyclical.
1285
- *
1286
- * - `Array<string>` - Lazy-initialize all imports with source matching one of the given strings.
1287
- *
1288
- * -----
1289
- *
1290
- * The two cases where imports can never be lazy are:
1291
- *
1292
- * - `import "foo";`
1293
- *
1294
- * Side-effect imports are automatically non-lazy since their very existence means
1295
- * that there is no binding to later kick off initialization.
1296
- *
1297
- * - `export * from "foo"`
1298
- *
1299
- * Re-exporting all names requires up-front execution because otherwise there is no
1300
- * way to know what names need to be exported.
1301
- *
1302
- * Defaults to `false`.
1303
- */
1304
- lazy?: boolean | string[];
1305
- /**
1306
- * @deprecated Use the `importInterop` option instead.
1307
- *
1308
- * By default, when using exports with swc a non-enumerable __esModule property is exported.
1309
- * This property is then used to determine if the import is the default export or if
1310
- * it contains the default export.
1311
- *
1312
- * In cases where the auto-unwrapping of default is not needed, you can set the noInterop option
1313
- * to true to avoid the usage of the interopRequireDefault helper (shown in inline form above).
1314
- *
1315
- * Defaults to `false`.
1316
- */
1317
- noInterop?: boolean;
1318
- /**
1319
- * Defaults to `swc`.
1320
- *
1321
- * CommonJS modules and ECMAScript modules are not fully compatible.
1322
- * However, compilers, bundlers and JavaScript runtimes developed different strategies
1323
- * to make them work together as well as possible.
1324
- *
1325
- * - `swc` (alias: `babel`)
1326
- *
1327
- * When using exports with `swc` a non-enumerable `__esModule` property is exported
1328
- * This property is then used to determine if the import is the default export
1329
- * or if it contains the default export.
1330
- *
1331
- * ```javascript
1332
- * import foo from "foo";
1333
- * import { bar } from "bar";
1334
- * foo;
1335
- * bar;
1336
- *
1337
- * // Is compiled to ...
1338
- *
1339
- * "use strict";
1340
- *
1341
- * function _interop_require_default(obj) {
1342
- * return obj && obj.__esModule ? obj : { default: obj };
1343
- * }
1344
- *
1345
- * var _foo = _interop_require_default(require("foo"));
1346
- * var _bar = require("bar");
1347
- *
1348
- * _foo.default;
1349
- * _bar.bar;
1350
- * ```
1351
- *
1352
- * When this import interop is used, if both the imported and the importer module are compiled
1353
- * with swc they behave as if none of them was compiled.
1354
- *
1355
- * This is the default behavior.
1356
- *
1357
- * - `node`
1358
- *
1359
- * When importing CommonJS files (either directly written in CommonJS, or generated with a compiler)
1360
- * Node.js always binds the `default` export to the value of `module.exports`.
1361
- *
1362
- * ```javascript
1363
- * import foo from "foo";
1364
- * import { bar } from "bar";
1365
- * foo;
1366
- * bar;
1367
- *
1368
- * // Is compiled to ...
1369
- *
1370
- * "use strict";
1371
- *
1372
- * var _foo = require("foo");
1373
- * var _bar = require("bar");
1374
- *
1375
- * _foo;
1376
- * _bar.bar;
1377
- * ```
1378
- * This is not exactly the same as what Node.js does since swc allows accessing any property of `module.exports`
1379
- * as a named export, while Node.js only allows importing statically analyzable properties of `module.exports`.
1380
- * However, any import working in Node.js will also work when compiled with swc using `importInterop: "node"`.
1381
- *
1382
- * - `none`
1383
- *
1384
- * If you know that the imported file has been transformed with a compiler that stores the `default` export on
1385
- * `exports.default` (such as swc or Babel), you can safely omit the `_interop_require_default` helper.
1386
- *
1387
- * ```javascript
1388
- * import foo from "foo";
1389
- * import { bar } from "bar";
1390
- * foo;
1391
- * bar;
1392
- *
1393
- * // Is compiled to ...
1394
- *
1395
- * "use strict";
1396
- *
1397
- * var _foo = require("foo");
1398
- * var _bar = require("bar");
1399
- *
1400
- * _foo.default;
1401
- * _bar.bar;
1402
- * ```
1403
- */
1404
- importInterop?: "swc" | "babel" | "node" | "none";
1405
- /**
1406
- * Output extension for generated files.
1407
- *
1408
- * Defaults to `js`.
1409
- */
1410
- outFileExtension?: "js" | "mjs" | "cjs";
1411
- /**
1412
- * Emits `cjs-module-lexer` annotation
1413
- * `cjs-module-lexer` is used in Node.js core for detecting the named exports available when importing a CJS module into ESM.
1414
- * swc will emit `cjs-module-lexer` detectable annotation with this option enabled.
1415
- *
1416
- * Defaults to `true` if import_interop is Node, else `false`
1417
- */
1418
- exportInteropAnnotation?: boolean;
1419
- /**
1420
- * If set to true, dynamic imports will be preserved.
1421
- */
1422
- ignoreDynamic?: boolean;
1423
- allowTopLevelThis?: boolean;
1424
- preserveImportMeta?: boolean;
1425
- /**
1426
- * If set to true, This will resolve top .mjs
1427
- */
1428
- resolveFully?: boolean;
1429
- }
1430
- interface Es6Config extends BaseModuleConfig {
1431
- type: "es6";
1432
- }
1433
- interface NodeNextConfig extends BaseModuleConfig {
1434
- type: "nodenext";
1435
- }
1436
- interface CommonJsConfig extends BaseModuleConfig {
1437
- type: "commonjs";
1438
- }
1439
- interface UmdConfig extends BaseModuleConfig {
1440
- type: "umd";
1441
- globals?: {
1442
- [key: string]: string;
1443
- };
1444
- }
1445
- interface AmdConfig extends BaseModuleConfig {
1446
- type: "amd";
1447
- moduleId?: string;
1448
- }
1449
- interface SystemjsConfig {
1450
- type: "systemjs";
1451
- allowTopLevelThis?: boolean;
1452
- }
1453
- interface MatchPattern {
1454
- }
1455
- interface Span {
1456
- start: number;
1457
- end: number;
1458
- ctxt: number;
1459
- }
1460
- interface Node {
1461
- type: string;
1462
- }
1463
- interface HasSpan {
1464
- span: Span;
1465
- }
1466
- interface HasDecorator {
1467
- decorators?: Decorator[];
1468
- }
1469
- interface Class extends HasSpan, HasDecorator {
1470
- body: ClassMember[];
1471
- superClass?: Expression;
1472
- isAbstract: boolean;
1473
- typeParams?: TsTypeParameterDeclaration;
1474
- superTypeParams?: TsTypeParameterInstantiation;
1475
- implements: TsExpressionWithTypeArguments[];
1476
- }
1477
- type ClassMember = Constructor | ClassMethod | PrivateMethod | ClassProperty | PrivateProperty | TsIndexSignature | EmptyStatement | StaticBlock;
1478
- interface ClassPropertyBase extends Node, HasSpan, HasDecorator {
1479
- value?: Expression;
1480
- typeAnnotation?: TsTypeAnnotation;
1481
- isStatic: boolean;
1482
- accessibility?: Accessibility;
1483
- isOptional: boolean;
1484
- isOverride: boolean;
1485
- readonly: boolean;
1486
- definite: boolean;
1487
- }
1488
- interface ClassProperty extends ClassPropertyBase {
1489
- type: "ClassProperty";
1490
- key: PropertyName;
1491
- isAbstract: boolean;
1492
- declare: boolean;
1493
- }
1494
- interface PrivateProperty extends ClassPropertyBase {
1495
- type: "PrivateProperty";
1496
- key: PrivateName;
1497
- }
1498
- interface Param extends Node, HasSpan, HasDecorator {
1499
- type: "Parameter";
1500
- pat: Pattern;
1501
- }
1502
- interface Constructor extends Node, HasSpan {
1503
- type: "Constructor";
1504
- key: PropertyName;
1505
- params: (TsParameterProperty | Param)[];
1506
- body?: BlockStatement;
1507
- accessibility?: Accessibility;
1508
- isOptional: boolean;
1509
- }
1510
- interface ClassMethodBase extends Node, HasSpan {
1511
- function: Fn;
1512
- kind: MethodKind;
1513
- isStatic: boolean;
1514
- accessibility?: Accessibility;
1515
- isAbstract: boolean;
1516
- isOptional: boolean;
1517
- isOverride: boolean;
1518
- }
1519
- interface ClassMethod extends ClassMethodBase {
1520
- type: "ClassMethod";
1521
- key: PropertyName;
1522
- }
1523
- interface PrivateMethod extends ClassMethodBase {
1524
- type: "PrivateMethod";
1525
- key: PrivateName;
1526
- }
1527
- interface StaticBlock extends Node, HasSpan {
1528
- type: "StaticBlock";
1529
- body: BlockStatement;
1530
- }
1531
- interface Decorator extends Node, HasSpan {
1532
- type: "Decorator";
1533
- expression: Expression;
1534
- }
1535
- type MethodKind = "method" | "getter" | "setter";
1536
- type Declaration = ClassDeclaration | FunctionDeclaration | VariableDeclaration | TsInterfaceDeclaration | TsTypeAliasDeclaration | TsEnumDeclaration | TsModuleDeclaration;
1537
- interface FunctionDeclaration extends Fn {
1538
- type: "FunctionDeclaration";
1539
- identifier: Identifier;
1540
- declare: boolean;
1541
- }
1542
- interface ClassDeclaration extends Class, Node {
1543
- type: "ClassDeclaration";
1544
- identifier: Identifier;
1545
- declare: boolean;
1546
- }
1547
- interface VariableDeclaration extends Node, HasSpan {
1548
- type: "VariableDeclaration";
1549
- kind: VariableDeclarationKind;
1550
- declare: boolean;
1551
- declarations: VariableDeclarator[];
1552
- }
1553
- type VariableDeclarationKind = "var" | "let" | "const";
1554
- interface VariableDeclarator extends Node, HasSpan {
1555
- type: "VariableDeclarator";
1556
- id: Pattern;
1557
- init?: Expression;
1558
- definite: boolean;
1559
- }
1560
- type Expression = ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | MemberExpression | SuperPropExpression | ConditionalExpression | CallExpression | NewExpression | SequenceExpression | Identifier | Literal | TemplateLiteral | TaggedTemplateExpression | ArrowFunctionExpression | ClassExpression | YieldExpression | MetaProperty | AwaitExpression | ParenthesisExpression | JSXMemberExpression | JSXNamespacedName | JSXEmptyExpression | JSXElement | JSXFragment | TsTypeAssertion | TsConstAssertion | TsNonNullExpression | TsAsExpression | TsSatisfiesExpression | TsInstantiation | PrivateName | OptionalChainingExpression | Invalid;
1561
- interface ExpressionBase extends Node, HasSpan {
1562
- }
1563
- interface Identifier extends ExpressionBase {
1564
- type: "Identifier";
1565
- value: string;
1566
- optional: boolean;
1567
- }
1568
- interface OptionalChainingExpression extends ExpressionBase {
1569
- type: "OptionalChainingExpression";
1570
- questionDotToken: Span;
1571
- /**
1572
- * Call expression or member expression.
1573
- */
1574
- base: MemberExpression | OptionalChainingCall;
1575
- }
1576
- interface OptionalChainingCall extends ExpressionBase {
1577
- type: "CallExpression";
1578
- callee: Expression;
1579
- arguments: ExprOrSpread[];
1580
- typeArguments?: TsTypeParameterInstantiation;
1581
- }
1582
- interface ThisExpression extends ExpressionBase {
1583
- type: "ThisExpression";
1584
- }
1585
- interface ArrayExpression extends ExpressionBase {
1586
- type: "ArrayExpression";
1587
- elements: (ExprOrSpread | undefined)[];
1588
- }
1589
- interface ExprOrSpread {
1590
- spread?: Span;
1591
- expression: Expression;
1592
- }
1593
- interface ObjectExpression extends ExpressionBase {
1594
- type: "ObjectExpression";
1595
- properties: (SpreadElement | Property)[];
1596
- }
1597
- interface Argument {
1598
- spread?: Span;
1599
- expression: Expression;
1600
- }
1601
- interface SpreadElement extends Node {
1602
- type: "SpreadElement";
1603
- spread: Span;
1604
- arguments: Expression;
1605
- }
1606
- interface UnaryExpression extends ExpressionBase {
1607
- type: "UnaryExpression";
1608
- operator: UnaryOperator;
1609
- argument: Expression;
1610
- }
1611
- interface UpdateExpression extends ExpressionBase {
1612
- type: "UpdateExpression";
1613
- operator: UpdateOperator;
1614
- prefix: boolean;
1615
- argument: Expression;
1616
- }
1617
- interface BinaryExpression extends ExpressionBase {
1618
- type: "BinaryExpression";
1619
- operator: BinaryOperator;
1620
- left: Expression;
1621
- right: Expression;
1622
- }
1623
- interface FunctionExpression extends Fn, ExpressionBase {
1624
- type: "FunctionExpression";
1625
- identifier?: Identifier;
1626
- }
1627
- interface ClassExpression extends Class, ExpressionBase {
1628
- type: "ClassExpression";
1629
- identifier?: Identifier;
1630
- }
1631
- interface AssignmentExpression extends ExpressionBase {
1632
- type: "AssignmentExpression";
1633
- operator: AssignmentOperator;
1634
- left: Expression | Pattern;
1635
- right: Expression;
1636
- }
1637
- interface MemberExpression extends ExpressionBase {
1638
- type: "MemberExpression";
1639
- object: Expression;
1640
- property: Identifier | PrivateName | ComputedPropName;
1641
- }
1642
- interface SuperPropExpression extends ExpressionBase {
1643
- type: "SuperPropExpression";
1644
- obj: Super;
1645
- property: Identifier | ComputedPropName;
1646
- }
1647
- interface ConditionalExpression extends ExpressionBase {
1648
- type: "ConditionalExpression";
1649
- test: Expression;
1650
- consequent: Expression;
1651
- alternate: Expression;
1652
- }
1653
- interface Super extends Node, HasSpan {
1654
- type: "Super";
1655
- }
1656
- interface Import extends Node, HasSpan {
1657
- type: "Import";
1658
- }
1659
- interface CallExpression extends ExpressionBase {
1660
- type: "CallExpression";
1661
- callee: Super | Import | Expression;
1662
- arguments: Argument[];
1663
- typeArguments?: TsTypeParameterInstantiation;
1664
- }
1665
- interface NewExpression extends ExpressionBase {
1666
- type: "NewExpression";
1667
- callee: Expression;
1668
- arguments?: Argument[];
1669
- typeArguments?: TsTypeParameterInstantiation;
1670
- }
1671
- interface SequenceExpression extends ExpressionBase {
1672
- type: "SequenceExpression";
1673
- expressions: Expression[];
1674
- }
1675
- interface ArrowFunctionExpression extends ExpressionBase {
1676
- type: "ArrowFunctionExpression";
1677
- params: Pattern[];
1678
- body: BlockStatement | Expression;
1679
- async: boolean;
1680
- generator: boolean;
1681
- typeParameters?: TsTypeParameterDeclaration;
1682
- returnType?: TsTypeAnnotation;
1683
- }
1684
- interface YieldExpression extends ExpressionBase {
1685
- type: "YieldExpression";
1686
- argument?: Expression;
1687
- delegate: boolean;
1688
- }
1689
- interface MetaProperty extends Node, HasSpan {
1690
- type: "MetaProperty";
1691
- kind: "new.target" | "import.meta";
1692
- }
1693
- interface AwaitExpression extends ExpressionBase {
1694
- type: "AwaitExpression";
1695
- argument: Expression;
1696
- }
1697
- interface TemplateLiteral extends ExpressionBase {
1698
- type: "TemplateLiteral";
1699
- expressions: Expression[];
1700
- quasis: TemplateElement[];
1701
- }
1702
- interface TaggedTemplateExpression extends ExpressionBase {
1703
- type: "TaggedTemplateExpression";
1704
- tag: Expression;
1705
- typeParameters?: TsTypeParameterInstantiation;
1706
- template: TemplateLiteral;
1707
- }
1708
- interface TemplateElement extends ExpressionBase {
1709
- type: "TemplateElement";
1710
- tail: boolean;
1711
- cooked?: string;
1712
- raw: string;
1713
- }
1714
- interface ParenthesisExpression extends ExpressionBase {
1715
- type: "ParenthesisExpression";
1716
- expression: Expression;
1717
- }
1718
- interface Fn extends HasSpan, HasDecorator {
1719
- params: Param[];
1720
- body?: BlockStatement;
1721
- generator: boolean;
1722
- async: boolean;
1723
- typeParameters?: TsTypeParameterDeclaration;
1724
- returnType?: TsTypeAnnotation;
1725
- }
1726
- interface PatternBase extends Node, HasSpan {
1727
- typeAnnotation?: TsTypeAnnotation;
1728
- }
1729
- interface PrivateName extends ExpressionBase {
1730
- type: "PrivateName";
1731
- id: Identifier;
1732
- }
1733
- type JSXObject = JSXMemberExpression | Identifier;
1734
- interface JSXMemberExpression extends Node {
1735
- type: "JSXMemberExpression";
1736
- object: JSXObject;
1737
- property: Identifier;
1738
- }
1739
- /**
1740
- * XML-based namespace syntax:
1741
- */
1742
- interface JSXNamespacedName extends Node {
1743
- type: "JSXNamespacedName";
1744
- namespace: Identifier;
1745
- name: Identifier;
1746
- }
1747
- interface JSXEmptyExpression extends Node, HasSpan {
1748
- type: "JSXEmptyExpression";
1749
- }
1750
- interface JSXExpressionContainer extends Node, HasSpan {
1751
- type: "JSXExpressionContainer";
1752
- expression: JSXExpression;
1753
- }
1754
- type JSXExpression = JSXEmptyExpression | Expression;
1755
- interface JSXSpreadChild extends Node, HasSpan {
1756
- type: "JSXSpreadChild";
1757
- expression: Expression;
1758
- }
1759
- type JSXElementName = Identifier | JSXMemberExpression | JSXNamespacedName;
1760
- interface JSXOpeningElement extends Node, HasSpan {
1761
- type: "JSXOpeningElement";
1762
- name: JSXElementName;
1763
- attributes: JSXAttributeOrSpread[];
1764
- selfClosing: boolean;
1765
- typeArguments?: TsTypeParameterInstantiation;
1766
- }
1767
- type JSXAttributeOrSpread = JSXAttribute | SpreadElement;
1768
- interface JSXClosingElement extends Node, HasSpan {
1769
- type: "JSXClosingElement";
1770
- name: JSXElementName;
1771
- }
1772
- interface JSXAttribute extends Node, HasSpan {
1773
- type: "JSXAttribute";
1774
- name: JSXAttributeName;
1775
- value?: JSXAttrValue;
1776
- }
1777
- type JSXAttributeName = Identifier | JSXNamespacedName;
1778
- type JSXAttrValue = Literal | JSXExpressionContainer | JSXElement | JSXFragment;
1779
- interface JSXText extends Node, HasSpan {
1780
- type: "JSXText";
1781
- value: string;
1782
- raw: string;
1783
- }
1784
- interface JSXElement extends Node, HasSpan {
1785
- type: "JSXElement";
1786
- opening: JSXOpeningElement;
1787
- children: JSXElementChild[];
1788
- closing?: JSXClosingElement;
1789
- }
1790
- type JSXElementChild = JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment;
1791
- interface JSXFragment extends Node, HasSpan {
1792
- type: "JSXFragment";
1793
- opening: JSXOpeningFragment;
1794
- children: JSXElementChild[];
1795
- closing: JSXClosingFragment;
1796
- }
1797
- interface JSXOpeningFragment extends Node, HasSpan {
1798
- type: "JSXOpeningFragment";
1799
- }
1800
- interface JSXClosingFragment extends Node, HasSpan {
1801
- type: "JSXClosingFragment";
1802
- }
1803
- type Literal = StringLiteral | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | JSXText;
1804
- interface StringLiteral extends Node, HasSpan {
1805
- type: "StringLiteral";
1806
- value: string;
1807
- raw?: string;
1808
- }
1809
- interface BooleanLiteral extends Node, HasSpan {
1810
- type: "BooleanLiteral";
1811
- value: boolean;
1812
- }
1813
- interface NullLiteral extends Node, HasSpan {
1814
- type: "NullLiteral";
1815
- }
1816
- interface RegExpLiteral extends Node, HasSpan {
1817
- type: "RegExpLiteral";
1818
- pattern: string;
1819
- flags: string;
1820
- }
1821
- interface NumericLiteral extends Node, HasSpan {
1822
- type: "NumericLiteral";
1823
- value: number;
1824
- raw?: string;
1825
- }
1826
- interface BigIntLiteral extends Node, HasSpan {
1827
- type: "BigIntLiteral";
1828
- value: bigint;
1829
- raw?: string;
1830
- }
1831
- type ModuleDeclaration = ImportDeclaration | ExportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportDefaultExpression | ExportAllDeclaration | TsImportEqualsDeclaration | TsExportAssignment | TsNamespaceExportDeclaration;
1832
- interface ExportDefaultExpression extends Node, HasSpan {
1833
- type: "ExportDefaultExpression";
1834
- expression: Expression;
1835
- }
1836
- interface ExportDeclaration extends Node, HasSpan {
1837
- type: "ExportDeclaration";
1838
- declaration: Declaration;
1839
- }
1840
- interface ImportDeclaration extends Node, HasSpan {
1841
- type: "ImportDeclaration";
1842
- specifiers: ImportSpecifier[];
1843
- source: StringLiteral;
1844
- typeOnly: boolean;
1845
- asserts?: ObjectExpression;
1846
- }
1847
- interface ExportAllDeclaration extends Node, HasSpan {
1848
- type: "ExportAllDeclaration";
1849
- source: StringLiteral;
1850
- asserts?: ObjectExpression;
1851
- }
1852
- /**
1853
- * - `export { foo } from 'mod'`
1854
- * - `export { foo as bar } from 'mod'`
1855
- */
1856
- interface ExportNamedDeclaration extends Node, HasSpan {
1857
- type: "ExportNamedDeclaration";
1858
- specifiers: ExportSpecifier[];
1859
- source?: StringLiteral;
1860
- typeOnly: boolean;
1861
- asserts?: ObjectExpression;
1862
- }
1863
- interface ExportDefaultDeclaration extends Node, HasSpan {
1864
- type: "ExportDefaultDeclaration";
1865
- decl: DefaultDecl;
1866
- }
1867
- type DefaultDecl = ClassExpression | FunctionExpression | TsInterfaceDeclaration;
1868
- type ImportSpecifier = NamedImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
1869
- /**
1870
- * e.g. `import foo from 'mod.js'`
1871
- */
1872
- interface ImportDefaultSpecifier extends Node, HasSpan {
1873
- type: "ImportDefaultSpecifier";
1874
- local: Identifier;
1875
- }
1876
- /**
1877
- * e.g. `import * as foo from 'mod.js'`.
1878
- */
1879
- interface ImportNamespaceSpecifier extends Node, HasSpan {
1880
- type: "ImportNamespaceSpecifier";
1881
- local: Identifier;
1882
- }
1883
- /**
1884
- * e.g. - `import { foo } from 'mod.js'`
1885
- *
1886
- * local = foo, imported = None
1887
- *
1888
- * e.g. `import { foo as bar } from 'mod.js'`
1889
- *
1890
- * local = bar, imported = Some(foo) for
1891
- */
1892
- interface NamedImportSpecifier extends Node, HasSpan {
1893
- type: "ImportSpecifier";
1894
- local: Identifier;
1895
- imported?: ModuleExportName;
1896
- isTypeOnly: boolean;
1897
- }
1898
- type ModuleExportName = Identifier | StringLiteral;
1899
- type ExportSpecifier = ExportNamespaceSpecifier | ExportDefaultSpecifier | NamedExportSpecifier;
1900
- /**
1901
- * `export * as foo from 'src';`
1902
- */
1903
- interface ExportNamespaceSpecifier extends Node, HasSpan {
1904
- type: "ExportNamespaceSpecifier";
1905
- name: ModuleExportName;
1906
- }
1907
- interface ExportDefaultSpecifier extends Node, HasSpan {
1908
- type: "ExportDefaultSpecifier";
1909
- exported: Identifier;
1910
- }
1911
- interface NamedExportSpecifier extends Node, HasSpan {
1912
- type: "ExportSpecifier";
1913
- orig: ModuleExportName;
1914
- /**
1915
- * `Some(bar)` in `export { foo as bar }`
1916
- */
1917
- exported?: ModuleExportName;
1918
- isTypeOnly: boolean;
1919
- }
1920
- interface HasInterpreter {
1921
- /**
1922
- * e.g. `/usr/bin/node` for `#!/usr/bin/node`
1923
- */
1924
- interpreter: string;
1925
- }
1926
- type Program = Module | Script;
1927
- interface Module extends Node, HasSpan, HasInterpreter {
1928
- type: "Module";
1929
- body: ModuleItem[];
1930
- }
1931
- interface Script extends Node, HasSpan, HasInterpreter {
1932
- type: "Script";
1933
- body: Statement[];
1934
- }
1935
- type ModuleItem = ModuleDeclaration | Statement;
1936
- type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "||" | "&&" | "in" | "instanceof" | "**" | "??";
1937
- type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "**=" | "&&=" | "||=" | "??=";
1938
- type UpdateOperator = "++" | "--";
1939
- type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
1940
- type Pattern = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern | AssignmentPattern | Invalid | Expression;
1941
- interface BindingIdentifier extends PatternBase {
1942
- type: "Identifier";
1943
- value: string;
1944
- optional: boolean;
1945
- }
1946
- interface ArrayPattern extends PatternBase {
1947
- type: "ArrayPattern";
1948
- elements: (Pattern | undefined)[];
1949
- optional: boolean;
1950
- }
1951
- interface ObjectPattern extends PatternBase {
1952
- type: "ObjectPattern";
1953
- properties: ObjectPatternProperty[];
1954
- optional: boolean;
1955
- }
1956
- interface AssignmentPattern extends PatternBase {
1957
- type: "AssignmentPattern";
1958
- left: Pattern;
1959
- right: Expression;
1960
- }
1961
- interface RestElement extends PatternBase {
1962
- type: "RestElement";
1963
- rest: Span;
1964
- argument: Pattern;
1965
- }
1966
- type ObjectPatternProperty = KeyValuePatternProperty | AssignmentPatternProperty | RestElement;
1967
- /**
1968
- * `{key: value}`
1969
- */
1970
- interface KeyValuePatternProperty extends Node {
1971
- type: "KeyValuePatternProperty";
1972
- key: PropertyName;
1973
- value: Pattern;
1974
- }
1975
- /**
1976
- * `{key}` or `{key = value}`
1977
- */
1978
- interface AssignmentPatternProperty extends Node, HasSpan {
1979
- type: "AssignmentPatternProperty";
1980
- key: Identifier;
1981
- value?: Expression;
1982
- }
1983
- /** Identifier is `a` in `{ a, }` */
1984
- type Property = Identifier | KeyValueProperty | AssignmentProperty | GetterProperty | SetterProperty | MethodProperty;
1985
- interface PropBase extends Node {
1986
- key: PropertyName;
1987
- }
1988
- interface KeyValueProperty extends PropBase {
1989
- type: "KeyValueProperty";
1990
- value: Expression;
1991
- }
1992
- interface AssignmentProperty extends Node {
1993
- type: "AssignmentProperty";
1994
- key: Identifier;
1995
- value: Expression;
1996
- }
1997
- interface GetterProperty extends PropBase, HasSpan {
1998
- type: "GetterProperty";
1999
- typeAnnotation?: TsTypeAnnotation;
2000
- body?: BlockStatement;
2001
- }
2002
- interface SetterProperty extends PropBase, HasSpan {
2003
- type: "SetterProperty";
2004
- param: Pattern;
2005
- body?: BlockStatement;
2006
- }
2007
- interface MethodProperty extends PropBase, Fn {
2008
- type: "MethodProperty";
2009
- }
2010
- type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropName | BigIntLiteral;
2011
- interface ComputedPropName extends Node, HasSpan {
2012
- type: "Computed";
2013
- expression: Expression;
2014
- }
2015
- interface BlockStatement extends Node, HasSpan {
2016
- type: "BlockStatement";
2017
- stmts: Statement[];
2018
- }
2019
- interface ExpressionStatement extends Node, HasSpan {
2020
- type: "ExpressionStatement";
2021
- expression: Expression;
2022
- }
2023
- type Statement = BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration | ExpressionStatement;
2024
- interface EmptyStatement extends Node, HasSpan {
2025
- type: "EmptyStatement";
2026
- }
2027
- interface DebuggerStatement extends Node, HasSpan {
2028
- type: "DebuggerStatement";
2029
- }
2030
- interface WithStatement extends Node, HasSpan {
2031
- type: "WithStatement";
2032
- object: Expression;
2033
- body: Statement;
2034
- }
2035
- interface ReturnStatement extends Node, HasSpan {
2036
- type: "ReturnStatement";
2037
- argument?: Expression;
2038
- }
2039
- interface LabeledStatement extends Node, HasSpan {
2040
- type: "LabeledStatement";
2041
- label: Identifier;
2042
- body: Statement;
2043
- }
2044
- interface BreakStatement extends Node, HasSpan {
2045
- type: "BreakStatement";
2046
- label?: Identifier;
2047
- }
2048
- interface ContinueStatement extends Node, HasSpan {
2049
- type: "ContinueStatement";
2050
- label?: Identifier;
2051
- }
2052
- interface IfStatement extends Node, HasSpan {
2053
- type: "IfStatement";
2054
- test: Expression;
2055
- consequent: Statement;
2056
- alternate?: Statement;
2057
- }
2058
- interface SwitchStatement extends Node, HasSpan {
2059
- type: "SwitchStatement";
2060
- discriminant: Expression;
2061
- cases: SwitchCase[];
2062
- }
2063
- interface ThrowStatement extends Node, HasSpan {
2064
- type: "ThrowStatement";
2065
- argument: Expression;
2066
- }
2067
- interface TryStatement extends Node, HasSpan {
2068
- type: "TryStatement";
2069
- block: BlockStatement;
2070
- handler?: CatchClause;
2071
- finalizer?: BlockStatement;
2072
- }
2073
- interface WhileStatement extends Node, HasSpan {
2074
- type: "WhileStatement";
2075
- test: Expression;
2076
- body: Statement;
2077
- }
2078
- interface DoWhileStatement extends Node, HasSpan {
2079
- type: "DoWhileStatement";
2080
- test: Expression;
2081
- body: Statement;
2082
- }
2083
- interface ForStatement extends Node, HasSpan {
2084
- type: "ForStatement";
2085
- init?: VariableDeclaration | Expression;
2086
- test?: Expression;
2087
- update?: Expression;
2088
- body: Statement;
2089
- }
2090
- interface ForInStatement extends Node, HasSpan {
2091
- type: "ForInStatement";
2092
- left: VariableDeclaration | Pattern;
2093
- right: Expression;
2094
- body: Statement;
2095
- }
2096
- interface ForOfStatement extends Node, HasSpan {
2097
- type: "ForOfStatement";
2098
- /**
2099
- * Span of the await token.
2100
- *
2101
- * es2018 for-await-of statements, e.g., `for await (const x of xs) {`
2102
- */
2103
- await?: Span;
2104
- left: VariableDeclaration | Pattern;
2105
- right: Expression;
2106
- body: Statement;
2107
- }
2108
- interface SwitchCase extends Node, HasSpan {
2109
- type: "SwitchCase";
2110
- /**
2111
- * Undefined for default case
2112
- */
2113
- test?: Expression;
2114
- consequent: Statement[];
2115
- }
2116
- interface CatchClause extends Node, HasSpan {
2117
- type: "CatchClause";
2118
- /**
2119
- * The param is `undefined` if the catch binding is omitted. E.g., `try { foo() } catch {}`
2120
- */
2121
- param?: Pattern;
2122
- body: BlockStatement;
2123
- }
2124
- interface TsTypeAnnotation extends Node, HasSpan {
2125
- type: "TsTypeAnnotation";
2126
- typeAnnotation: TsType;
2127
- }
2128
- interface TsTypeParameterDeclaration extends Node, HasSpan {
2129
- type: "TsTypeParameterDeclaration";
2130
- parameters: TsTypeParameter[];
2131
- }
2132
- interface TsTypeParameter extends Node, HasSpan {
2133
- type: "TsTypeParameter";
2134
- name: Identifier;
2135
- in: boolean;
2136
- out: boolean;
2137
- constraint?: TsType;
2138
- default?: TsType;
2139
- }
2140
- interface TsTypeParameterInstantiation extends Node, HasSpan {
2141
- type: "TsTypeParameterInstantiation";
2142
- params: TsType[];
2143
- }
2144
- interface TsParameterProperty extends Node, HasSpan, HasDecorator {
2145
- type: "TsParameterProperty";
2146
- accessibility?: Accessibility;
2147
- override: boolean;
2148
- readonly: boolean;
2149
- param: TsParameterPropertyParameter;
2150
- }
2151
- type TsParameterPropertyParameter = BindingIdentifier | AssignmentPattern;
2152
- interface TsQualifiedName extends Node {
2153
- type: "TsQualifiedName";
2154
- left: TsEntityName;
2155
- right: Identifier;
2156
- }
2157
- type TsEntityName = TsQualifiedName | Identifier;
2158
- type TsTypeElement = TsCallSignatureDeclaration | TsConstructSignatureDeclaration | TsPropertySignature | TsGetterSignature | TsSetterSignature | TsMethodSignature | TsIndexSignature;
2159
- interface TsCallSignatureDeclaration extends Node, HasSpan {
2160
- type: "TsCallSignatureDeclaration";
2161
- params: TsFnParameter[];
2162
- typeAnnotation?: TsTypeAnnotation;
2163
- typeParams?: TsTypeParameterDeclaration;
2164
- }
2165
- interface TsConstructSignatureDeclaration extends Node, HasSpan {
2166
- type: "TsConstructSignatureDeclaration";
2167
- params: TsFnParameter[];
2168
- typeAnnotation?: TsTypeAnnotation;
2169
- typeParams?: TsTypeParameterDeclaration;
2170
- }
2171
- interface TsPropertySignature extends Node, HasSpan {
2172
- type: "TsPropertySignature";
2173
- readonly: boolean;
2174
- key: Expression;
2175
- computed: boolean;
2176
- optional: boolean;
2177
- typeAnnotation?: TsTypeAnnotation;
2178
- }
2179
- interface TsGetterSignature extends Node, HasSpan {
2180
- type: "TsGetterSignature";
2181
- readonly: boolean;
2182
- key: Expression;
2183
- computed: boolean;
2184
- optional: boolean;
2185
- typeAnnotation?: TsTypeAnnotation;
2186
- }
2187
- interface TsSetterSignature extends Node, HasSpan {
2188
- type: "TsSetterSignature";
2189
- readonly: boolean;
2190
- key: Expression;
2191
- computed: boolean;
2192
- optional: boolean;
2193
- param: TsFnParameter;
2194
- }
2195
- interface TsMethodSignature extends Node, HasSpan {
2196
- type: "TsMethodSignature";
2197
- readonly: boolean;
2198
- key: Expression;
2199
- computed: boolean;
2200
- optional: boolean;
2201
- params: TsFnParameter[];
2202
- typeAnn?: TsTypeAnnotation;
2203
- typeParams?: TsTypeParameterDeclaration;
2204
- }
2205
- interface TsIndexSignature extends Node, HasSpan {
2206
- type: "TsIndexSignature";
2207
- params: TsFnParameter[];
2208
- typeAnnotation?: TsTypeAnnotation;
2209
- readonly: boolean;
2210
- static: boolean;
2211
- }
2212
- type TsType = TsKeywordType | TsThisType | TsFnOrConstructorType | TsTypeReference | TsTypeQuery | TsTypeLiteral | TsArrayType | TsTupleType | TsOptionalType | TsRestType | TsUnionOrIntersectionType | TsConditionalType | TsInferType | TsParenthesizedType | TsTypeOperator | TsIndexedAccessType | TsMappedType | TsLiteralType | TsTypePredicate | TsImportType;
2213
- type TsFnOrConstructorType = TsFunctionType | TsConstructorType;
2214
- interface TsKeywordType extends Node, HasSpan {
2215
- type: "TsKeywordType";
2216
- kind: TsKeywordTypeKind;
2217
- }
2218
- type TsKeywordTypeKind = "any" | "unknown" | "number" | "object" | "boolean" | "bigint" | "string" | "symbol" | "void" | "undefined" | "null" | "never" | "intrinsic";
2219
- interface TsThisType extends Node, HasSpan {
2220
- type: "TsThisType";
2221
- }
2222
- type TsFnParameter = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern;
2223
- interface TsFunctionType extends Node, HasSpan {
2224
- type: "TsFunctionType";
2225
- params: TsFnParameter[];
2226
- typeParams?: TsTypeParameterDeclaration;
2227
- typeAnnotation: TsTypeAnnotation;
2228
- }
2229
- interface TsConstructorType extends Node, HasSpan {
2230
- type: "TsConstructorType";
2231
- params: TsFnParameter[];
2232
- typeParams?: TsTypeParameterDeclaration;
2233
- typeAnnotation: TsTypeAnnotation;
2234
- isAbstract: boolean;
2235
- }
2236
- interface TsTypeReference extends Node, HasSpan {
2237
- type: "TsTypeReference";
2238
- typeName: TsEntityName;
2239
- typeParams?: TsTypeParameterInstantiation;
2240
- }
2241
- interface TsTypePredicate extends Node, HasSpan {
2242
- type: "TsTypePredicate";
2243
- asserts: boolean;
2244
- paramName: TsThisTypeOrIdent;
2245
- typeAnnotation?: TsTypeAnnotation;
2246
- }
2247
- type TsThisTypeOrIdent = TsThisType | Identifier;
2248
- interface TsImportType extends Node, HasSpan {
2249
- type: "TsImportType";
2250
- argument: StringLiteral;
2251
- qualifier?: TsEntityName;
2252
- typeArguments?: TsTypeParameterInstantiation;
2253
- }
2254
- /**
2255
- * `typeof` operator
2256
- */
2257
- interface TsTypeQuery extends Node, HasSpan {
2258
- type: "TsTypeQuery";
2259
- exprName: TsTypeQueryExpr;
2260
- typeArguments?: TsTypeParameterInstantiation;
2261
- }
2262
- type TsTypeQueryExpr = TsEntityName | TsImportType;
2263
- interface TsTypeLiteral extends Node, HasSpan {
2264
- type: "TsTypeLiteral";
2265
- members: TsTypeElement[];
2266
- }
2267
- interface TsArrayType extends Node, HasSpan {
2268
- type: "TsArrayType";
2269
- elemType: TsType;
2270
- }
2271
- interface TsTupleType extends Node, HasSpan {
2272
- type: "TsTupleType";
2273
- elemTypes: TsTupleElement[];
2274
- }
2275
- interface TsTupleElement extends Node, HasSpan {
2276
- type: "TsTupleElement";
2277
- label?: Pattern;
2278
- ty: TsType;
2279
- }
2280
- interface TsOptionalType extends Node, HasSpan {
2281
- type: "TsOptionalType";
2282
- typeAnnotation: TsType;
2283
- }
2284
- interface TsRestType extends Node, HasSpan {
2285
- type: "TsRestType";
2286
- typeAnnotation: TsType;
2287
- }
2288
- type TsUnionOrIntersectionType = TsUnionType | TsIntersectionType;
2289
- interface TsUnionType extends Node, HasSpan {
2290
- type: "TsUnionType";
2291
- types: TsType[];
2292
- }
2293
- interface TsIntersectionType extends Node, HasSpan {
2294
- type: "TsIntersectionType";
2295
- types: TsType[];
2296
- }
2297
- interface TsConditionalType extends Node, HasSpan {
2298
- type: "TsConditionalType";
2299
- checkType: TsType;
2300
- extendsType: TsType;
2301
- trueType: TsType;
2302
- falseType: TsType;
2303
- }
2304
- interface TsInferType extends Node, HasSpan {
2305
- type: "TsInferType";
2306
- typeParam: TsTypeParameter;
2307
- }
2308
- interface TsParenthesizedType extends Node, HasSpan {
2309
- type: "TsParenthesizedType";
2310
- typeAnnotation: TsType;
2311
- }
2312
- interface TsTypeOperator extends Node, HasSpan {
2313
- type: "TsTypeOperator";
2314
- op: TsTypeOperatorOp;
2315
- typeAnnotation: TsType;
2316
- }
2317
- type TsTypeOperatorOp = "keyof" | "unique" | "readonly";
2318
- interface TsIndexedAccessType extends Node, HasSpan {
2319
- type: "TsIndexedAccessType";
2320
- readonly: boolean;
2321
- objectType: TsType;
2322
- indexType: TsType;
2323
- }
2324
- type TruePlusMinus = true | "+" | "-";
2325
- interface TsMappedType extends Node, HasSpan {
2326
- type: "TsMappedType";
2327
- readonly?: TruePlusMinus;
2328
- typeParam: TsTypeParameter;
2329
- nameType?: TsType;
2330
- optional?: TruePlusMinus;
2331
- typeAnnotation?: TsType;
2332
- }
2333
- interface TsLiteralType extends Node, HasSpan {
2334
- type: "TsLiteralType";
2335
- literal: TsLiteral;
2336
- }
2337
- type TsLiteral = NumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TsTemplateLiteralType;
2338
- interface TsTemplateLiteralType extends Node, HasSpan {
2339
- type: "TemplateLiteral";
2340
- types: TsType[];
2341
- quasis: TemplateElement[];
2342
- }
2343
- interface TsInterfaceDeclaration extends Node, HasSpan {
2344
- type: "TsInterfaceDeclaration";
2345
- id: Identifier;
2346
- declare: boolean;
2347
- typeParams?: TsTypeParameterDeclaration;
2348
- extends: TsExpressionWithTypeArguments[];
2349
- body: TsInterfaceBody;
2350
- }
2351
- interface TsInterfaceBody extends Node, HasSpan {
2352
- type: "TsInterfaceBody";
2353
- body: TsTypeElement[];
2354
- }
2355
- interface TsExpressionWithTypeArguments extends Node, HasSpan {
2356
- type: "TsExpressionWithTypeArguments";
2357
- expression: Expression;
2358
- typeArguments?: TsTypeParameterInstantiation;
2359
- }
2360
- interface TsTypeAliasDeclaration extends Node, HasSpan {
2361
- type: "TsTypeAliasDeclaration";
2362
- declare: boolean;
2363
- id: Identifier;
2364
- typeParams?: TsTypeParameterDeclaration;
2365
- typeAnnotation: TsType;
2366
- }
2367
- interface TsEnumDeclaration extends Node, HasSpan {
2368
- type: "TsEnumDeclaration";
2369
- declare: boolean;
2370
- isConst: boolean;
2371
- id: Identifier;
2372
- members: TsEnumMember[];
2373
- }
2374
- interface TsEnumMember extends Node, HasSpan {
2375
- type: "TsEnumMember";
2376
- id: TsEnumMemberId;
2377
- init?: Expression;
2378
- }
2379
- type TsEnumMemberId = Identifier | StringLiteral;
2380
- interface TsModuleDeclaration extends Node, HasSpan {
2381
- type: "TsModuleDeclaration";
2382
- declare: boolean;
2383
- global: boolean;
2384
- id: TsModuleName;
2385
- body?: TsNamespaceBody;
2386
- }
2387
- /**
2388
- * `namespace A.B { }` is a namespace named `A` with another TsNamespaceDecl as its body.
2389
- */
2390
- type TsNamespaceBody = TsModuleBlock | TsNamespaceDeclaration;
2391
- interface TsModuleBlock extends Node, HasSpan {
2392
- type: "TsModuleBlock";
2393
- body: ModuleItem[];
2394
- }
2395
- interface TsNamespaceDeclaration extends Node, HasSpan {
2396
- type: "TsNamespaceDeclaration";
2397
- declare: boolean;
2398
- global: boolean;
2399
- id: Identifier;
2400
- body: TsNamespaceBody;
2401
- }
2402
- type TsModuleName = Identifier | StringLiteral;
2403
- interface TsImportEqualsDeclaration extends Node, HasSpan {
2404
- type: "TsImportEqualsDeclaration";
2405
- declare: boolean;
2406
- isExport: boolean;
2407
- isTypeOnly: boolean;
2408
- id: Identifier;
2409
- moduleRef: TsModuleReference;
2410
- }
2411
- type TsModuleReference = TsEntityName | TsExternalModuleReference;
2412
- interface TsExternalModuleReference extends Node, HasSpan {
2413
- type: "TsExternalModuleReference";
2414
- expression: StringLiteral;
2415
- }
2416
- interface TsExportAssignment extends Node, HasSpan {
2417
- type: "TsExportAssignment";
2418
- expression: Expression;
2419
- }
2420
- interface TsNamespaceExportDeclaration extends Node, HasSpan {
2421
- type: "TsNamespaceExportDeclaration";
2422
- id: Identifier;
2423
- }
2424
- interface TsAsExpression extends ExpressionBase {
2425
- type: "TsAsExpression";
2426
- expression: Expression;
2427
- typeAnnotation: TsType;
2428
- }
2429
- interface TsSatisfiesExpression extends ExpressionBase {
2430
- type: "TsSatisfiesExpression";
2431
- expression: Expression;
2432
- typeAnnotation: TsType;
2433
- }
2434
- interface TsInstantiation extends Node, HasSpan {
2435
- type: "TsInstantiation";
2436
- expression: Expression;
2437
- typeArguments: TsTypeParameterInstantiation;
2438
- }
2439
- interface TsTypeAssertion extends ExpressionBase {
2440
- type: "TsTypeAssertion";
2441
- expression: Expression;
2442
- typeAnnotation: TsType;
2443
- }
2444
- interface TsConstAssertion extends ExpressionBase {
2445
- type: "TsConstAssertion";
2446
- expression: Expression;
2447
- }
2448
- interface TsNonNullExpression extends ExpressionBase {
2449
- type: "TsNonNullExpression";
2450
- expression: Expression;
2451
- }
2452
- type Accessibility = "public" | "protected" | "private";
2453
- interface Invalid extends Node, HasSpan {
2454
- type: "Invalid";
2455
- }
2456
- type WasmPlugin = [wasmPackage: string, config: Record<string, any>];
2457
-
2458
- type SwcPluginConfig = Exclude<Options, "configFile" | "exclude" | "filename" | "sourceMaps" | "swcrc"> & {
2459
- exclude?: FilterPattern;
2460
- include?: FilterPattern;
2461
- };
2462
-
2463
- type PatchTypesOptions = {
2464
- identifierReplacements?: Record<string, Record<string, string>>;
2465
- };
2466
-
2467
- type TsconfigPathsPluginOptions = {
2468
- resolveAbsolutePath?: boolean;
2469
- };
2470
-
2471
- interface UrlOptions {
2472
- destDir?: string;
2473
- emitFiles: boolean;
2474
- exclude?: FilterPattern;
2475
- fileName: string;
2476
- include?: FilterPattern;
2477
- limit: number;
2478
- publicPath?: string;
2479
- sourceDir?: string;
2480
- }
2481
-
2482
- interface RollupDynamicImportVariablesOptions {
2483
- errorWhenNoFilesFound?: boolean;
2484
- exclude?: FilterPattern;
2485
- include?: FilterPattern;
2486
- warnOnError?: boolean;
2487
- }
2488
- interface IsolatedDeclarationsResult {
2489
- errors: string[];
2490
- map?: string;
2491
- sourceText: string;
2492
- }
2493
- type IsolatedDeclarationsTransformer = (code: string, id: string, sourceMap?: boolean) => Promise<IsolatedDeclarationsResult>;
2494
- interface PackemRollupOptions {
2495
- alias: RollupAliasOptions | false;
2496
- cjsInterop?: CJSInteropOptions;
2497
- commonjs: RollupCommonJSOptions | false;
2498
- copy?: CopyPluginOptions | false;
2499
- dts: Options$2;
2500
- dynamicVars?: RollupDynamicImportVariablesOptions | false;
2501
- esbuild?: Options$1 | false;
2502
- experimental?: {
2503
- resolve?: OxcResolveOptions | false;
2504
- };
2505
- isolatedDeclarations?: IsolatedDeclarationsOptions;
2506
- json: RollupJsonOptions | false;
2507
- jsxRemoveAttributes?: JSXRemoveAttributesPlugin | false;
2508
- license?: LicenseOptions | false;
2509
- metafile?: boolean;
2510
- output?: OutputOptions;
2511
- oxc?: Omit<OXCTransformPluginConfig, "cwd" | "sourcemap" | "target"> | false;
2512
- patchTypes: PatchTypesOptions | false;
2513
- pluginPure?: Omit<PureAnnotationsOptions, "sourcemap"> | false;
2514
- plugins?: RollupPlugins;
2515
- polyfillNode?: NodePolyfillsOptions | false;
2516
- preserveDirectives?: {
2517
- directiveRegex?: RegExp;
2518
- exclude?: FilterPattern;
2519
- include?: FilterPattern;
2520
- };
2521
- preserveDynamicImports?: boolean;
2522
- raw?: RawLoaderOptions | false;
2523
- replace: RollupReplaceOptions | false;
2524
- resolve: RollupNodeResolveOptions | false;
2525
- shebang?: Partial<ShebangOptions> | false;
2526
- shim?: EsmShimCjsSyntaxOptions | false;
2527
- sourcemap?: SourcemapsPluginOptions;
2528
- sucrase?: SucrasePluginConfig | false;
2529
- swc?: SwcPluginConfig | false;
2530
- treeshake?: RollupOptions["treeshake"];
2531
- tsconfigPaths?: TsconfigPathsPluginOptions | false;
2532
- url?: UrlOptions | false;
2533
- visualizer?: PluginVisualizerOptions | false;
2534
- wasm?: RollupWasmOptions | false;
2535
- watch?: RollupOptions["watch"];
2536
- }
2537
- type RollupPlugins = {
2538
- enforce?: "post" | "pre";
2539
- plugin: Plugin$1;
2540
- type?: "build" | "dts";
2541
- }[];
2542
- type TransformerFn = ((config: EsbuildPluginConfig | InternalOXCTransformPluginConfig | SucrasePluginConfig | SwcPluginConfig) => Plugin$1) & {
2543
- NAME?: TransformerName;
2544
- };
2545
- type TransformerName = "esbuild" | "oxc" | "sucrase" | "swc";
2546
-
2547
- type IsolatedDeclarationsOptions = {
2548
- exclude?: FilterPattern;
2549
- ignoreErrors?: boolean;
2550
- include?: FilterPattern;
2551
- };
2552
-
2553
- export { sucrasePlugin as s };
2554
- export type { EsbuildPluginConfig as E, IsolatedDeclarationsTransformer as I, PackemRollupOptions as P, SwcPluginConfig as S, TransformerFn as T, TransformerName as a, IsolatedDeclarationsResult as b, InternalOXCTransformPluginConfig as c, SucrasePluginConfig as d };