@storybook/preact-vite 7.6.0-alpha.4 → 7.6.0-alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index-4933ba86.d.ts +3105 -0
- package/dist/index.d.ts +1 -1
- package/dist/preset.d.ts +1 -1
- package/package.json +3 -3
- package/dist/index-206df4f8.d.ts +0 -1178
@@ -0,0 +1,3105 @@
|
|
1
|
+
import { FileSystemCache } from 'file-system-cache';
|
2
|
+
import { TransformOptions } from '@babel/core';
|
3
|
+
import { Server } from 'http';
|
4
|
+
import { BuilderOptions as BuilderOptions$1, StorybookConfigVite } from '@storybook/builder-vite';
|
5
|
+
|
6
|
+
/**
|
7
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
8
|
+
|
9
|
+
@category Type
|
10
|
+
*/
|
11
|
+
type Primitive =
|
12
|
+
| null
|
13
|
+
| undefined
|
14
|
+
| string
|
15
|
+
| number
|
16
|
+
| boolean
|
17
|
+
| symbol
|
18
|
+
| bigint;
|
19
|
+
|
20
|
+
declare global {
|
21
|
+
interface SymbolConstructor {
|
22
|
+
readonly observable: symbol;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
/**
|
27
|
+
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.
|
28
|
+
|
29
|
+
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.
|
30
|
+
|
31
|
+
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.
|
32
|
+
|
33
|
+
@example
|
34
|
+
```
|
35
|
+
import type {LiteralUnion} from 'type-fest';
|
36
|
+
|
37
|
+
// Before
|
38
|
+
|
39
|
+
type Pet = 'dog' | 'cat' | string;
|
40
|
+
|
41
|
+
const pet: Pet = '';
|
42
|
+
// Start typing in your TypeScript-enabled IDE.
|
43
|
+
// You **will not** get auto-completion for `dog` and `cat` literals.
|
44
|
+
|
45
|
+
// After
|
46
|
+
|
47
|
+
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
48
|
+
|
49
|
+
const pet: Pet2 = '';
|
50
|
+
// You **will** get auto-completion for `dog` and `cat` literals.
|
51
|
+
```
|
52
|
+
|
53
|
+
@category Type
|
54
|
+
*/
|
55
|
+
type LiteralUnion<
|
56
|
+
LiteralType,
|
57
|
+
BaseType extends Primitive,
|
58
|
+
> = LiteralType | (BaseType & Record<never, never>);
|
59
|
+
|
60
|
+
declare namespace PackageJson$1 {
|
61
|
+
/**
|
62
|
+
A person who has been involved in creating or maintaining the package.
|
63
|
+
*/
|
64
|
+
export type Person =
|
65
|
+
| string
|
66
|
+
| {
|
67
|
+
name: string;
|
68
|
+
url?: string;
|
69
|
+
email?: string;
|
70
|
+
};
|
71
|
+
|
72
|
+
export type BugsLocation =
|
73
|
+
| string
|
74
|
+
| {
|
75
|
+
/**
|
76
|
+
The URL to the package's issue tracker.
|
77
|
+
*/
|
78
|
+
url?: string;
|
79
|
+
|
80
|
+
/**
|
81
|
+
The email address to which issues should be reported.
|
82
|
+
*/
|
83
|
+
email?: string;
|
84
|
+
};
|
85
|
+
|
86
|
+
export interface DirectoryLocations {
|
87
|
+
[directoryType: string]: unknown;
|
88
|
+
|
89
|
+
/**
|
90
|
+
Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
|
91
|
+
*/
|
92
|
+
bin?: string;
|
93
|
+
|
94
|
+
/**
|
95
|
+
Location for Markdown files.
|
96
|
+
*/
|
97
|
+
doc?: string;
|
98
|
+
|
99
|
+
/**
|
100
|
+
Location for example scripts.
|
101
|
+
*/
|
102
|
+
example?: string;
|
103
|
+
|
104
|
+
/**
|
105
|
+
Location for the bulk of the library.
|
106
|
+
*/
|
107
|
+
lib?: string;
|
108
|
+
|
109
|
+
/**
|
110
|
+
Location for man pages. Sugar to generate a `man` array by walking the folder.
|
111
|
+
*/
|
112
|
+
man?: string;
|
113
|
+
|
114
|
+
/**
|
115
|
+
Location for test files.
|
116
|
+
*/
|
117
|
+
test?: string;
|
118
|
+
}
|
119
|
+
|
120
|
+
export type Scripts = {
|
121
|
+
/**
|
122
|
+
Run **before** the package is published (Also run on local `npm install` without any arguments).
|
123
|
+
*/
|
124
|
+
prepublish?: string;
|
125
|
+
|
126
|
+
/**
|
127
|
+
Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.
|
128
|
+
*/
|
129
|
+
prepare?: string;
|
130
|
+
|
131
|
+
/**
|
132
|
+
Run **before** the package is prepared and packed, **only** on `npm publish`.
|
133
|
+
*/
|
134
|
+
prepublishOnly?: string;
|
135
|
+
|
136
|
+
/**
|
137
|
+
Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
|
138
|
+
*/
|
139
|
+
prepack?: string;
|
140
|
+
|
141
|
+
/**
|
142
|
+
Run **after** the tarball has been generated and moved to its final destination.
|
143
|
+
*/
|
144
|
+
postpack?: string;
|
145
|
+
|
146
|
+
/**
|
147
|
+
Run **after** the package is published.
|
148
|
+
*/
|
149
|
+
publish?: string;
|
150
|
+
|
151
|
+
/**
|
152
|
+
Run **after** the package is published.
|
153
|
+
*/
|
154
|
+
postpublish?: string;
|
155
|
+
|
156
|
+
/**
|
157
|
+
Run **before** the package is installed.
|
158
|
+
*/
|
159
|
+
preinstall?: string;
|
160
|
+
|
161
|
+
/**
|
162
|
+
Run **after** the package is installed.
|
163
|
+
*/
|
164
|
+
install?: string;
|
165
|
+
|
166
|
+
/**
|
167
|
+
Run **after** the package is installed and after `install`.
|
168
|
+
*/
|
169
|
+
postinstall?: string;
|
170
|
+
|
171
|
+
/**
|
172
|
+
Run **before** the package is uninstalled and before `uninstall`.
|
173
|
+
*/
|
174
|
+
preuninstall?: string;
|
175
|
+
|
176
|
+
/**
|
177
|
+
Run **before** the package is uninstalled.
|
178
|
+
*/
|
179
|
+
uninstall?: string;
|
180
|
+
|
181
|
+
/**
|
182
|
+
Run **after** the package is uninstalled.
|
183
|
+
*/
|
184
|
+
postuninstall?: string;
|
185
|
+
|
186
|
+
/**
|
187
|
+
Run **before** bump the package version and before `version`.
|
188
|
+
*/
|
189
|
+
preversion?: string;
|
190
|
+
|
191
|
+
/**
|
192
|
+
Run **before** bump the package version.
|
193
|
+
*/
|
194
|
+
version?: string;
|
195
|
+
|
196
|
+
/**
|
197
|
+
Run **after** bump the package version.
|
198
|
+
*/
|
199
|
+
postversion?: string;
|
200
|
+
|
201
|
+
/**
|
202
|
+
Run with the `npm test` command, before `test`.
|
203
|
+
*/
|
204
|
+
pretest?: string;
|
205
|
+
|
206
|
+
/**
|
207
|
+
Run with the `npm test` command.
|
208
|
+
*/
|
209
|
+
test?: string;
|
210
|
+
|
211
|
+
/**
|
212
|
+
Run with the `npm test` command, after `test`.
|
213
|
+
*/
|
214
|
+
posttest?: string;
|
215
|
+
|
216
|
+
/**
|
217
|
+
Run with the `npm stop` command, before `stop`.
|
218
|
+
*/
|
219
|
+
prestop?: string;
|
220
|
+
|
221
|
+
/**
|
222
|
+
Run with the `npm stop` command.
|
223
|
+
*/
|
224
|
+
stop?: string;
|
225
|
+
|
226
|
+
/**
|
227
|
+
Run with the `npm stop` command, after `stop`.
|
228
|
+
*/
|
229
|
+
poststop?: string;
|
230
|
+
|
231
|
+
/**
|
232
|
+
Run with the `npm start` command, before `start`.
|
233
|
+
*/
|
234
|
+
prestart?: string;
|
235
|
+
|
236
|
+
/**
|
237
|
+
Run with the `npm start` command.
|
238
|
+
*/
|
239
|
+
start?: string;
|
240
|
+
|
241
|
+
/**
|
242
|
+
Run with the `npm start` command, after `start`.
|
243
|
+
*/
|
244
|
+
poststart?: string;
|
245
|
+
|
246
|
+
/**
|
247
|
+
Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
248
|
+
*/
|
249
|
+
prerestart?: string;
|
250
|
+
|
251
|
+
/**
|
252
|
+
Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
253
|
+
*/
|
254
|
+
restart?: string;
|
255
|
+
|
256
|
+
/**
|
257
|
+
Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
258
|
+
*/
|
259
|
+
postrestart?: string;
|
260
|
+
} & Partial<Record<string, string>>;
|
261
|
+
|
262
|
+
/**
|
263
|
+
Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.
|
264
|
+
*/
|
265
|
+
export type Dependency = Partial<Record<string, string>>;
|
266
|
+
|
267
|
+
/**
|
268
|
+
Conditions which provide a way to resolve a package entry point based on the environment.
|
269
|
+
*/
|
270
|
+
export type ExportCondition = LiteralUnion<
|
271
|
+
| 'import'
|
272
|
+
| 'require'
|
273
|
+
| 'node'
|
274
|
+
| 'node-addons'
|
275
|
+
| 'deno'
|
276
|
+
| 'browser'
|
277
|
+
| 'electron'
|
278
|
+
| 'react-native'
|
279
|
+
| 'default',
|
280
|
+
string
|
281
|
+
>;
|
282
|
+
|
283
|
+
type ExportConditions = {[condition in ExportCondition]: Exports};
|
284
|
+
|
285
|
+
/**
|
286
|
+
Entry points of a module, optionally with conditions and subpath exports.
|
287
|
+
*/
|
288
|
+
export type Exports =
|
289
|
+
| null
|
290
|
+
| string
|
291
|
+
| Array<string | ExportConditions>
|
292
|
+
| ExportConditions
|
293
|
+
| {[path: string]: Exports}; // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
|
294
|
+
|
295
|
+
/**
|
296
|
+
Import map entries of a module, optionally with conditions.
|
297
|
+
*/
|
298
|
+
export type Imports = { // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
|
299
|
+
[key: string]: string | {[key in ExportCondition]: Exports};
|
300
|
+
};
|
301
|
+
|
302
|
+
export interface NonStandardEntryPoints {
|
303
|
+
/**
|
304
|
+
An ECMAScript module ID that is the primary entry point to the program.
|
305
|
+
*/
|
306
|
+
module?: string;
|
307
|
+
|
308
|
+
/**
|
309
|
+
A module ID with untranspiled code that is the primary entry point to the program.
|
310
|
+
*/
|
311
|
+
esnext?:
|
312
|
+
| string
|
313
|
+
| {
|
314
|
+
[moduleName: string]: string | undefined;
|
315
|
+
main?: string;
|
316
|
+
browser?: string;
|
317
|
+
};
|
318
|
+
|
319
|
+
/**
|
320
|
+
A hint to JavaScript bundlers or component tools when packaging modules for client side use.
|
321
|
+
*/
|
322
|
+
browser?:
|
323
|
+
| string
|
324
|
+
| Partial<Record<string, string | false>>;
|
325
|
+
|
326
|
+
/**
|
327
|
+
Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused.
|
328
|
+
|
329
|
+
[Read more.](https://webpack.js.org/guides/tree-shaking/)
|
330
|
+
*/
|
331
|
+
sideEffects?: boolean | string[];
|
332
|
+
}
|
333
|
+
|
334
|
+
export interface TypeScriptConfiguration {
|
335
|
+
/**
|
336
|
+
Location of the bundled TypeScript declaration file.
|
337
|
+
*/
|
338
|
+
types?: string;
|
339
|
+
|
340
|
+
/**
|
341
|
+
Version selection map of TypeScript.
|
342
|
+
*/
|
343
|
+
typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>>;
|
344
|
+
|
345
|
+
/**
|
346
|
+
Location of the bundled TypeScript declaration file. Alias of `types`.
|
347
|
+
*/
|
348
|
+
typings?: string;
|
349
|
+
}
|
350
|
+
|
351
|
+
/**
|
352
|
+
An alternative configuration for Yarn workspaces.
|
353
|
+
*/
|
354
|
+
export interface WorkspaceConfig {
|
355
|
+
/**
|
356
|
+
An array of workspace pattern strings which contain the workspace packages.
|
357
|
+
*/
|
358
|
+
packages?: WorkspacePattern[];
|
359
|
+
|
360
|
+
/**
|
361
|
+
Designed to solve the problem of packages which break when their `node_modules` are moved to the root workspace directory - a process known as hoisting. For these packages, both within your workspace, and also some that have been installed via `node_modules`, it is important to have a mechanism for preventing the default Yarn workspace behavior. By adding workspace pattern strings here, Yarn will resume non-workspace behavior for any package which matches the defined patterns.
|
362
|
+
|
363
|
+
[Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/)
|
364
|
+
*/
|
365
|
+
nohoist?: WorkspacePattern[];
|
366
|
+
}
|
367
|
+
|
368
|
+
/**
|
369
|
+
A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.
|
370
|
+
|
371
|
+
The patterns are handled with [minimatch](https://github.com/isaacs/minimatch).
|
372
|
+
|
373
|
+
@example
|
374
|
+
`docs` → Include the docs directory and install its dependencies.
|
375
|
+
`packages/*` → Include all nested directories within the packages directory, like `packages/cli` and `packages/core`.
|
376
|
+
*/
|
377
|
+
type WorkspacePattern = string;
|
378
|
+
|
379
|
+
export interface YarnConfiguration {
|
380
|
+
/**
|
381
|
+
Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).
|
382
|
+
|
383
|
+
Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run `yarn install` once to install all of them in a single pass.
|
384
|
+
|
385
|
+
Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
|
386
|
+
*/
|
387
|
+
workspaces?: WorkspacePattern[] | WorkspaceConfig;
|
388
|
+
|
389
|
+
/**
|
390
|
+
If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`.
|
391
|
+
|
392
|
+
Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an app), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
|
393
|
+
*/
|
394
|
+
flat?: boolean;
|
395
|
+
|
396
|
+
/**
|
397
|
+
Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
|
398
|
+
*/
|
399
|
+
resolutions?: Dependency;
|
400
|
+
}
|
401
|
+
|
402
|
+
export interface JSPMConfiguration {
|
403
|
+
/**
|
404
|
+
JSPM configuration.
|
405
|
+
*/
|
406
|
+
jspm?: PackageJson$1;
|
407
|
+
}
|
408
|
+
|
409
|
+
/**
|
410
|
+
Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties.
|
411
|
+
*/
|
412
|
+
export interface PackageJsonStandard {
|
413
|
+
/**
|
414
|
+
The name of the package.
|
415
|
+
*/
|
416
|
+
name?: string;
|
417
|
+
|
418
|
+
/**
|
419
|
+
Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
|
420
|
+
*/
|
421
|
+
version?: string;
|
422
|
+
|
423
|
+
/**
|
424
|
+
Package description, listed in `npm search`.
|
425
|
+
*/
|
426
|
+
description?: string;
|
427
|
+
|
428
|
+
/**
|
429
|
+
Keywords associated with package, listed in `npm search`.
|
430
|
+
*/
|
431
|
+
keywords?: string[];
|
432
|
+
|
433
|
+
/**
|
434
|
+
The URL to the package's homepage.
|
435
|
+
*/
|
436
|
+
homepage?: LiteralUnion<'.', string>;
|
437
|
+
|
438
|
+
/**
|
439
|
+
The URL to the package's issue tracker and/or the email address to which issues should be reported.
|
440
|
+
*/
|
441
|
+
bugs?: BugsLocation;
|
442
|
+
|
443
|
+
/**
|
444
|
+
The license for the package.
|
445
|
+
*/
|
446
|
+
license?: string;
|
447
|
+
|
448
|
+
/**
|
449
|
+
The licenses for the package.
|
450
|
+
*/
|
451
|
+
licenses?: Array<{
|
452
|
+
type?: string;
|
453
|
+
url?: string;
|
454
|
+
}>;
|
455
|
+
|
456
|
+
author?: Person;
|
457
|
+
|
458
|
+
/**
|
459
|
+
A list of people who contributed to the package.
|
460
|
+
*/
|
461
|
+
contributors?: Person[];
|
462
|
+
|
463
|
+
/**
|
464
|
+
A list of people who maintain the package.
|
465
|
+
*/
|
466
|
+
maintainers?: Person[];
|
467
|
+
|
468
|
+
/**
|
469
|
+
The files included in the package.
|
470
|
+
*/
|
471
|
+
files?: string[];
|
472
|
+
|
473
|
+
/**
|
474
|
+
Resolution algorithm for importing ".js" files from the package's scope.
|
475
|
+
|
476
|
+
[Read more.](https://nodejs.org/api/esm.html#esm_package_json_type_field)
|
477
|
+
*/
|
478
|
+
type?: 'module' | 'commonjs';
|
479
|
+
|
480
|
+
/**
|
481
|
+
The module ID that is the primary entry point to the program.
|
482
|
+
*/
|
483
|
+
main?: string;
|
484
|
+
|
485
|
+
/**
|
486
|
+
Subpath exports to define entry points of the package.
|
487
|
+
|
488
|
+
[Read more.](https://nodejs.org/api/packages.html#subpath-exports)
|
489
|
+
*/
|
490
|
+
exports?: Exports;
|
491
|
+
|
492
|
+
/**
|
493
|
+
Subpath imports to define internal package import maps that only apply to import specifiers from within the package itself.
|
494
|
+
|
495
|
+
[Read more.](https://nodejs.org/api/packages.html#subpath-imports)
|
496
|
+
*/
|
497
|
+
imports?: Imports;
|
498
|
+
|
499
|
+
/**
|
500
|
+
The executable files that should be installed into the `PATH`.
|
501
|
+
*/
|
502
|
+
bin?:
|
503
|
+
| string
|
504
|
+
| Partial<Record<string, string>>;
|
505
|
+
|
506
|
+
/**
|
507
|
+
Filenames to put in place for the `man` program to find.
|
508
|
+
*/
|
509
|
+
man?: string | string[];
|
510
|
+
|
511
|
+
/**
|
512
|
+
Indicates the structure of the package.
|
513
|
+
*/
|
514
|
+
directories?: DirectoryLocations;
|
515
|
+
|
516
|
+
/**
|
517
|
+
Location for the code repository.
|
518
|
+
*/
|
519
|
+
repository?:
|
520
|
+
| string
|
521
|
+
| {
|
522
|
+
type: string;
|
523
|
+
url: string;
|
524
|
+
|
525
|
+
/**
|
526
|
+
Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).
|
527
|
+
|
528
|
+
[Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)
|
529
|
+
*/
|
530
|
+
directory?: string;
|
531
|
+
};
|
532
|
+
|
533
|
+
/**
|
534
|
+
Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.
|
535
|
+
*/
|
536
|
+
scripts?: Scripts;
|
537
|
+
|
538
|
+
/**
|
539
|
+
Is used to set configuration parameters used in package scripts that persist across upgrades.
|
540
|
+
*/
|
541
|
+
config?: Record<string, unknown>;
|
542
|
+
|
543
|
+
/**
|
544
|
+
The dependencies of the package.
|
545
|
+
*/
|
546
|
+
dependencies?: Dependency;
|
547
|
+
|
548
|
+
/**
|
549
|
+
Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
|
550
|
+
*/
|
551
|
+
devDependencies?: Dependency;
|
552
|
+
|
553
|
+
/**
|
554
|
+
Dependencies that are skipped if they fail to install.
|
555
|
+
*/
|
556
|
+
optionalDependencies?: Dependency;
|
557
|
+
|
558
|
+
/**
|
559
|
+
Dependencies that will usually be required by the package user directly or via another dependency.
|
560
|
+
*/
|
561
|
+
peerDependencies?: Dependency;
|
562
|
+
|
563
|
+
/**
|
564
|
+
Indicate peer dependencies that are optional.
|
565
|
+
*/
|
566
|
+
peerDependenciesMeta?: Partial<Record<string, {optional: true}>>;
|
567
|
+
|
568
|
+
/**
|
569
|
+
Package names that are bundled when the package is published.
|
570
|
+
*/
|
571
|
+
bundledDependencies?: string[];
|
572
|
+
|
573
|
+
/**
|
574
|
+
Alias of `bundledDependencies`.
|
575
|
+
*/
|
576
|
+
bundleDependencies?: string[];
|
577
|
+
|
578
|
+
/**
|
579
|
+
Engines that this package runs on.
|
580
|
+
*/
|
581
|
+
engines?: {
|
582
|
+
[EngineName in 'npm' | 'node' | string]?: string;
|
583
|
+
};
|
584
|
+
|
585
|
+
/**
|
586
|
+
@deprecated
|
587
|
+
*/
|
588
|
+
engineStrict?: boolean;
|
589
|
+
|
590
|
+
/**
|
591
|
+
Operating systems the module runs on.
|
592
|
+
*/
|
593
|
+
os?: Array<LiteralUnion<
|
594
|
+
| 'aix'
|
595
|
+
| 'darwin'
|
596
|
+
| 'freebsd'
|
597
|
+
| 'linux'
|
598
|
+
| 'openbsd'
|
599
|
+
| 'sunos'
|
600
|
+
| 'win32'
|
601
|
+
| '!aix'
|
602
|
+
| '!darwin'
|
603
|
+
| '!freebsd'
|
604
|
+
| '!linux'
|
605
|
+
| '!openbsd'
|
606
|
+
| '!sunos'
|
607
|
+
| '!win32',
|
608
|
+
string
|
609
|
+
>>;
|
610
|
+
|
611
|
+
/**
|
612
|
+
CPU architectures the module runs on.
|
613
|
+
*/
|
614
|
+
cpu?: Array<LiteralUnion<
|
615
|
+
| 'arm'
|
616
|
+
| 'arm64'
|
617
|
+
| 'ia32'
|
618
|
+
| 'mips'
|
619
|
+
| 'mipsel'
|
620
|
+
| 'ppc'
|
621
|
+
| 'ppc64'
|
622
|
+
| 's390'
|
623
|
+
| 's390x'
|
624
|
+
| 'x32'
|
625
|
+
| 'x64'
|
626
|
+
| '!arm'
|
627
|
+
| '!arm64'
|
628
|
+
| '!ia32'
|
629
|
+
| '!mips'
|
630
|
+
| '!mipsel'
|
631
|
+
| '!ppc'
|
632
|
+
| '!ppc64'
|
633
|
+
| '!s390'
|
634
|
+
| '!s390x'
|
635
|
+
| '!x32'
|
636
|
+
| '!x64',
|
637
|
+
string
|
638
|
+
>>;
|
639
|
+
|
640
|
+
/**
|
641
|
+
If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.
|
642
|
+
|
643
|
+
@deprecated
|
644
|
+
*/
|
645
|
+
preferGlobal?: boolean;
|
646
|
+
|
647
|
+
/**
|
648
|
+
If set to `true`, then npm will refuse to publish it.
|
649
|
+
*/
|
650
|
+
private?: boolean;
|
651
|
+
|
652
|
+
/**
|
653
|
+
A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.
|
654
|
+
*/
|
655
|
+
publishConfig?: PublishConfig;
|
656
|
+
|
657
|
+
/**
|
658
|
+
Describes and notifies consumers of a package's monetary support information.
|
659
|
+
|
660
|
+
[Read more.](https://github.com/npm/rfcs/blob/latest/accepted/0017-add-funding-support.md)
|
661
|
+
*/
|
662
|
+
funding?: string | {
|
663
|
+
/**
|
664
|
+
The type of funding.
|
665
|
+
*/
|
666
|
+
type?: LiteralUnion<
|
667
|
+
| 'github'
|
668
|
+
| 'opencollective'
|
669
|
+
| 'patreon'
|
670
|
+
| 'individual'
|
671
|
+
| 'foundation'
|
672
|
+
| 'corporation',
|
673
|
+
string
|
674
|
+
>;
|
675
|
+
|
676
|
+
/**
|
677
|
+
The URL to the funding page.
|
678
|
+
*/
|
679
|
+
url: string;
|
680
|
+
};
|
681
|
+
}
|
682
|
+
|
683
|
+
export interface PublishConfig {
|
684
|
+
/**
|
685
|
+
Additional, less common properties from the [npm docs on `publishConfig`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#publishconfig).
|
686
|
+
*/
|
687
|
+
[additionalProperties: string]: unknown;
|
688
|
+
|
689
|
+
/**
|
690
|
+
When publishing scoped packages, the access level defaults to restricted. If you want your scoped package to be publicly viewable (and installable) set `--access=public`. The only valid values for access are public and restricted. Unscoped packages always have an access level of public.
|
691
|
+
*/
|
692
|
+
access?: 'public' | 'restricted';
|
693
|
+
|
694
|
+
/**
|
695
|
+
The base URL of the npm registry.
|
696
|
+
|
697
|
+
Default: `'https://registry.npmjs.org/'`
|
698
|
+
*/
|
699
|
+
registry?: string;
|
700
|
+
|
701
|
+
/**
|
702
|
+
The tag to publish the package under.
|
703
|
+
|
704
|
+
Default: `'latest'`
|
705
|
+
*/
|
706
|
+
tag?: string;
|
707
|
+
}
|
708
|
+
}
|
709
|
+
|
710
|
+
/**
|
711
|
+
Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
|
712
|
+
|
713
|
+
@category File
|
714
|
+
*/
|
715
|
+
type PackageJson$1 =
|
716
|
+
PackageJson$1.PackageJsonStandard &
|
717
|
+
PackageJson$1.NonStandardEntryPoints &
|
718
|
+
PackageJson$1.TypeScriptConfiguration &
|
719
|
+
PackageJson$1.YarnConfiguration &
|
720
|
+
PackageJson$1.JSPMConfiguration;
|
721
|
+
|
722
|
+
type StoryId = string;
|
723
|
+
type ComponentTitle = string;
|
724
|
+
type StoryName = string;
|
725
|
+
type Tag = string;
|
726
|
+
interface Parameters {
|
727
|
+
[name: string]: any;
|
728
|
+
}
|
729
|
+
|
730
|
+
interface Plugin {
|
731
|
+
(module: Program): Program;
|
732
|
+
}
|
733
|
+
type TerserEcmaVersion = 5 | 2015 | 2016 | string | number;
|
734
|
+
interface JsMinifyOptions {
|
735
|
+
compress?: TerserCompressOptions | boolean;
|
736
|
+
format?: JsFormatOptions & ToSnakeCaseProperties<JsFormatOptions>;
|
737
|
+
mangle?: TerserMangleOptions | boolean;
|
738
|
+
ecma?: TerserEcmaVersion;
|
739
|
+
keep_classnames?: boolean;
|
740
|
+
keep_fnames?: boolean;
|
741
|
+
module?: boolean;
|
742
|
+
safari10?: boolean;
|
743
|
+
toplevel?: boolean;
|
744
|
+
sourceMap?: boolean;
|
745
|
+
outputPath?: string;
|
746
|
+
inlineSourcesContent?: boolean;
|
747
|
+
}
|
748
|
+
/**
|
749
|
+
* @example ToSnakeCase<'indentLevel'> == 'indent_level'
|
750
|
+
*/
|
751
|
+
type ToSnakeCase<T extends string> = T extends `${infer A}${infer B}` ? `${A extends Lowercase<A> ? A : `_${Lowercase<A>}`}${ToSnakeCase<B>}` : T;
|
752
|
+
/**
|
753
|
+
* @example ToSnakeCaseProperties<{indentLevel: 3}> == {indent_level: 3}
|
754
|
+
*/
|
755
|
+
type ToSnakeCaseProperties<T> = {
|
756
|
+
[K in keyof T as K extends string ? ToSnakeCase<K> : K]: T[K];
|
757
|
+
};
|
758
|
+
/**
|
759
|
+
* These properties are mostly not implemented yet,
|
760
|
+
* but it exists to support passing terser config to swc minify
|
761
|
+
* without modification.
|
762
|
+
*/
|
763
|
+
interface JsFormatOptions {
|
764
|
+
/**
|
765
|
+
* Currently noop.
|
766
|
+
* @default false
|
767
|
+
* @alias ascii_only
|
768
|
+
*/
|
769
|
+
asciiOnly?: boolean;
|
770
|
+
/**
|
771
|
+
* Currently noop.
|
772
|
+
* @default false
|
773
|
+
*/
|
774
|
+
beautify?: boolean;
|
775
|
+
/**
|
776
|
+
* Currently noop.
|
777
|
+
* @default false
|
778
|
+
*/
|
779
|
+
braces?: boolean;
|
780
|
+
/**
|
781
|
+
* - `false`: removes all comments
|
782
|
+
* - `'some'`: preserves some comments
|
783
|
+
* - `'all'`: preserves all comments
|
784
|
+
* @default false
|
785
|
+
*/
|
786
|
+
comments?: false | "some" | "all";
|
787
|
+
/**
|
788
|
+
* Currently noop.
|
789
|
+
* @default 5
|
790
|
+
*/
|
791
|
+
ecma?: TerserEcmaVersion;
|
792
|
+
/**
|
793
|
+
* Currently noop.
|
794
|
+
* @alias indent_level
|
795
|
+
*/
|
796
|
+
indentLevel?: number;
|
797
|
+
/**
|
798
|
+
* Currently noop.
|
799
|
+
* @alias indent_start
|
800
|
+
*/
|
801
|
+
indentStart?: number;
|
802
|
+
/**
|
803
|
+
* Currently noop.
|
804
|
+
* @alias inline_script
|
805
|
+
*/
|
806
|
+
inlineScript?: number;
|
807
|
+
/**
|
808
|
+
* Currently noop.
|
809
|
+
* @alias keep_numbers
|
810
|
+
*/
|
811
|
+
keepNumbers?: number;
|
812
|
+
/**
|
813
|
+
* Currently noop.
|
814
|
+
* @alias keep_quoted_props
|
815
|
+
*/
|
816
|
+
keepQuotedProps?: boolean;
|
817
|
+
/**
|
818
|
+
* Currently noop.
|
819
|
+
* @alias max_line_len
|
820
|
+
*/
|
821
|
+
maxLineLen?: number | false;
|
822
|
+
/**
|
823
|
+
* Currently noop.
|
824
|
+
*/
|
825
|
+
preamble?: string;
|
826
|
+
/**
|
827
|
+
* Currently noop.
|
828
|
+
* @alias quote_keys
|
829
|
+
*/
|
830
|
+
quoteKeys?: boolean;
|
831
|
+
/**
|
832
|
+
* Currently noop.
|
833
|
+
* @alias quote_style
|
834
|
+
*/
|
835
|
+
quoteStyle?: boolean;
|
836
|
+
/**
|
837
|
+
* Currently noop.
|
838
|
+
* @alias preserve_annotations
|
839
|
+
*/
|
840
|
+
preserveAnnotations?: boolean;
|
841
|
+
/**
|
842
|
+
* Currently noop.
|
843
|
+
*/
|
844
|
+
safari10?: boolean;
|
845
|
+
/**
|
846
|
+
* Currently noop.
|
847
|
+
*/
|
848
|
+
semicolons?: boolean;
|
849
|
+
/**
|
850
|
+
* Currently noop.
|
851
|
+
*/
|
852
|
+
shebang?: boolean;
|
853
|
+
/**
|
854
|
+
* Currently noop.
|
855
|
+
*/
|
856
|
+
webkit?: boolean;
|
857
|
+
/**
|
858
|
+
* Currently noop.
|
859
|
+
* @alias wrap_iife
|
860
|
+
*/
|
861
|
+
wrapIife?: boolean;
|
862
|
+
/**
|
863
|
+
* Currently noop.
|
864
|
+
* @alias wrap_func_args
|
865
|
+
*/
|
866
|
+
wrapFuncArgs?: boolean;
|
867
|
+
}
|
868
|
+
interface TerserCompressOptions {
|
869
|
+
arguments?: boolean;
|
870
|
+
arrows?: boolean;
|
871
|
+
booleans?: boolean;
|
872
|
+
booleans_as_integers?: boolean;
|
873
|
+
collapse_vars?: boolean;
|
874
|
+
comparisons?: boolean;
|
875
|
+
computed_props?: boolean;
|
876
|
+
conditionals?: boolean;
|
877
|
+
dead_code?: boolean;
|
878
|
+
defaults?: boolean;
|
879
|
+
directives?: boolean;
|
880
|
+
drop_console?: boolean;
|
881
|
+
drop_debugger?: boolean;
|
882
|
+
ecma?: TerserEcmaVersion;
|
883
|
+
evaluate?: boolean;
|
884
|
+
expression?: boolean;
|
885
|
+
global_defs?: any;
|
886
|
+
hoist_funs?: boolean;
|
887
|
+
hoist_props?: boolean;
|
888
|
+
hoist_vars?: boolean;
|
889
|
+
ie8?: boolean;
|
890
|
+
if_return?: boolean;
|
891
|
+
inline?: 0 | 1 | 2 | 3;
|
892
|
+
join_vars?: boolean;
|
893
|
+
keep_classnames?: boolean;
|
894
|
+
keep_fargs?: boolean;
|
895
|
+
keep_fnames?: boolean;
|
896
|
+
keep_infinity?: boolean;
|
897
|
+
loops?: boolean;
|
898
|
+
negate_iife?: boolean;
|
899
|
+
passes?: number;
|
900
|
+
properties?: boolean;
|
901
|
+
pure_getters?: any;
|
902
|
+
pure_funcs?: string[];
|
903
|
+
reduce_funcs?: boolean;
|
904
|
+
reduce_vars?: boolean;
|
905
|
+
sequences?: any;
|
906
|
+
side_effects?: boolean;
|
907
|
+
switches?: boolean;
|
908
|
+
top_retain?: any;
|
909
|
+
toplevel?: any;
|
910
|
+
typeofs?: boolean;
|
911
|
+
unsafe?: boolean;
|
912
|
+
unsafe_passes?: boolean;
|
913
|
+
unsafe_arrows?: boolean;
|
914
|
+
unsafe_comps?: boolean;
|
915
|
+
unsafe_function?: boolean;
|
916
|
+
unsafe_math?: boolean;
|
917
|
+
unsafe_symbols?: boolean;
|
918
|
+
unsafe_methods?: boolean;
|
919
|
+
unsafe_proto?: boolean;
|
920
|
+
unsafe_regexp?: boolean;
|
921
|
+
unsafe_undefined?: boolean;
|
922
|
+
unused?: boolean;
|
923
|
+
const_to_let?: boolean;
|
924
|
+
module?: boolean;
|
925
|
+
}
|
926
|
+
interface TerserMangleOptions {
|
927
|
+
props?: TerserManglePropertiesOptions;
|
928
|
+
toplevel?: boolean;
|
929
|
+
keep_classnames?: boolean;
|
930
|
+
keep_fnames?: boolean;
|
931
|
+
keep_private_props?: boolean;
|
932
|
+
ie8?: boolean;
|
933
|
+
safari10?: boolean;
|
934
|
+
reserved?: string[];
|
935
|
+
}
|
936
|
+
interface TerserManglePropertiesOptions {
|
937
|
+
}
|
938
|
+
/**
|
939
|
+
* Programmatic options.
|
940
|
+
*/
|
941
|
+
interface Options$2 extends Config {
|
942
|
+
/**
|
943
|
+
* If true, a file is parsed as a script instead of module.
|
944
|
+
*/
|
945
|
+
script?: boolean;
|
946
|
+
/**
|
947
|
+
* The working directory that all paths in the programmatic
|
948
|
+
* options will be resolved relative to.
|
949
|
+
*
|
950
|
+
* Defaults to `process.cwd()`.
|
951
|
+
*/
|
952
|
+
cwd?: string;
|
953
|
+
caller?: CallerOptions;
|
954
|
+
/** The filename associated with the code currently being compiled,
|
955
|
+
* if there is one. The filename is optional, but not all of Swc's
|
956
|
+
* functionality is available when the filename is unknown, because a
|
957
|
+
* subset of options rely on the filename for their functionality.
|
958
|
+
*
|
959
|
+
* The three primary cases users could run into are:
|
960
|
+
*
|
961
|
+
* - The filename is exposed to plugins. Some plugins may require the
|
962
|
+
* presence of the filename.
|
963
|
+
* - Options like "test", "exclude", and "ignore" require the filename
|
964
|
+
* for string/RegExp matching.
|
965
|
+
* - .swcrc files are loaded relative to the file being compiled.
|
966
|
+
* If this option is omitted, Swc will behave as if swcrc: false has been set.
|
967
|
+
*/
|
968
|
+
filename?: string;
|
969
|
+
/**
|
970
|
+
* The initial path that will be processed based on the "rootMode" to
|
971
|
+
* determine the conceptual root folder for the current Swc project.
|
972
|
+
* This is used in two primary cases:
|
973
|
+
*
|
974
|
+
* - The base directory when checking for the default "configFile" value
|
975
|
+
* - The default value for "swcrcRoots".
|
976
|
+
*
|
977
|
+
* Defaults to `opts.cwd`
|
978
|
+
*/
|
979
|
+
root?: string;
|
980
|
+
/**
|
981
|
+
* This option, combined with the "root" value, defines how Swc chooses
|
982
|
+
* its project root. The different modes define different ways that Swc
|
983
|
+
* can process the "root" value to get the final project root.
|
984
|
+
*
|
985
|
+
* "root" - Passes the "root" value through as unchanged.
|
986
|
+
* "upward" - Walks upward from the "root" directory, looking for a directory
|
987
|
+
* containing a swc.config.js file, and throws an error if a swc.config.js
|
988
|
+
* is not found.
|
989
|
+
* "upward-optional" - Walk upward from the "root" directory, looking for
|
990
|
+
* a directory containing a swc.config.js file, and falls back to "root"
|
991
|
+
* if a swc.config.js is not found.
|
992
|
+
*
|
993
|
+
*
|
994
|
+
* "root" is the default mode because it avoids the risk that Swc
|
995
|
+
* will accidentally load a swc.config.js that is entirely outside
|
996
|
+
* of the current project folder. If you use "upward-optional",
|
997
|
+
* be aware that it will walk up the directory structure all the
|
998
|
+
* way to the filesystem root, and it is always possible that someone
|
999
|
+
* will have a forgotten swc.config.js in their home directory,
|
1000
|
+
* which could cause unexpected errors in your builds.
|
1001
|
+
*
|
1002
|
+
*
|
1003
|
+
* Users with monorepo project structures that run builds/tests on a
|
1004
|
+
* per-package basis may well want to use "upward" since monorepos
|
1005
|
+
* often have a swc.config.js in the project root. Running Swc
|
1006
|
+
* in a monorepo subdirectory without "upward", will cause Swc
|
1007
|
+
* to skip loading any swc.config.js files in the project root,
|
1008
|
+
* which can lead to unexpected errors and compilation failure.
|
1009
|
+
*/
|
1010
|
+
rootMode?: "root" | "upward" | "upward-optional";
|
1011
|
+
/**
|
1012
|
+
* The current active environment used during configuration loading.
|
1013
|
+
* This value is used as the key when resolving "env" configs,
|
1014
|
+
* and is also available inside configuration functions, plugins,
|
1015
|
+
* and presets, via the api.env() function.
|
1016
|
+
*
|
1017
|
+
* Defaults to `process.env.SWC_ENV || process.env.NODE_ENV || "development"`
|
1018
|
+
*/
|
1019
|
+
envName?: string;
|
1020
|
+
/**
|
1021
|
+
* Defaults to searching for a default `.swcrc` file, but can
|
1022
|
+
* be passed the path of any JS or JSON5 config file.
|
1023
|
+
*
|
1024
|
+
*
|
1025
|
+
* NOTE: This option does not affect loading of .swcrc files,
|
1026
|
+
* so while it may be tempting to do configFile: "./foo/.swcrc",
|
1027
|
+
* it is not recommended. If the given .swcrc is loaded via the
|
1028
|
+
* standard file-relative logic, you'll end up loading the same
|
1029
|
+
* config file twice, merging it with itself. If you are linking
|
1030
|
+
* a specific config file, it is recommended to stick with a
|
1031
|
+
* naming scheme that is independent of the "swcrc" name.
|
1032
|
+
*
|
1033
|
+
* Defaults to `path.resolve(opts.root, ".swcrc")`
|
1034
|
+
*/
|
1035
|
+
configFile?: string | boolean;
|
1036
|
+
/**
|
1037
|
+
* true will enable searching for configuration files relative to the "filename" provided to Swc.
|
1038
|
+
*
|
1039
|
+
* A swcrc value passed in the programmatic options will override one set within a configuration file.
|
1040
|
+
*
|
1041
|
+
* Note: .swcrc files are only loaded if the current "filename" is inside of
|
1042
|
+
* a package that matches one of the "swcrcRoots" packages.
|
1043
|
+
*
|
1044
|
+
*
|
1045
|
+
* Defaults to true as long as the filename option has been specified
|
1046
|
+
*/
|
1047
|
+
swcrc?: boolean;
|
1048
|
+
/**
|
1049
|
+
* By default, Babel will only search for .babelrc files within the "root" package
|
1050
|
+
* because otherwise Babel cannot know if a given .babelrc is meant to be loaded,
|
1051
|
+
* or if it's "plugins" and "presets" have even been installed, since the file
|
1052
|
+
* being compiled could be inside node_modules, or have been symlinked into the project.
|
1053
|
+
*
|
1054
|
+
*
|
1055
|
+
* This option allows users to provide a list of other packages that should be
|
1056
|
+
* considered "root" packages when considering whether to load .babelrc files.
|
1057
|
+
*
|
1058
|
+
*
|
1059
|
+
* For example, a monorepo setup that wishes to allow individual packages
|
1060
|
+
* to have their own configs might want to do
|
1061
|
+
*
|
1062
|
+
*
|
1063
|
+
*
|
1064
|
+
* Defaults to `opts.root`
|
1065
|
+
*/
|
1066
|
+
swcrcRoots?: boolean | MatchPattern | MatchPattern[];
|
1067
|
+
/**
|
1068
|
+
* `true` will attempt to load an input sourcemap from the file itself, if it
|
1069
|
+
* contains a //# sourceMappingURL=... comment. If no map is found, or the
|
1070
|
+
* map fails to load and parse, it will be silently discarded.
|
1071
|
+
*
|
1072
|
+
* If an object is provided, it will be treated as the source map object itself.
|
1073
|
+
*
|
1074
|
+
* Defaults to `true`.
|
1075
|
+
*/
|
1076
|
+
inputSourceMap?: boolean | string;
|
1077
|
+
/**
|
1078
|
+
* The name to use for the file inside the source map object.
|
1079
|
+
*
|
1080
|
+
* Defaults to `path.basename(opts.filenameRelative)` when available, or `"unknown"`.
|
1081
|
+
*/
|
1082
|
+
sourceFileName?: string;
|
1083
|
+
/**
|
1084
|
+
* The sourceRoot fields to set in the generated source map, if one is desired.
|
1085
|
+
*/
|
1086
|
+
sourceRoot?: string;
|
1087
|
+
plugin?: Plugin;
|
1088
|
+
isModule?: boolean | "unknown";
|
1089
|
+
/**
|
1090
|
+
* Destination path. Note that this value is used only to fix source path
|
1091
|
+
* of source map files and swc does not write output to this path.
|
1092
|
+
*/
|
1093
|
+
outputPath?: string;
|
1094
|
+
}
|
1095
|
+
interface CallerOptions {
|
1096
|
+
name: string;
|
1097
|
+
[key: string]: any;
|
1098
|
+
}
|
1099
|
+
/**
|
1100
|
+
* .swcrc
|
1101
|
+
*/
|
1102
|
+
interface Config {
|
1103
|
+
/**
|
1104
|
+
* Note: The type is string because it follows rust's regex syntax.
|
1105
|
+
*/
|
1106
|
+
test?: string | string[];
|
1107
|
+
/**
|
1108
|
+
* Note: The type is string because it follows rust's regex syntax.
|
1109
|
+
*/
|
1110
|
+
exclude?: string | string[];
|
1111
|
+
env?: EnvConfig;
|
1112
|
+
jsc?: JscConfig;
|
1113
|
+
module?: ModuleConfig;
|
1114
|
+
minify?: boolean;
|
1115
|
+
/**
|
1116
|
+
* - true to generate a sourcemap for the code and include it in the result object.
|
1117
|
+
* - "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.
|
1118
|
+
*
|
1119
|
+
* `swc-cli` overloads some of these to also affect how maps are written to disk:
|
1120
|
+
*
|
1121
|
+
* - true will write the map to a .map file on disk
|
1122
|
+
* - "inline" will write the file directly, so it will have a data: containing the map
|
1123
|
+
* - Note: These options are bit weird, so it may make the most sense to just use true
|
1124
|
+
* and handle the rest in your own code, depending on your use case.
|
1125
|
+
*/
|
1126
|
+
sourceMaps?: boolean | "inline";
|
1127
|
+
inlineSourcesContent?: boolean;
|
1128
|
+
}
|
1129
|
+
/**
|
1130
|
+
* Configuration ported from babel-preset-env
|
1131
|
+
*/
|
1132
|
+
interface EnvConfig {
|
1133
|
+
mode?: "usage" | "entry";
|
1134
|
+
debug?: boolean;
|
1135
|
+
dynamicImport?: boolean;
|
1136
|
+
loose?: boolean;
|
1137
|
+
skip?: string[];
|
1138
|
+
include?: string[];
|
1139
|
+
exclude?: string[];
|
1140
|
+
/**
|
1141
|
+
* The version of the used core js.
|
1142
|
+
*
|
1143
|
+
*/
|
1144
|
+
coreJs?: string;
|
1145
|
+
targets?: any;
|
1146
|
+
path?: string;
|
1147
|
+
shippedProposals?: boolean;
|
1148
|
+
/**
|
1149
|
+
* Enable all transforms
|
1150
|
+
*/
|
1151
|
+
forceAllTransforms?: boolean;
|
1152
|
+
}
|
1153
|
+
interface JscConfig {
|
1154
|
+
loose?: boolean;
|
1155
|
+
/**
|
1156
|
+
* Defaults to EsParserConfig
|
1157
|
+
*/
|
1158
|
+
parser?: ParserConfig;
|
1159
|
+
transform?: TransformConfig;
|
1160
|
+
/**
|
1161
|
+
* Use `@swc/helpers` instead of inline helpers.
|
1162
|
+
*/
|
1163
|
+
externalHelpers?: boolean;
|
1164
|
+
/**
|
1165
|
+
* Defaults to `es3` (which enabled **all** pass).
|
1166
|
+
*/
|
1167
|
+
target?: JscTarget;
|
1168
|
+
/**
|
1169
|
+
* Keep class names.
|
1170
|
+
*/
|
1171
|
+
keepClassNames?: boolean;
|
1172
|
+
/**
|
1173
|
+
* This is experimental, and can be removed without a major version bump.
|
1174
|
+
*/
|
1175
|
+
experimental?: {
|
1176
|
+
optimizeHygiene?: boolean;
|
1177
|
+
/**
|
1178
|
+
* Preserve `with` in imports and exports.
|
1179
|
+
*/
|
1180
|
+
keepImportAttributes?: boolean;
|
1181
|
+
/**
|
1182
|
+
* Use `assert` instead of `with` for imports and exports.
|
1183
|
+
* This option only works when `keepImportAttributes` is `true`.
|
1184
|
+
*/
|
1185
|
+
emitAssertForImportAttributes?: boolean;
|
1186
|
+
/**
|
1187
|
+
* Specify the location where SWC stores its intermediate cache files.
|
1188
|
+
* Currently only transform plugin uses this. If not specified, SWC will
|
1189
|
+
* create `.swc` directories.
|
1190
|
+
*/
|
1191
|
+
cacheRoot?: string;
|
1192
|
+
/**
|
1193
|
+
* List of custom transform plugins written in WebAssembly.
|
1194
|
+
* First parameter of tuple indicates the name of the plugin - it can be either
|
1195
|
+
* a name of the npm package can be resolved, or absolute path to .wasm binary.
|
1196
|
+
*
|
1197
|
+
* Second parameter of tuple is JSON based configuration for the plugin.
|
1198
|
+
*/
|
1199
|
+
plugins?: Array<[string, Record<string, any>]>;
|
1200
|
+
/**
|
1201
|
+
* Disable builtin transforms. If enabled, only Wasm plugins are used.
|
1202
|
+
*/
|
1203
|
+
disableBuiltinTransformsForInternalTesting?: boolean;
|
1204
|
+
};
|
1205
|
+
baseUrl?: string;
|
1206
|
+
paths?: {
|
1207
|
+
[from: string]: string[];
|
1208
|
+
};
|
1209
|
+
minify?: JsMinifyOptions;
|
1210
|
+
preserveAllComments?: boolean;
|
1211
|
+
}
|
1212
|
+
type JscTarget = "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "esnext";
|
1213
|
+
type ParserConfig = TsParserConfig | EsParserConfig;
|
1214
|
+
interface TsParserConfig {
|
1215
|
+
syntax: "typescript";
|
1216
|
+
/**
|
1217
|
+
* Defaults to `false`.
|
1218
|
+
*/
|
1219
|
+
tsx?: boolean;
|
1220
|
+
/**
|
1221
|
+
* Defaults to `false`.
|
1222
|
+
*/
|
1223
|
+
decorators?: boolean;
|
1224
|
+
/**
|
1225
|
+
* Defaults to `false`
|
1226
|
+
*/
|
1227
|
+
dynamicImport?: boolean;
|
1228
|
+
}
|
1229
|
+
interface EsParserConfig {
|
1230
|
+
syntax: "ecmascript";
|
1231
|
+
/**
|
1232
|
+
* Defaults to false.
|
1233
|
+
*/
|
1234
|
+
jsx?: boolean;
|
1235
|
+
/**
|
1236
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1237
|
+
*/
|
1238
|
+
numericSeparator?: boolean;
|
1239
|
+
/**
|
1240
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1241
|
+
*/
|
1242
|
+
classPrivateProperty?: boolean;
|
1243
|
+
/**
|
1244
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1245
|
+
*/
|
1246
|
+
privateMethod?: boolean;
|
1247
|
+
/**
|
1248
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1249
|
+
*/
|
1250
|
+
classProperty?: boolean;
|
1251
|
+
/**
|
1252
|
+
* Defaults to `false`
|
1253
|
+
*/
|
1254
|
+
functionBind?: boolean;
|
1255
|
+
/**
|
1256
|
+
* Defaults to `false`
|
1257
|
+
*/
|
1258
|
+
decorators?: boolean;
|
1259
|
+
/**
|
1260
|
+
* Defaults to `false`
|
1261
|
+
*/
|
1262
|
+
decoratorsBeforeExport?: boolean;
|
1263
|
+
/**
|
1264
|
+
* Defaults to `false`
|
1265
|
+
*/
|
1266
|
+
exportDefaultFrom?: boolean;
|
1267
|
+
/**
|
1268
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1269
|
+
*/
|
1270
|
+
exportNamespaceFrom?: boolean;
|
1271
|
+
/**
|
1272
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1273
|
+
*/
|
1274
|
+
dynamicImport?: boolean;
|
1275
|
+
/**
|
1276
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1277
|
+
*/
|
1278
|
+
nullishCoalescing?: boolean;
|
1279
|
+
/**
|
1280
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1281
|
+
*/
|
1282
|
+
optionalChaining?: boolean;
|
1283
|
+
/**
|
1284
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1285
|
+
*/
|
1286
|
+
importMeta?: boolean;
|
1287
|
+
/**
|
1288
|
+
* @deprecated Always true because it's in ecmascript spec.
|
1289
|
+
*/
|
1290
|
+
topLevelAwait?: boolean;
|
1291
|
+
/**
|
1292
|
+
* Defaults to `false`
|
1293
|
+
*/
|
1294
|
+
importAssertions?: boolean;
|
1295
|
+
}
|
1296
|
+
/**
|
1297
|
+
* Options for transform.
|
1298
|
+
*/
|
1299
|
+
interface TransformConfig {
|
1300
|
+
/**
|
1301
|
+
* Effective only if `syntax` supports ƒ.
|
1302
|
+
*/
|
1303
|
+
react?: ReactConfig;
|
1304
|
+
constModules?: ConstModulesConfig;
|
1305
|
+
/**
|
1306
|
+
* Defaults to null, which skips optimizer pass.
|
1307
|
+
*/
|
1308
|
+
optimizer?: OptimizerConfig;
|
1309
|
+
/**
|
1310
|
+
* https://swc.rs/docs/configuring-swc.html#jsctransformlegacydecorator
|
1311
|
+
*/
|
1312
|
+
legacyDecorator?: boolean;
|
1313
|
+
/**
|
1314
|
+
* https://swc.rs/docs/configuring-swc.html#jsctransformdecoratormetadata
|
1315
|
+
*/
|
1316
|
+
decoratorMetadata?: boolean;
|
1317
|
+
treatConstEnumAsEnum?: boolean;
|
1318
|
+
useDefineForClassFields?: boolean;
|
1319
|
+
}
|
1320
|
+
interface ReactConfig {
|
1321
|
+
/**
|
1322
|
+
* Replace the function used when compiling JSX expressions.
|
1323
|
+
*
|
1324
|
+
* Defaults to `React.createElement`.
|
1325
|
+
*/
|
1326
|
+
pragma?: string;
|
1327
|
+
/**
|
1328
|
+
* Replace the component used when compiling JSX fragments.
|
1329
|
+
*
|
1330
|
+
* Defaults to `React.Fragment`
|
1331
|
+
*/
|
1332
|
+
pragmaFrag?: string;
|
1333
|
+
/**
|
1334
|
+
* Toggles whether or not to throw an error if a XML namespaced tag name is used. For example:
|
1335
|
+
* `<f:image />`
|
1336
|
+
*
|
1337
|
+
* Though the JSX spec allows this, it is disabled by default since React's
|
1338
|
+
* JSX does not currently have support for it.
|
1339
|
+
*
|
1340
|
+
*/
|
1341
|
+
throwIfNamespace?: boolean;
|
1342
|
+
/**
|
1343
|
+
* Toggles plugins that aid in development, such as @swc/plugin-transform-react-jsx-self
|
1344
|
+
* and @swc/plugin-transform-react-jsx-source.
|
1345
|
+
*
|
1346
|
+
* Defaults to `false`,
|
1347
|
+
*
|
1348
|
+
*/
|
1349
|
+
development?: boolean;
|
1350
|
+
/**
|
1351
|
+
* Use `Object.assign()` instead of `_extends`. Defaults to false.
|
1352
|
+
* @deprecated
|
1353
|
+
*/
|
1354
|
+
useBuiltins?: boolean;
|
1355
|
+
/**
|
1356
|
+
* Enable fast refresh feature for React app
|
1357
|
+
*/
|
1358
|
+
refresh?: boolean;
|
1359
|
+
/**
|
1360
|
+
* jsx runtime
|
1361
|
+
*/
|
1362
|
+
runtime?: "automatic" | "classic";
|
1363
|
+
/**
|
1364
|
+
* Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using `runtime` 'automatic'
|
1365
|
+
*/
|
1366
|
+
importSource?: string;
|
1367
|
+
}
|
1368
|
+
/**
|
1369
|
+
* - `import { DEBUG } from '@ember/env-flags';`
|
1370
|
+
* - `import { FEATURE_A, FEATURE_B } from '@ember/features';`
|
1371
|
+
*
|
1372
|
+
* See: https://github.com/swc-project/swc/issues/18#issuecomment-466272558
|
1373
|
+
*/
|
1374
|
+
interface ConstModulesConfig {
|
1375
|
+
globals?: {
|
1376
|
+
[module: string]: {
|
1377
|
+
[name: string]: string;
|
1378
|
+
};
|
1379
|
+
};
|
1380
|
+
}
|
1381
|
+
interface OptimizerConfig {
|
1382
|
+
simplify?: boolean;
|
1383
|
+
globals?: GlobalPassOption;
|
1384
|
+
jsonify?: {
|
1385
|
+
minCost: number;
|
1386
|
+
};
|
1387
|
+
}
|
1388
|
+
/**
|
1389
|
+
* Options for inline-global pass.
|
1390
|
+
*/
|
1391
|
+
interface GlobalPassOption {
|
1392
|
+
/**
|
1393
|
+
* Global variables that should be inlined with passed value.
|
1394
|
+
*
|
1395
|
+
* e.g. `{ __DEBUG__: true }`
|
1396
|
+
*/
|
1397
|
+
vars?: Record<string, string>;
|
1398
|
+
/**
|
1399
|
+
* Names of environment variables that should be inlined with the value of corresponding env during build.
|
1400
|
+
*
|
1401
|
+
* Defaults to `["NODE_ENV", "SWC_ENV"]`
|
1402
|
+
*/
|
1403
|
+
envs?: string[];
|
1404
|
+
/**
|
1405
|
+
* Replaces typeof calls for passed variables with corresponding value
|
1406
|
+
*
|
1407
|
+
* e.g. `{ window: 'object' }`
|
1408
|
+
*/
|
1409
|
+
typeofs?: Record<string, string>;
|
1410
|
+
}
|
1411
|
+
type ModuleConfig = Es6Config | CommonJsConfig | UmdConfig | AmdConfig | NodeNextConfig | SystemjsConfig;
|
1412
|
+
interface BaseModuleConfig {
|
1413
|
+
/**
|
1414
|
+
* By default, when using exports with babel a non-enumerable `__esModule`
|
1415
|
+
* property is exported. In some cases this property is used to determine
|
1416
|
+
* if the import is the default export or if it contains the default export.
|
1417
|
+
*
|
1418
|
+
* In order to prevent the __esModule property from being exported, you
|
1419
|
+
* can set the strict option to true.
|
1420
|
+
*
|
1421
|
+
* Defaults to `false`.
|
1422
|
+
*/
|
1423
|
+
strict?: boolean;
|
1424
|
+
/**
|
1425
|
+
* Emits 'use strict' directive.
|
1426
|
+
*
|
1427
|
+
* Defaults to `true`.
|
1428
|
+
*/
|
1429
|
+
strictMode?: boolean;
|
1430
|
+
/**
|
1431
|
+
* Changes Babel's compiled import statements to be lazily evaluated when their imported bindings are used for the first time.
|
1432
|
+
*
|
1433
|
+
* This can improve initial load time of your module because evaluating dependencies up
|
1434
|
+
* front is sometimes entirely un-necessary. This is especially the case when implementing
|
1435
|
+
* a library module.
|
1436
|
+
*
|
1437
|
+
*
|
1438
|
+
* The value of `lazy` has a few possible effects:
|
1439
|
+
*
|
1440
|
+
* - `false` - No lazy initialization of any imported module.
|
1441
|
+
* - `true` - Do not lazy-initialize local `./foo` imports, but lazy-init `foo` dependencies.
|
1442
|
+
*
|
1443
|
+
* Local paths are much more likely to have circular dependencies, which may break if loaded lazily,
|
1444
|
+
* so they are not lazy by default, whereas dependencies between independent modules are rarely cyclical.
|
1445
|
+
*
|
1446
|
+
* - `Array<string>` - Lazy-initialize all imports with source matching one of the given strings.
|
1447
|
+
*
|
1448
|
+
* -----
|
1449
|
+
*
|
1450
|
+
* The two cases where imports can never be lazy are:
|
1451
|
+
*
|
1452
|
+
* - `import "foo";`
|
1453
|
+
*
|
1454
|
+
* Side-effect imports are automatically non-lazy since their very existence means
|
1455
|
+
* that there is no binding to later kick off initialization.
|
1456
|
+
*
|
1457
|
+
* - `export * from "foo"`
|
1458
|
+
*
|
1459
|
+
* Re-exporting all names requires up-front execution because otherwise there is no
|
1460
|
+
* way to know what names need to be exported.
|
1461
|
+
*
|
1462
|
+
* Defaults to `false`.
|
1463
|
+
*/
|
1464
|
+
lazy?: boolean | string[];
|
1465
|
+
/**
|
1466
|
+
* @deprecated Use the `importInterop` option instead.
|
1467
|
+
*
|
1468
|
+
* By default, when using exports with swc a non-enumerable __esModule property is exported.
|
1469
|
+
* This property is then used to determine if the import is the default export or if
|
1470
|
+
* it contains the default export.
|
1471
|
+
*
|
1472
|
+
* In cases where the auto-unwrapping of default is not needed, you can set the noInterop option
|
1473
|
+
* to true to avoid the usage of the interopRequireDefault helper (shown in inline form above).
|
1474
|
+
*
|
1475
|
+
* Defaults to `false`.
|
1476
|
+
*/
|
1477
|
+
noInterop?: boolean;
|
1478
|
+
/**
|
1479
|
+
* Defaults to `swc`.
|
1480
|
+
*
|
1481
|
+
* CommonJS modules and ECMAScript modules are not fully compatible.
|
1482
|
+
* However, compilers, bundlers and JavaScript runtimes developed different strategies
|
1483
|
+
* to make them work together as well as possible.
|
1484
|
+
*
|
1485
|
+
* - `swc` (alias: `babel`)
|
1486
|
+
*
|
1487
|
+
* When using exports with `swc` a non-enumerable `__esModule` property is exported
|
1488
|
+
* This property is then used to determine if the import is the default export
|
1489
|
+
* or if it contains the default export.
|
1490
|
+
*
|
1491
|
+
* ```javascript
|
1492
|
+
* import foo from "foo";
|
1493
|
+
* import { bar } from "bar";
|
1494
|
+
* foo;
|
1495
|
+
* bar;
|
1496
|
+
*
|
1497
|
+
* // Is compiled to ...
|
1498
|
+
*
|
1499
|
+
* "use strict";
|
1500
|
+
*
|
1501
|
+
* function _interop_require_default(obj) {
|
1502
|
+
* return obj && obj.__esModule ? obj : { default: obj };
|
1503
|
+
* }
|
1504
|
+
*
|
1505
|
+
* var _foo = _interop_require_default(require("foo"));
|
1506
|
+
* var _bar = require("bar");
|
1507
|
+
*
|
1508
|
+
* _foo.default;
|
1509
|
+
* _bar.bar;
|
1510
|
+
* ```
|
1511
|
+
*
|
1512
|
+
* When this import interop is used, if both the imported and the importer module are compiled
|
1513
|
+
* with swc they behave as if none of them was compiled.
|
1514
|
+
*
|
1515
|
+
* This is the default behavior.
|
1516
|
+
*
|
1517
|
+
* - `node`
|
1518
|
+
*
|
1519
|
+
* When importing CommonJS files (either directly written in CommonJS, or generated with a compiler)
|
1520
|
+
* Node.js always binds the `default` export to the value of `module.exports`.
|
1521
|
+
*
|
1522
|
+
* ```javascript
|
1523
|
+
* import foo from "foo";
|
1524
|
+
* import { bar } from "bar";
|
1525
|
+
* foo;
|
1526
|
+
* bar;
|
1527
|
+
*
|
1528
|
+
* // Is compiled to ...
|
1529
|
+
*
|
1530
|
+
* "use strict";
|
1531
|
+
*
|
1532
|
+
* var _foo = require("foo");
|
1533
|
+
* var _bar = require("bar");
|
1534
|
+
*
|
1535
|
+
* _foo;
|
1536
|
+
* _bar.bar;
|
1537
|
+
* ```
|
1538
|
+
* This is not exactly the same as what Node.js does since swc allows accessing any property of `module.exports`
|
1539
|
+
* as a named export, while Node.js only allows importing statically analyzable properties of `module.exports`.
|
1540
|
+
* However, any import working in Node.js will also work when compiled with swc using `importInterop: "node"`.
|
1541
|
+
*
|
1542
|
+
* - `none`
|
1543
|
+
*
|
1544
|
+
* If you know that the imported file has been transformed with a compiler that stores the `default` export on
|
1545
|
+
* `exports.default` (such as swc or Babel), you can safely omit the `_interop_require_default` helper.
|
1546
|
+
*
|
1547
|
+
* ```javascript
|
1548
|
+
* import foo from "foo";
|
1549
|
+
* import { bar } from "bar";
|
1550
|
+
* foo;
|
1551
|
+
* bar;
|
1552
|
+
*
|
1553
|
+
* // Is compiled to ...
|
1554
|
+
*
|
1555
|
+
* "use strict";
|
1556
|
+
*
|
1557
|
+
* var _foo = require("foo");
|
1558
|
+
* var _bar = require("bar");
|
1559
|
+
*
|
1560
|
+
* _foo.default;
|
1561
|
+
* _bar.bar;
|
1562
|
+
* ```
|
1563
|
+
*/
|
1564
|
+
importInterop?: "swc" | "babel" | "node" | "none";
|
1565
|
+
/**
|
1566
|
+
* Emits `cjs-module-lexer` annotation
|
1567
|
+
* `cjs-module-lexer` is used in Node.js core for detecting the named exports available when importing a CJS module into ESM.
|
1568
|
+
* swc will emit `cjs-module-lexer` detectable annotation with this option enabled.
|
1569
|
+
*
|
1570
|
+
* Defaults to `true` if import_interop is Node, else `false`
|
1571
|
+
*/
|
1572
|
+
exportInteropAnnotation?: boolean;
|
1573
|
+
/**
|
1574
|
+
* If set to true, dynamic imports will be preserved.
|
1575
|
+
*/
|
1576
|
+
ignoreDynamic?: boolean;
|
1577
|
+
allowTopLevelThis?: boolean;
|
1578
|
+
preserveImportMeta?: boolean;
|
1579
|
+
}
|
1580
|
+
interface Es6Config extends BaseModuleConfig {
|
1581
|
+
type: "es6";
|
1582
|
+
}
|
1583
|
+
interface NodeNextConfig extends BaseModuleConfig {
|
1584
|
+
type: "nodenext";
|
1585
|
+
}
|
1586
|
+
interface CommonJsConfig extends BaseModuleConfig {
|
1587
|
+
type: "commonjs";
|
1588
|
+
}
|
1589
|
+
interface UmdConfig extends BaseModuleConfig {
|
1590
|
+
type: "umd";
|
1591
|
+
globals?: {
|
1592
|
+
[key: string]: string;
|
1593
|
+
};
|
1594
|
+
}
|
1595
|
+
interface AmdConfig extends BaseModuleConfig {
|
1596
|
+
type: "amd";
|
1597
|
+
moduleId?: string;
|
1598
|
+
}
|
1599
|
+
interface SystemjsConfig {
|
1600
|
+
type: "systemjs";
|
1601
|
+
allowTopLevelThis?: boolean;
|
1602
|
+
}
|
1603
|
+
interface MatchPattern {
|
1604
|
+
}
|
1605
|
+
interface Span {
|
1606
|
+
start: number;
|
1607
|
+
end: number;
|
1608
|
+
ctxt: number;
|
1609
|
+
}
|
1610
|
+
interface Node {
|
1611
|
+
type: string;
|
1612
|
+
}
|
1613
|
+
interface HasSpan {
|
1614
|
+
span: Span;
|
1615
|
+
}
|
1616
|
+
interface HasDecorator {
|
1617
|
+
decorators?: Decorator[];
|
1618
|
+
}
|
1619
|
+
interface Class extends HasSpan, HasDecorator {
|
1620
|
+
body: ClassMember[];
|
1621
|
+
superClass?: Expression;
|
1622
|
+
isAbstract: boolean;
|
1623
|
+
typeParams?: TsTypeParameterDeclaration;
|
1624
|
+
superTypeParams?: TsTypeParameterInstantiation;
|
1625
|
+
implements: TsExpressionWithTypeArguments[];
|
1626
|
+
}
|
1627
|
+
type ClassMember = Constructor | ClassMethod | PrivateMethod | ClassProperty | PrivateProperty | TsIndexSignature | EmptyStatement | StaticBlock;
|
1628
|
+
interface ClassPropertyBase extends Node, HasSpan, HasDecorator {
|
1629
|
+
value?: Expression;
|
1630
|
+
typeAnnotation?: TsTypeAnnotation;
|
1631
|
+
isStatic: boolean;
|
1632
|
+
accessibility?: Accessibility;
|
1633
|
+
isOptional: boolean;
|
1634
|
+
isOverride: boolean;
|
1635
|
+
readonly: boolean;
|
1636
|
+
definite: boolean;
|
1637
|
+
}
|
1638
|
+
interface ClassProperty extends ClassPropertyBase {
|
1639
|
+
type: "ClassProperty";
|
1640
|
+
key: PropertyName;
|
1641
|
+
isAbstract: boolean;
|
1642
|
+
declare: boolean;
|
1643
|
+
}
|
1644
|
+
interface PrivateProperty extends ClassPropertyBase {
|
1645
|
+
type: "PrivateProperty";
|
1646
|
+
key: PrivateName;
|
1647
|
+
}
|
1648
|
+
interface Param extends Node, HasSpan, HasDecorator {
|
1649
|
+
type: "Parameter";
|
1650
|
+
pat: Pattern;
|
1651
|
+
}
|
1652
|
+
interface Constructor extends Node, HasSpan {
|
1653
|
+
type: "Constructor";
|
1654
|
+
key: PropertyName;
|
1655
|
+
params: (TsParameterProperty | Param)[];
|
1656
|
+
body?: BlockStatement;
|
1657
|
+
accessibility?: Accessibility;
|
1658
|
+
isOptional: boolean;
|
1659
|
+
}
|
1660
|
+
interface ClassMethodBase extends Node, HasSpan {
|
1661
|
+
function: Fn;
|
1662
|
+
kind: MethodKind;
|
1663
|
+
isStatic: boolean;
|
1664
|
+
accessibility?: Accessibility;
|
1665
|
+
isAbstract: boolean;
|
1666
|
+
isOptional: boolean;
|
1667
|
+
isOverride: boolean;
|
1668
|
+
}
|
1669
|
+
interface ClassMethod extends ClassMethodBase {
|
1670
|
+
type: "ClassMethod";
|
1671
|
+
key: PropertyName;
|
1672
|
+
}
|
1673
|
+
interface PrivateMethod extends ClassMethodBase {
|
1674
|
+
type: "PrivateMethod";
|
1675
|
+
key: PrivateName;
|
1676
|
+
}
|
1677
|
+
interface StaticBlock extends Node, HasSpan {
|
1678
|
+
type: "StaticBlock";
|
1679
|
+
body: BlockStatement;
|
1680
|
+
}
|
1681
|
+
interface Decorator extends Node, HasSpan {
|
1682
|
+
type: "Decorator";
|
1683
|
+
expression: Expression;
|
1684
|
+
}
|
1685
|
+
type MethodKind = "method" | "getter" | "setter";
|
1686
|
+
type Declaration = ClassDeclaration | FunctionDeclaration | VariableDeclaration | TsInterfaceDeclaration | TsTypeAliasDeclaration | TsEnumDeclaration | TsModuleDeclaration;
|
1687
|
+
interface FunctionDeclaration extends Fn {
|
1688
|
+
type: "FunctionDeclaration";
|
1689
|
+
identifier: Identifier;
|
1690
|
+
declare: boolean;
|
1691
|
+
}
|
1692
|
+
interface ClassDeclaration extends Class, Node {
|
1693
|
+
type: "ClassDeclaration";
|
1694
|
+
identifier: Identifier;
|
1695
|
+
declare: boolean;
|
1696
|
+
}
|
1697
|
+
interface VariableDeclaration extends Node, HasSpan {
|
1698
|
+
type: "VariableDeclaration";
|
1699
|
+
kind: VariableDeclarationKind;
|
1700
|
+
declare: boolean;
|
1701
|
+
declarations: VariableDeclarator[];
|
1702
|
+
}
|
1703
|
+
type VariableDeclarationKind = "var" | "let" | "const";
|
1704
|
+
interface VariableDeclarator extends Node, HasSpan {
|
1705
|
+
type: "VariableDeclarator";
|
1706
|
+
id: Pattern;
|
1707
|
+
init?: Expression;
|
1708
|
+
definite: boolean;
|
1709
|
+
}
|
1710
|
+
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;
|
1711
|
+
interface ExpressionBase extends Node, HasSpan {
|
1712
|
+
}
|
1713
|
+
interface Identifier extends ExpressionBase {
|
1714
|
+
type: "Identifier";
|
1715
|
+
value: string;
|
1716
|
+
optional: boolean;
|
1717
|
+
}
|
1718
|
+
interface OptionalChainingExpression extends ExpressionBase {
|
1719
|
+
type: "OptionalChainingExpression";
|
1720
|
+
questionDotToken: Span;
|
1721
|
+
/**
|
1722
|
+
* Call expression or member expression.
|
1723
|
+
*/
|
1724
|
+
base: MemberExpression | OptionalChainingCall;
|
1725
|
+
}
|
1726
|
+
interface OptionalChainingCall extends ExpressionBase {
|
1727
|
+
type: "CallExpression";
|
1728
|
+
callee: Expression;
|
1729
|
+
arguments: ExprOrSpread[];
|
1730
|
+
typeArguments?: TsTypeParameterInstantiation;
|
1731
|
+
}
|
1732
|
+
interface ThisExpression extends ExpressionBase {
|
1733
|
+
type: "ThisExpression";
|
1734
|
+
}
|
1735
|
+
interface ArrayExpression extends ExpressionBase {
|
1736
|
+
type: "ArrayExpression";
|
1737
|
+
elements: (ExprOrSpread | undefined)[];
|
1738
|
+
}
|
1739
|
+
interface ExprOrSpread {
|
1740
|
+
spread?: Span;
|
1741
|
+
expression: Expression;
|
1742
|
+
}
|
1743
|
+
interface ObjectExpression extends ExpressionBase {
|
1744
|
+
type: "ObjectExpression";
|
1745
|
+
properties: (SpreadElement | Property)[];
|
1746
|
+
}
|
1747
|
+
interface Argument {
|
1748
|
+
spread?: Span;
|
1749
|
+
expression: Expression;
|
1750
|
+
}
|
1751
|
+
interface SpreadElement extends Node {
|
1752
|
+
type: "SpreadElement";
|
1753
|
+
spread: Span;
|
1754
|
+
arguments: Expression;
|
1755
|
+
}
|
1756
|
+
interface UnaryExpression extends ExpressionBase {
|
1757
|
+
type: "UnaryExpression";
|
1758
|
+
operator: UnaryOperator;
|
1759
|
+
argument: Expression;
|
1760
|
+
}
|
1761
|
+
interface UpdateExpression extends ExpressionBase {
|
1762
|
+
type: "UpdateExpression";
|
1763
|
+
operator: UpdateOperator;
|
1764
|
+
prefix: boolean;
|
1765
|
+
argument: Expression;
|
1766
|
+
}
|
1767
|
+
interface BinaryExpression extends ExpressionBase {
|
1768
|
+
type: "BinaryExpression";
|
1769
|
+
operator: BinaryOperator;
|
1770
|
+
left: Expression;
|
1771
|
+
right: Expression;
|
1772
|
+
}
|
1773
|
+
interface FunctionExpression extends Fn, ExpressionBase {
|
1774
|
+
type: "FunctionExpression";
|
1775
|
+
identifier?: Identifier;
|
1776
|
+
}
|
1777
|
+
interface ClassExpression extends Class, ExpressionBase {
|
1778
|
+
type: "ClassExpression";
|
1779
|
+
identifier?: Identifier;
|
1780
|
+
}
|
1781
|
+
interface AssignmentExpression extends ExpressionBase {
|
1782
|
+
type: "AssignmentExpression";
|
1783
|
+
operator: AssignmentOperator;
|
1784
|
+
left: Expression | Pattern;
|
1785
|
+
right: Expression;
|
1786
|
+
}
|
1787
|
+
interface MemberExpression extends ExpressionBase {
|
1788
|
+
type: "MemberExpression";
|
1789
|
+
object: Expression;
|
1790
|
+
property: Identifier | PrivateName | ComputedPropName;
|
1791
|
+
}
|
1792
|
+
interface SuperPropExpression extends ExpressionBase {
|
1793
|
+
type: "SuperPropExpression";
|
1794
|
+
obj: Super;
|
1795
|
+
property: Identifier | ComputedPropName;
|
1796
|
+
}
|
1797
|
+
interface ConditionalExpression extends ExpressionBase {
|
1798
|
+
type: "ConditionalExpression";
|
1799
|
+
test: Expression;
|
1800
|
+
consequent: Expression;
|
1801
|
+
alternate: Expression;
|
1802
|
+
}
|
1803
|
+
interface Super extends Node, HasSpan {
|
1804
|
+
type: "Super";
|
1805
|
+
}
|
1806
|
+
interface Import extends Node, HasSpan {
|
1807
|
+
type: "Import";
|
1808
|
+
}
|
1809
|
+
interface CallExpression extends ExpressionBase {
|
1810
|
+
type: "CallExpression";
|
1811
|
+
callee: Super | Import | Expression;
|
1812
|
+
arguments: Argument[];
|
1813
|
+
typeArguments?: TsTypeParameterInstantiation;
|
1814
|
+
}
|
1815
|
+
interface NewExpression extends ExpressionBase {
|
1816
|
+
type: "NewExpression";
|
1817
|
+
callee: Expression;
|
1818
|
+
arguments?: Argument[];
|
1819
|
+
typeArguments?: TsTypeParameterInstantiation;
|
1820
|
+
}
|
1821
|
+
interface SequenceExpression extends ExpressionBase {
|
1822
|
+
type: "SequenceExpression";
|
1823
|
+
expressions: Expression[];
|
1824
|
+
}
|
1825
|
+
interface ArrowFunctionExpression extends ExpressionBase {
|
1826
|
+
type: "ArrowFunctionExpression";
|
1827
|
+
params: Pattern[];
|
1828
|
+
body: BlockStatement | Expression;
|
1829
|
+
async: boolean;
|
1830
|
+
generator: boolean;
|
1831
|
+
typeParameters?: TsTypeParameterDeclaration;
|
1832
|
+
returnType?: TsTypeAnnotation;
|
1833
|
+
}
|
1834
|
+
interface YieldExpression extends ExpressionBase {
|
1835
|
+
type: "YieldExpression";
|
1836
|
+
argument?: Expression;
|
1837
|
+
delegate: boolean;
|
1838
|
+
}
|
1839
|
+
interface MetaProperty extends Node, HasSpan {
|
1840
|
+
type: "MetaProperty";
|
1841
|
+
kind: "new.target" | "import.meta";
|
1842
|
+
}
|
1843
|
+
interface AwaitExpression extends ExpressionBase {
|
1844
|
+
type: "AwaitExpression";
|
1845
|
+
argument: Expression;
|
1846
|
+
}
|
1847
|
+
interface TemplateLiteral extends ExpressionBase {
|
1848
|
+
type: "TemplateLiteral";
|
1849
|
+
expressions: Expression[];
|
1850
|
+
quasis: TemplateElement[];
|
1851
|
+
}
|
1852
|
+
interface TaggedTemplateExpression extends ExpressionBase {
|
1853
|
+
type: "TaggedTemplateExpression";
|
1854
|
+
tag: Expression;
|
1855
|
+
typeParameters?: TsTypeParameterInstantiation;
|
1856
|
+
template: TemplateLiteral;
|
1857
|
+
}
|
1858
|
+
interface TemplateElement extends ExpressionBase {
|
1859
|
+
type: "TemplateElement";
|
1860
|
+
tail: boolean;
|
1861
|
+
cooked?: string;
|
1862
|
+
raw: string;
|
1863
|
+
}
|
1864
|
+
interface ParenthesisExpression extends ExpressionBase {
|
1865
|
+
type: "ParenthesisExpression";
|
1866
|
+
expression: Expression;
|
1867
|
+
}
|
1868
|
+
interface Fn extends HasSpan, HasDecorator {
|
1869
|
+
params: Param[];
|
1870
|
+
body?: BlockStatement;
|
1871
|
+
generator: boolean;
|
1872
|
+
async: boolean;
|
1873
|
+
typeParameters?: TsTypeParameterDeclaration;
|
1874
|
+
returnType?: TsTypeAnnotation;
|
1875
|
+
}
|
1876
|
+
interface PatternBase extends Node, HasSpan {
|
1877
|
+
typeAnnotation?: TsTypeAnnotation;
|
1878
|
+
}
|
1879
|
+
interface PrivateName extends ExpressionBase {
|
1880
|
+
type: "PrivateName";
|
1881
|
+
id: Identifier;
|
1882
|
+
}
|
1883
|
+
type JSXObject = JSXMemberExpression | Identifier;
|
1884
|
+
interface JSXMemberExpression extends Node {
|
1885
|
+
type: "JSXMemberExpression";
|
1886
|
+
object: JSXObject;
|
1887
|
+
property: Identifier;
|
1888
|
+
}
|
1889
|
+
/**
|
1890
|
+
* XML-based namespace syntax:
|
1891
|
+
*/
|
1892
|
+
interface JSXNamespacedName extends Node {
|
1893
|
+
type: "JSXNamespacedName";
|
1894
|
+
namespace: Identifier;
|
1895
|
+
name: Identifier;
|
1896
|
+
}
|
1897
|
+
interface JSXEmptyExpression extends Node, HasSpan {
|
1898
|
+
type: "JSXEmptyExpression";
|
1899
|
+
}
|
1900
|
+
interface JSXExpressionContainer extends Node, HasSpan {
|
1901
|
+
type: "JSXExpressionContainer";
|
1902
|
+
expression: JSXExpression;
|
1903
|
+
}
|
1904
|
+
type JSXExpression = JSXEmptyExpression | Expression;
|
1905
|
+
interface JSXSpreadChild extends Node, HasSpan {
|
1906
|
+
type: "JSXSpreadChild";
|
1907
|
+
expression: Expression;
|
1908
|
+
}
|
1909
|
+
type JSXElementName = Identifier | JSXMemberExpression | JSXNamespacedName;
|
1910
|
+
interface JSXOpeningElement extends Node, HasSpan {
|
1911
|
+
type: "JSXOpeningElement";
|
1912
|
+
name: JSXElementName;
|
1913
|
+
attributes: JSXAttributeOrSpread[];
|
1914
|
+
selfClosing: boolean;
|
1915
|
+
typeArguments?: TsTypeParameterInstantiation;
|
1916
|
+
}
|
1917
|
+
type JSXAttributeOrSpread = JSXAttribute | SpreadElement;
|
1918
|
+
interface JSXClosingElement extends Node, HasSpan {
|
1919
|
+
type: "JSXClosingElement";
|
1920
|
+
name: JSXElementName;
|
1921
|
+
}
|
1922
|
+
interface JSXAttribute extends Node, HasSpan {
|
1923
|
+
type: "JSXAttribute";
|
1924
|
+
name: JSXAttributeName;
|
1925
|
+
value?: JSXAttrValue;
|
1926
|
+
}
|
1927
|
+
type JSXAttributeName = Identifier | JSXNamespacedName;
|
1928
|
+
type JSXAttrValue = Literal | JSXExpressionContainer | JSXElement | JSXFragment;
|
1929
|
+
interface JSXText extends Node, HasSpan {
|
1930
|
+
type: "JSXText";
|
1931
|
+
value: string;
|
1932
|
+
raw: string;
|
1933
|
+
}
|
1934
|
+
interface JSXElement extends Node, HasSpan {
|
1935
|
+
type: "JSXElement";
|
1936
|
+
opening: JSXOpeningElement;
|
1937
|
+
children: JSXElementChild[];
|
1938
|
+
closing?: JSXClosingElement;
|
1939
|
+
}
|
1940
|
+
type JSXElementChild = JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment;
|
1941
|
+
interface JSXFragment extends Node, HasSpan {
|
1942
|
+
type: "JSXFragment";
|
1943
|
+
opening: JSXOpeningFragment;
|
1944
|
+
children: JSXElementChild[];
|
1945
|
+
closing: JSXClosingFragment;
|
1946
|
+
}
|
1947
|
+
interface JSXOpeningFragment extends Node, HasSpan {
|
1948
|
+
type: "JSXOpeningFragment";
|
1949
|
+
}
|
1950
|
+
interface JSXClosingFragment extends Node, HasSpan {
|
1951
|
+
type: "JSXClosingFragment";
|
1952
|
+
}
|
1953
|
+
type Literal = StringLiteral | BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | JSXText;
|
1954
|
+
interface StringLiteral extends Node, HasSpan {
|
1955
|
+
type: "StringLiteral";
|
1956
|
+
value: string;
|
1957
|
+
raw?: string;
|
1958
|
+
}
|
1959
|
+
interface BooleanLiteral extends Node, HasSpan {
|
1960
|
+
type: "BooleanLiteral";
|
1961
|
+
value: boolean;
|
1962
|
+
}
|
1963
|
+
interface NullLiteral extends Node, HasSpan {
|
1964
|
+
type: "NullLiteral";
|
1965
|
+
}
|
1966
|
+
interface RegExpLiteral extends Node, HasSpan {
|
1967
|
+
type: "RegExpLiteral";
|
1968
|
+
pattern: string;
|
1969
|
+
flags: string;
|
1970
|
+
}
|
1971
|
+
interface NumericLiteral extends Node, HasSpan {
|
1972
|
+
type: "NumericLiteral";
|
1973
|
+
value: number;
|
1974
|
+
raw?: string;
|
1975
|
+
}
|
1976
|
+
interface BigIntLiteral extends Node, HasSpan {
|
1977
|
+
type: "BigIntLiteral";
|
1978
|
+
value: bigint;
|
1979
|
+
raw?: string;
|
1980
|
+
}
|
1981
|
+
type ModuleDeclaration = ImportDeclaration | ExportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportDefaultExpression | ExportAllDeclaration | TsImportEqualsDeclaration | TsExportAssignment | TsNamespaceExportDeclaration;
|
1982
|
+
interface ExportDefaultExpression extends Node, HasSpan {
|
1983
|
+
type: "ExportDefaultExpression";
|
1984
|
+
expression: Expression;
|
1985
|
+
}
|
1986
|
+
interface ExportDeclaration extends Node, HasSpan {
|
1987
|
+
type: "ExportDeclaration";
|
1988
|
+
declaration: Declaration;
|
1989
|
+
}
|
1990
|
+
interface ImportDeclaration extends Node, HasSpan {
|
1991
|
+
type: "ImportDeclaration";
|
1992
|
+
specifiers: ImportSpecifier[];
|
1993
|
+
source: StringLiteral;
|
1994
|
+
typeOnly: boolean;
|
1995
|
+
asserts?: ObjectExpression;
|
1996
|
+
}
|
1997
|
+
interface ExportAllDeclaration extends Node, HasSpan {
|
1998
|
+
type: "ExportAllDeclaration";
|
1999
|
+
source: StringLiteral;
|
2000
|
+
asserts?: ObjectExpression;
|
2001
|
+
}
|
2002
|
+
/**
|
2003
|
+
* - `export { foo } from 'mod'`
|
2004
|
+
* - `export { foo as bar } from 'mod'`
|
2005
|
+
*/
|
2006
|
+
interface ExportNamedDeclaration extends Node, HasSpan {
|
2007
|
+
type: "ExportNamedDeclaration";
|
2008
|
+
specifiers: ExportSpecifier[];
|
2009
|
+
source?: StringLiteral;
|
2010
|
+
typeOnly: boolean;
|
2011
|
+
asserts?: ObjectExpression;
|
2012
|
+
}
|
2013
|
+
interface ExportDefaultDeclaration extends Node, HasSpan {
|
2014
|
+
type: "ExportDefaultDeclaration";
|
2015
|
+
decl: DefaultDecl;
|
2016
|
+
}
|
2017
|
+
type DefaultDecl = ClassExpression | FunctionExpression | TsInterfaceDeclaration;
|
2018
|
+
type ImportSpecifier = NamedImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
|
2019
|
+
/**
|
2020
|
+
* e.g. `import foo from 'mod.js'`
|
2021
|
+
*/
|
2022
|
+
interface ImportDefaultSpecifier extends Node, HasSpan {
|
2023
|
+
type: "ImportDefaultSpecifier";
|
2024
|
+
local: Identifier;
|
2025
|
+
}
|
2026
|
+
/**
|
2027
|
+
* e.g. `import * as foo from 'mod.js'`.
|
2028
|
+
*/
|
2029
|
+
interface ImportNamespaceSpecifier extends Node, HasSpan {
|
2030
|
+
type: "ImportNamespaceSpecifier";
|
2031
|
+
local: Identifier;
|
2032
|
+
}
|
2033
|
+
/**
|
2034
|
+
* e.g. - `import { foo } from 'mod.js'`
|
2035
|
+
*
|
2036
|
+
* local = foo, imported = None
|
2037
|
+
*
|
2038
|
+
* e.g. `import { foo as bar } from 'mod.js'`
|
2039
|
+
*
|
2040
|
+
* local = bar, imported = Some(foo) for
|
2041
|
+
*/
|
2042
|
+
interface NamedImportSpecifier extends Node, HasSpan {
|
2043
|
+
type: "ImportSpecifier";
|
2044
|
+
local: Identifier;
|
2045
|
+
imported?: ModuleExportName;
|
2046
|
+
isTypeOnly: boolean;
|
2047
|
+
}
|
2048
|
+
type ModuleExportName = Identifier | StringLiteral;
|
2049
|
+
type ExportSpecifier = ExportNamespaceSpecifier | ExportDefaultSpecifier | NamedExportSpecifier;
|
2050
|
+
/**
|
2051
|
+
* `export * as foo from 'src';`
|
2052
|
+
*/
|
2053
|
+
interface ExportNamespaceSpecifier extends Node, HasSpan {
|
2054
|
+
type: "ExportNamespaceSpecifier";
|
2055
|
+
name: ModuleExportName;
|
2056
|
+
}
|
2057
|
+
interface ExportDefaultSpecifier extends Node, HasSpan {
|
2058
|
+
type: "ExportDefaultSpecifier";
|
2059
|
+
exported: Identifier;
|
2060
|
+
}
|
2061
|
+
interface NamedExportSpecifier extends Node, HasSpan {
|
2062
|
+
type: "ExportSpecifier";
|
2063
|
+
orig: ModuleExportName;
|
2064
|
+
/**
|
2065
|
+
* `Some(bar)` in `export { foo as bar }`
|
2066
|
+
*/
|
2067
|
+
exported?: ModuleExportName;
|
2068
|
+
isTypeOnly: boolean;
|
2069
|
+
}
|
2070
|
+
interface HasInterpreter {
|
2071
|
+
/**
|
2072
|
+
* e.g. `/usr/bin/node` for `#!/usr/bin/node`
|
2073
|
+
*/
|
2074
|
+
interpreter: string;
|
2075
|
+
}
|
2076
|
+
type Program = Module | Script;
|
2077
|
+
interface Module extends Node, HasSpan, HasInterpreter {
|
2078
|
+
type: "Module";
|
2079
|
+
body: ModuleItem[];
|
2080
|
+
}
|
2081
|
+
interface Script extends Node, HasSpan, HasInterpreter {
|
2082
|
+
type: "Script";
|
2083
|
+
body: Statement[];
|
2084
|
+
}
|
2085
|
+
type ModuleItem = ModuleDeclaration | Statement;
|
2086
|
+
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "||" | "&&" | "in" | "instanceof" | "**" | "??";
|
2087
|
+
type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "**=" | "&&=" | "||=" | "??=";
|
2088
|
+
type UpdateOperator = "++" | "--";
|
2089
|
+
type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
2090
|
+
type Pattern = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern | AssignmentPattern | Invalid | Expression;
|
2091
|
+
interface BindingIdentifier extends PatternBase {
|
2092
|
+
type: "Identifier";
|
2093
|
+
value: string;
|
2094
|
+
optional: boolean;
|
2095
|
+
}
|
2096
|
+
interface ArrayPattern extends PatternBase {
|
2097
|
+
type: "ArrayPattern";
|
2098
|
+
elements: (Pattern | undefined)[];
|
2099
|
+
optional: boolean;
|
2100
|
+
}
|
2101
|
+
interface ObjectPattern extends PatternBase {
|
2102
|
+
type: "ObjectPattern";
|
2103
|
+
properties: ObjectPatternProperty[];
|
2104
|
+
optional: boolean;
|
2105
|
+
}
|
2106
|
+
interface AssignmentPattern extends PatternBase {
|
2107
|
+
type: "AssignmentPattern";
|
2108
|
+
left: Pattern;
|
2109
|
+
right: Expression;
|
2110
|
+
}
|
2111
|
+
interface RestElement extends PatternBase {
|
2112
|
+
type: "RestElement";
|
2113
|
+
rest: Span;
|
2114
|
+
argument: Pattern;
|
2115
|
+
}
|
2116
|
+
type ObjectPatternProperty = KeyValuePatternProperty | AssignmentPatternProperty | RestElement;
|
2117
|
+
/**
|
2118
|
+
* `{key: value}`
|
2119
|
+
*/
|
2120
|
+
interface KeyValuePatternProperty extends Node {
|
2121
|
+
type: "KeyValuePatternProperty";
|
2122
|
+
key: PropertyName;
|
2123
|
+
value: Pattern;
|
2124
|
+
}
|
2125
|
+
/**
|
2126
|
+
* `{key}` or `{key = value}`
|
2127
|
+
*/
|
2128
|
+
interface AssignmentPatternProperty extends Node, HasSpan {
|
2129
|
+
type: "AssignmentPatternProperty";
|
2130
|
+
key: Identifier;
|
2131
|
+
value?: Expression;
|
2132
|
+
}
|
2133
|
+
/** Identifier is `a` in `{ a, }` */
|
2134
|
+
type Property = Identifier | KeyValueProperty | AssignmentProperty | GetterProperty | SetterProperty | MethodProperty;
|
2135
|
+
interface PropBase extends Node {
|
2136
|
+
key: PropertyName;
|
2137
|
+
}
|
2138
|
+
interface KeyValueProperty extends PropBase {
|
2139
|
+
type: "KeyValueProperty";
|
2140
|
+
value: Expression;
|
2141
|
+
}
|
2142
|
+
interface AssignmentProperty extends Node {
|
2143
|
+
type: "AssignmentProperty";
|
2144
|
+
key: Identifier;
|
2145
|
+
value: Expression;
|
2146
|
+
}
|
2147
|
+
interface GetterProperty extends PropBase, HasSpan {
|
2148
|
+
type: "GetterProperty";
|
2149
|
+
typeAnnotation?: TsTypeAnnotation;
|
2150
|
+
body?: BlockStatement;
|
2151
|
+
}
|
2152
|
+
interface SetterProperty extends PropBase, HasSpan {
|
2153
|
+
type: "SetterProperty";
|
2154
|
+
param: Pattern;
|
2155
|
+
body?: BlockStatement;
|
2156
|
+
}
|
2157
|
+
interface MethodProperty extends PropBase, Fn {
|
2158
|
+
type: "MethodProperty";
|
2159
|
+
}
|
2160
|
+
type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropName | BigIntLiteral;
|
2161
|
+
interface ComputedPropName extends Node, HasSpan {
|
2162
|
+
type: "Computed";
|
2163
|
+
expression: Expression;
|
2164
|
+
}
|
2165
|
+
interface BlockStatement extends Node, HasSpan {
|
2166
|
+
type: "BlockStatement";
|
2167
|
+
stmts: Statement[];
|
2168
|
+
}
|
2169
|
+
interface ExpressionStatement extends Node, HasSpan {
|
2170
|
+
type: "ExpressionStatement";
|
2171
|
+
expression: Expression;
|
2172
|
+
}
|
2173
|
+
type Statement = BlockStatement | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration | ExpressionStatement;
|
2174
|
+
interface EmptyStatement extends Node, HasSpan {
|
2175
|
+
type: "EmptyStatement";
|
2176
|
+
}
|
2177
|
+
interface DebuggerStatement extends Node, HasSpan {
|
2178
|
+
type: "DebuggerStatement";
|
2179
|
+
}
|
2180
|
+
interface WithStatement extends Node, HasSpan {
|
2181
|
+
type: "WithStatement";
|
2182
|
+
object: Expression;
|
2183
|
+
body: Statement;
|
2184
|
+
}
|
2185
|
+
interface ReturnStatement extends Node, HasSpan {
|
2186
|
+
type: "ReturnStatement";
|
2187
|
+
argument?: Expression;
|
2188
|
+
}
|
2189
|
+
interface LabeledStatement extends Node, HasSpan {
|
2190
|
+
type: "LabeledStatement";
|
2191
|
+
label: Identifier;
|
2192
|
+
body: Statement;
|
2193
|
+
}
|
2194
|
+
interface BreakStatement extends Node, HasSpan {
|
2195
|
+
type: "BreakStatement";
|
2196
|
+
label?: Identifier;
|
2197
|
+
}
|
2198
|
+
interface ContinueStatement extends Node, HasSpan {
|
2199
|
+
type: "ContinueStatement";
|
2200
|
+
label?: Identifier;
|
2201
|
+
}
|
2202
|
+
interface IfStatement extends Node, HasSpan {
|
2203
|
+
type: "IfStatement";
|
2204
|
+
test: Expression;
|
2205
|
+
consequent: Statement;
|
2206
|
+
alternate?: Statement;
|
2207
|
+
}
|
2208
|
+
interface SwitchStatement extends Node, HasSpan {
|
2209
|
+
type: "SwitchStatement";
|
2210
|
+
discriminant: Expression;
|
2211
|
+
cases: SwitchCase[];
|
2212
|
+
}
|
2213
|
+
interface ThrowStatement extends Node, HasSpan {
|
2214
|
+
type: "ThrowStatement";
|
2215
|
+
argument: Expression;
|
2216
|
+
}
|
2217
|
+
interface TryStatement extends Node, HasSpan {
|
2218
|
+
type: "TryStatement";
|
2219
|
+
block: BlockStatement;
|
2220
|
+
handler?: CatchClause;
|
2221
|
+
finalizer?: BlockStatement;
|
2222
|
+
}
|
2223
|
+
interface WhileStatement extends Node, HasSpan {
|
2224
|
+
type: "WhileStatement";
|
2225
|
+
test: Expression;
|
2226
|
+
body: Statement;
|
2227
|
+
}
|
2228
|
+
interface DoWhileStatement extends Node, HasSpan {
|
2229
|
+
type: "DoWhileStatement";
|
2230
|
+
test: Expression;
|
2231
|
+
body: Statement;
|
2232
|
+
}
|
2233
|
+
interface ForStatement extends Node, HasSpan {
|
2234
|
+
type: "ForStatement";
|
2235
|
+
init?: VariableDeclaration | Expression;
|
2236
|
+
test?: Expression;
|
2237
|
+
update?: Expression;
|
2238
|
+
body: Statement;
|
2239
|
+
}
|
2240
|
+
interface ForInStatement extends Node, HasSpan {
|
2241
|
+
type: "ForInStatement";
|
2242
|
+
left: VariableDeclaration | Pattern;
|
2243
|
+
right: Expression;
|
2244
|
+
body: Statement;
|
2245
|
+
}
|
2246
|
+
interface ForOfStatement extends Node, HasSpan {
|
2247
|
+
type: "ForOfStatement";
|
2248
|
+
/**
|
2249
|
+
* Span of the await token.
|
2250
|
+
*
|
2251
|
+
* es2018 for-await-of statements, e.g., `for await (const x of xs) {`
|
2252
|
+
*/
|
2253
|
+
await?: Span;
|
2254
|
+
left: VariableDeclaration | Pattern;
|
2255
|
+
right: Expression;
|
2256
|
+
body: Statement;
|
2257
|
+
}
|
2258
|
+
interface SwitchCase extends Node, HasSpan {
|
2259
|
+
type: "SwitchCase";
|
2260
|
+
/**
|
2261
|
+
* Undefined for default case
|
2262
|
+
*/
|
2263
|
+
test?: Expression;
|
2264
|
+
consequent: Statement[];
|
2265
|
+
}
|
2266
|
+
interface CatchClause extends Node, HasSpan {
|
2267
|
+
type: "CatchClause";
|
2268
|
+
/**
|
2269
|
+
* The param is `undefined` if the catch binding is omitted. E.g., `try { foo() } catch {}`
|
2270
|
+
*/
|
2271
|
+
param?: Pattern;
|
2272
|
+
body: BlockStatement;
|
2273
|
+
}
|
2274
|
+
interface TsTypeAnnotation extends Node, HasSpan {
|
2275
|
+
type: "TsTypeAnnotation";
|
2276
|
+
typeAnnotation: TsType;
|
2277
|
+
}
|
2278
|
+
interface TsTypeParameterDeclaration extends Node, HasSpan {
|
2279
|
+
type: "TsTypeParameterDeclaration";
|
2280
|
+
parameters: TsTypeParameter[];
|
2281
|
+
}
|
2282
|
+
interface TsTypeParameter extends Node, HasSpan {
|
2283
|
+
type: "TsTypeParameter";
|
2284
|
+
name: Identifier;
|
2285
|
+
in: boolean;
|
2286
|
+
out: boolean;
|
2287
|
+
constraint?: TsType;
|
2288
|
+
default?: TsType;
|
2289
|
+
}
|
2290
|
+
interface TsTypeParameterInstantiation extends Node, HasSpan {
|
2291
|
+
type: "TsTypeParameterInstantiation";
|
2292
|
+
params: TsType[];
|
2293
|
+
}
|
2294
|
+
interface TsParameterProperty extends Node, HasSpan, HasDecorator {
|
2295
|
+
type: "TsParameterProperty";
|
2296
|
+
accessibility?: Accessibility;
|
2297
|
+
override: boolean;
|
2298
|
+
readonly: boolean;
|
2299
|
+
param: TsParameterPropertyParameter;
|
2300
|
+
}
|
2301
|
+
type TsParameterPropertyParameter = BindingIdentifier | AssignmentPattern;
|
2302
|
+
interface TsQualifiedName extends Node {
|
2303
|
+
type: "TsQualifiedName";
|
2304
|
+
left: TsEntityName;
|
2305
|
+
right: Identifier;
|
2306
|
+
}
|
2307
|
+
type TsEntityName = TsQualifiedName | Identifier;
|
2308
|
+
type TsTypeElement = TsCallSignatureDeclaration | TsConstructSignatureDeclaration | TsPropertySignature | TsGetterSignature | TsSetterSignature | TsMethodSignature | TsIndexSignature;
|
2309
|
+
interface TsCallSignatureDeclaration extends Node, HasSpan {
|
2310
|
+
type: "TsCallSignatureDeclaration";
|
2311
|
+
params: TsFnParameter[];
|
2312
|
+
typeAnnotation?: TsTypeAnnotation;
|
2313
|
+
typeParams?: TsTypeParameterDeclaration;
|
2314
|
+
}
|
2315
|
+
interface TsConstructSignatureDeclaration extends Node, HasSpan {
|
2316
|
+
type: "TsConstructSignatureDeclaration";
|
2317
|
+
params: TsFnParameter[];
|
2318
|
+
typeAnnotation?: TsTypeAnnotation;
|
2319
|
+
typeParams?: TsTypeParameterDeclaration;
|
2320
|
+
}
|
2321
|
+
interface TsPropertySignature extends Node, HasSpan {
|
2322
|
+
type: "TsPropertySignature";
|
2323
|
+
readonly: boolean;
|
2324
|
+
key: Expression;
|
2325
|
+
computed: boolean;
|
2326
|
+
optional: boolean;
|
2327
|
+
init?: Expression;
|
2328
|
+
params: TsFnParameter[];
|
2329
|
+
typeAnnotation?: TsTypeAnnotation;
|
2330
|
+
typeParams?: TsTypeParameterDeclaration;
|
2331
|
+
}
|
2332
|
+
interface TsGetterSignature extends Node, HasSpan {
|
2333
|
+
type: "TsGetterSignature";
|
2334
|
+
readonly: boolean;
|
2335
|
+
key: Expression;
|
2336
|
+
computed: boolean;
|
2337
|
+
optional: boolean;
|
2338
|
+
typeAnnotation?: TsTypeAnnotation;
|
2339
|
+
}
|
2340
|
+
interface TsSetterSignature extends Node, HasSpan {
|
2341
|
+
type: "TsSetterSignature";
|
2342
|
+
readonly: boolean;
|
2343
|
+
key: Expression;
|
2344
|
+
computed: boolean;
|
2345
|
+
optional: boolean;
|
2346
|
+
param: TsFnParameter;
|
2347
|
+
}
|
2348
|
+
interface TsMethodSignature extends Node, HasSpan {
|
2349
|
+
type: "TsMethodSignature";
|
2350
|
+
readonly: boolean;
|
2351
|
+
key: Expression;
|
2352
|
+
computed: boolean;
|
2353
|
+
optional: boolean;
|
2354
|
+
params: TsFnParameter[];
|
2355
|
+
typeAnn?: TsTypeAnnotation;
|
2356
|
+
typeParams?: TsTypeParameterDeclaration;
|
2357
|
+
}
|
2358
|
+
interface TsIndexSignature extends Node, HasSpan {
|
2359
|
+
type: "TsIndexSignature";
|
2360
|
+
params: TsFnParameter[];
|
2361
|
+
typeAnnotation?: TsTypeAnnotation;
|
2362
|
+
readonly: boolean;
|
2363
|
+
static: boolean;
|
2364
|
+
}
|
2365
|
+
type TsType = TsKeywordType | TsThisType | TsFnOrConstructorType | TsTypeReference | TsTypeQuery | TsTypeLiteral | TsArrayType | TsTupleType | TsOptionalType | TsRestType | TsUnionOrIntersectionType | TsConditionalType | TsInferType | TsParenthesizedType | TsTypeOperator | TsIndexedAccessType | TsMappedType | TsLiteralType | TsTypePredicate | TsImportType;
|
2366
|
+
type TsFnOrConstructorType = TsFunctionType | TsConstructorType;
|
2367
|
+
interface TsKeywordType extends Node, HasSpan {
|
2368
|
+
type: "TsKeywordType";
|
2369
|
+
kind: TsKeywordTypeKind;
|
2370
|
+
}
|
2371
|
+
type TsKeywordTypeKind = "any" | "unknown" | "number" | "object" | "boolean" | "bigint" | "string" | "symbol" | "void" | "undefined" | "null" | "never" | "intrinsic";
|
2372
|
+
interface TsThisType extends Node, HasSpan {
|
2373
|
+
type: "TsThisType";
|
2374
|
+
}
|
2375
|
+
type TsFnParameter = BindingIdentifier | ArrayPattern | RestElement | ObjectPattern;
|
2376
|
+
interface TsFunctionType extends Node, HasSpan {
|
2377
|
+
type: "TsFunctionType";
|
2378
|
+
params: TsFnParameter[];
|
2379
|
+
typeParams?: TsTypeParameterDeclaration;
|
2380
|
+
typeAnnotation: TsTypeAnnotation;
|
2381
|
+
}
|
2382
|
+
interface TsConstructorType extends Node, HasSpan {
|
2383
|
+
type: "TsConstructorType";
|
2384
|
+
params: TsFnParameter[];
|
2385
|
+
typeParams?: TsTypeParameterDeclaration;
|
2386
|
+
typeAnnotation: TsTypeAnnotation;
|
2387
|
+
isAbstract: boolean;
|
2388
|
+
}
|
2389
|
+
interface TsTypeReference extends Node, HasSpan {
|
2390
|
+
type: "TsTypeReference";
|
2391
|
+
typeName: TsEntityName;
|
2392
|
+
typeParams?: TsTypeParameterInstantiation;
|
2393
|
+
}
|
2394
|
+
interface TsTypePredicate extends Node, HasSpan {
|
2395
|
+
type: "TsTypePredicate";
|
2396
|
+
asserts: boolean;
|
2397
|
+
paramName: TsThisTypeOrIdent;
|
2398
|
+
typeAnnotation?: TsTypeAnnotation;
|
2399
|
+
}
|
2400
|
+
type TsThisTypeOrIdent = TsThisType | Identifier;
|
2401
|
+
interface TsImportType extends Node, HasSpan {
|
2402
|
+
type: "TsImportType";
|
2403
|
+
argument: StringLiteral;
|
2404
|
+
qualifier?: TsEntityName;
|
2405
|
+
typeArguments?: TsTypeParameterInstantiation;
|
2406
|
+
}
|
2407
|
+
/**
|
2408
|
+
* `typeof` operator
|
2409
|
+
*/
|
2410
|
+
interface TsTypeQuery extends Node, HasSpan {
|
2411
|
+
type: "TsTypeQuery";
|
2412
|
+
exprName: TsTypeQueryExpr;
|
2413
|
+
typeArguments?: TsTypeParameterInstantiation;
|
2414
|
+
}
|
2415
|
+
type TsTypeQueryExpr = TsEntityName | TsImportType;
|
2416
|
+
interface TsTypeLiteral extends Node, HasSpan {
|
2417
|
+
type: "TsTypeLiteral";
|
2418
|
+
members: TsTypeElement[];
|
2419
|
+
}
|
2420
|
+
interface TsArrayType extends Node, HasSpan {
|
2421
|
+
type: "TsArrayType";
|
2422
|
+
elemType: TsType;
|
2423
|
+
}
|
2424
|
+
interface TsTupleType extends Node, HasSpan {
|
2425
|
+
type: "TsTupleType";
|
2426
|
+
elemTypes: TsTupleElement[];
|
2427
|
+
}
|
2428
|
+
interface TsTupleElement extends Node, HasSpan {
|
2429
|
+
type: "TsTupleElement";
|
2430
|
+
label?: Pattern;
|
2431
|
+
ty: TsType;
|
2432
|
+
}
|
2433
|
+
interface TsOptionalType extends Node, HasSpan {
|
2434
|
+
type: "TsOptionalType";
|
2435
|
+
typeAnnotation: TsType;
|
2436
|
+
}
|
2437
|
+
interface TsRestType extends Node, HasSpan {
|
2438
|
+
type: "TsRestType";
|
2439
|
+
typeAnnotation: TsType;
|
2440
|
+
}
|
2441
|
+
type TsUnionOrIntersectionType = TsUnionType | TsIntersectionType;
|
2442
|
+
interface TsUnionType extends Node, HasSpan {
|
2443
|
+
type: "TsUnionType";
|
2444
|
+
types: TsType[];
|
2445
|
+
}
|
2446
|
+
interface TsIntersectionType extends Node, HasSpan {
|
2447
|
+
type: "TsIntersectionType";
|
2448
|
+
types: TsType[];
|
2449
|
+
}
|
2450
|
+
interface TsConditionalType extends Node, HasSpan {
|
2451
|
+
type: "TsConditionalType";
|
2452
|
+
checkType: TsType;
|
2453
|
+
extendsType: TsType;
|
2454
|
+
trueType: TsType;
|
2455
|
+
falseType: TsType;
|
2456
|
+
}
|
2457
|
+
interface TsInferType extends Node, HasSpan {
|
2458
|
+
type: "TsInferType";
|
2459
|
+
typeParam: TsTypeParameter;
|
2460
|
+
}
|
2461
|
+
interface TsParenthesizedType extends Node, HasSpan {
|
2462
|
+
type: "TsParenthesizedType";
|
2463
|
+
typeAnnotation: TsType;
|
2464
|
+
}
|
2465
|
+
interface TsTypeOperator extends Node, HasSpan {
|
2466
|
+
type: "TsTypeOperator";
|
2467
|
+
op: TsTypeOperatorOp;
|
2468
|
+
typeAnnotation: TsType;
|
2469
|
+
}
|
2470
|
+
type TsTypeOperatorOp = "keyof" | "unique" | "readonly";
|
2471
|
+
interface TsIndexedAccessType extends Node, HasSpan {
|
2472
|
+
type: "TsIndexedAccessType";
|
2473
|
+
readonly: boolean;
|
2474
|
+
objectType: TsType;
|
2475
|
+
indexType: TsType;
|
2476
|
+
}
|
2477
|
+
type TruePlusMinus = true | "+" | "-";
|
2478
|
+
interface TsMappedType extends Node, HasSpan {
|
2479
|
+
type: "TsMappedType";
|
2480
|
+
readonly?: TruePlusMinus;
|
2481
|
+
typeParam: TsTypeParameter;
|
2482
|
+
nameType?: TsType;
|
2483
|
+
optional?: TruePlusMinus;
|
2484
|
+
typeAnnotation?: TsType;
|
2485
|
+
}
|
2486
|
+
interface TsLiteralType extends Node, HasSpan {
|
2487
|
+
type: "TsLiteralType";
|
2488
|
+
literal: TsLiteral;
|
2489
|
+
}
|
2490
|
+
type TsLiteral = NumericLiteral | StringLiteral | BooleanLiteral | BigIntLiteral | TsTemplateLiteralType;
|
2491
|
+
interface TsTemplateLiteralType extends Node, HasSpan {
|
2492
|
+
type: "TemplateLiteral";
|
2493
|
+
types: TsType[];
|
2494
|
+
quasis: TemplateElement[];
|
2495
|
+
}
|
2496
|
+
interface TsInterfaceDeclaration extends Node, HasSpan {
|
2497
|
+
type: "TsInterfaceDeclaration";
|
2498
|
+
id: Identifier;
|
2499
|
+
declare: boolean;
|
2500
|
+
typeParams?: TsTypeParameterDeclaration;
|
2501
|
+
extends: TsExpressionWithTypeArguments[];
|
2502
|
+
body: TsInterfaceBody;
|
2503
|
+
}
|
2504
|
+
interface TsInterfaceBody extends Node, HasSpan {
|
2505
|
+
type: "TsInterfaceBody";
|
2506
|
+
body: TsTypeElement[];
|
2507
|
+
}
|
2508
|
+
interface TsExpressionWithTypeArguments extends Node, HasSpan {
|
2509
|
+
type: "TsExpressionWithTypeArguments";
|
2510
|
+
expression: Expression;
|
2511
|
+
typeArguments?: TsTypeParameterInstantiation;
|
2512
|
+
}
|
2513
|
+
interface TsTypeAliasDeclaration extends Node, HasSpan {
|
2514
|
+
type: "TsTypeAliasDeclaration";
|
2515
|
+
declare: boolean;
|
2516
|
+
id: Identifier;
|
2517
|
+
typeParams?: TsTypeParameterDeclaration;
|
2518
|
+
typeAnnotation: TsType;
|
2519
|
+
}
|
2520
|
+
interface TsEnumDeclaration extends Node, HasSpan {
|
2521
|
+
type: "TsEnumDeclaration";
|
2522
|
+
declare: boolean;
|
2523
|
+
isConst: boolean;
|
2524
|
+
id: Identifier;
|
2525
|
+
members: TsEnumMember[];
|
2526
|
+
}
|
2527
|
+
interface TsEnumMember extends Node, HasSpan {
|
2528
|
+
type: "TsEnumMember";
|
2529
|
+
id: TsEnumMemberId;
|
2530
|
+
init?: Expression;
|
2531
|
+
}
|
2532
|
+
type TsEnumMemberId = Identifier | StringLiteral;
|
2533
|
+
interface TsModuleDeclaration extends Node, HasSpan {
|
2534
|
+
type: "TsModuleDeclaration";
|
2535
|
+
declare: boolean;
|
2536
|
+
global: boolean;
|
2537
|
+
id: TsModuleName;
|
2538
|
+
body?: TsNamespaceBody;
|
2539
|
+
}
|
2540
|
+
/**
|
2541
|
+
* `namespace A.B { }` is a namespace named `A` with another TsNamespaceDecl as its body.
|
2542
|
+
*/
|
2543
|
+
type TsNamespaceBody = TsModuleBlock | TsNamespaceDeclaration;
|
2544
|
+
interface TsModuleBlock extends Node, HasSpan {
|
2545
|
+
type: "TsModuleBlock";
|
2546
|
+
body: ModuleItem[];
|
2547
|
+
}
|
2548
|
+
interface TsNamespaceDeclaration extends Node, HasSpan {
|
2549
|
+
type: "TsNamespaceDeclaration";
|
2550
|
+
declare: boolean;
|
2551
|
+
global: boolean;
|
2552
|
+
id: Identifier;
|
2553
|
+
body: TsNamespaceBody;
|
2554
|
+
}
|
2555
|
+
type TsModuleName = Identifier | StringLiteral;
|
2556
|
+
interface TsImportEqualsDeclaration extends Node, HasSpan {
|
2557
|
+
type: "TsImportEqualsDeclaration";
|
2558
|
+
declare: boolean;
|
2559
|
+
isExport: boolean;
|
2560
|
+
isTypeOnly: boolean;
|
2561
|
+
id: Identifier;
|
2562
|
+
moduleRef: TsModuleReference;
|
2563
|
+
}
|
2564
|
+
type TsModuleReference = TsEntityName | TsExternalModuleReference;
|
2565
|
+
interface TsExternalModuleReference extends Node, HasSpan {
|
2566
|
+
type: "TsExternalModuleReference";
|
2567
|
+
expression: StringLiteral;
|
2568
|
+
}
|
2569
|
+
interface TsExportAssignment extends Node, HasSpan {
|
2570
|
+
type: "TsExportAssignment";
|
2571
|
+
expression: Expression;
|
2572
|
+
}
|
2573
|
+
interface TsNamespaceExportDeclaration extends Node, HasSpan {
|
2574
|
+
type: "TsNamespaceExportDeclaration";
|
2575
|
+
id: Identifier;
|
2576
|
+
}
|
2577
|
+
interface TsAsExpression extends ExpressionBase {
|
2578
|
+
type: "TsAsExpression";
|
2579
|
+
expression: Expression;
|
2580
|
+
typeAnnotation: TsType;
|
2581
|
+
}
|
2582
|
+
interface TsSatisfiesExpression extends ExpressionBase {
|
2583
|
+
type: "TsSatisfiesExpression";
|
2584
|
+
expression: Expression;
|
2585
|
+
typeAnnotation: TsType;
|
2586
|
+
}
|
2587
|
+
interface TsInstantiation extends Node, HasSpan {
|
2588
|
+
type: "TsInstantiation";
|
2589
|
+
expression: Expression;
|
2590
|
+
typeArguments: TsTypeParameterInstantiation;
|
2591
|
+
}
|
2592
|
+
interface TsTypeAssertion extends ExpressionBase {
|
2593
|
+
type: "TsTypeAssertion";
|
2594
|
+
expression: Expression;
|
2595
|
+
typeAnnotation: TsType;
|
2596
|
+
}
|
2597
|
+
interface TsConstAssertion extends ExpressionBase {
|
2598
|
+
type: "TsConstAssertion";
|
2599
|
+
expression: Expression;
|
2600
|
+
}
|
2601
|
+
interface TsNonNullExpression extends ExpressionBase {
|
2602
|
+
type: "TsNonNullExpression";
|
2603
|
+
expression: Expression;
|
2604
|
+
}
|
2605
|
+
type Accessibility = "public" | "protected" | "private";
|
2606
|
+
interface Invalid extends Node, HasSpan {
|
2607
|
+
type: "Invalid";
|
2608
|
+
}
|
2609
|
+
|
2610
|
+
interface Options$1 {
|
2611
|
+
allowRegExp: boolean;
|
2612
|
+
allowFunction: boolean;
|
2613
|
+
allowSymbol: boolean;
|
2614
|
+
allowDate: boolean;
|
2615
|
+
allowUndefined: boolean;
|
2616
|
+
allowClass: boolean;
|
2617
|
+
allowError: boolean;
|
2618
|
+
maxDepth: number;
|
2619
|
+
space: number | undefined;
|
2620
|
+
lazyEval: boolean;
|
2621
|
+
}
|
2622
|
+
|
2623
|
+
type ExportName = string;
|
2624
|
+
type MetaId = string;
|
2625
|
+
interface StoriesSpecifier {
|
2626
|
+
/**
|
2627
|
+
* When auto-titling, what to prefix all generated titles with (default: '')
|
2628
|
+
*/
|
2629
|
+
titlePrefix?: string;
|
2630
|
+
/**
|
2631
|
+
* Where to start looking for story files
|
2632
|
+
*/
|
2633
|
+
directory: string;
|
2634
|
+
/**
|
2635
|
+
* What does the filename of a story file look like?
|
2636
|
+
* (a glob, relative to directory, no leading `./`)
|
2637
|
+
* If unset, we use `** / *.@(mdx|stories.@(mdx|js|jsx|mjs|ts|tsx))` (no spaces)
|
2638
|
+
*/
|
2639
|
+
files?: string;
|
2640
|
+
}
|
2641
|
+
type StoriesEntry = string | StoriesSpecifier;
|
2642
|
+
interface IndexerOptions {
|
2643
|
+
makeTitle: (userTitle?: string) => string;
|
2644
|
+
}
|
2645
|
+
interface IndexedStory {
|
2646
|
+
id: string;
|
2647
|
+
name: string;
|
2648
|
+
tags?: Tag[];
|
2649
|
+
parameters?: Parameters;
|
2650
|
+
}
|
2651
|
+
interface IndexedCSFFile {
|
2652
|
+
meta: {
|
2653
|
+
id?: string;
|
2654
|
+
title?: string;
|
2655
|
+
tags?: Tag[];
|
2656
|
+
};
|
2657
|
+
stories: IndexedStory[];
|
2658
|
+
}
|
2659
|
+
/**
|
2660
|
+
* FIXME: This is a temporary type to allow us to deprecate the old indexer API.
|
2661
|
+
* We should remove this type and the deprecated indexer API in 8.0.
|
2662
|
+
*/
|
2663
|
+
type BaseIndexer = {
|
2664
|
+
/**
|
2665
|
+
* A regular expression that should match all files to be handled by this indexer
|
2666
|
+
*/
|
2667
|
+
test: RegExp;
|
2668
|
+
};
|
2669
|
+
/**
|
2670
|
+
* An indexer describes which filenames it handles, and how to index each individual file - turning it into an entry in the index.
|
2671
|
+
*/
|
2672
|
+
type Indexer = BaseIndexer & {
|
2673
|
+
/**
|
2674
|
+
* Indexes a file containing stories or docs.
|
2675
|
+
* @param fileName The name of the file to index.
|
2676
|
+
* @param options {@link IndexerOptions} for indexing the file.
|
2677
|
+
* @returns A promise that resolves to an array of {@link IndexInput} objects.
|
2678
|
+
*/
|
2679
|
+
createIndex: (fileName: string, options: IndexerOptions) => Promise<IndexInput[]>;
|
2680
|
+
/**
|
2681
|
+
* @deprecated Use {@link index} instead
|
2682
|
+
*/
|
2683
|
+
indexer?: never;
|
2684
|
+
};
|
2685
|
+
type DeprecatedIndexer = BaseIndexer & {
|
2686
|
+
indexer: (fileName: string, options: IndexerOptions) => Promise<IndexedCSFFile>;
|
2687
|
+
createIndex?: never;
|
2688
|
+
};
|
2689
|
+
/**
|
2690
|
+
* @deprecated Use {@link Indexer} instead
|
2691
|
+
*/
|
2692
|
+
type StoryIndexer = Indexer | DeprecatedIndexer;
|
2693
|
+
/**
|
2694
|
+
* The base input for indexing a story or docs entry.
|
2695
|
+
*/
|
2696
|
+
type BaseIndexInput = {
|
2697
|
+
/** The file to import from e.g. the story file. */
|
2698
|
+
importPath: Path;
|
2699
|
+
/** The name of the export to import. */
|
2700
|
+
exportName: ExportName;
|
2701
|
+
/** The name of the entry, auto-generated from {@link exportName} if unspecified. */
|
2702
|
+
name?: StoryName;
|
2703
|
+
/** The location in the sidebar, auto-generated from {@link importPath} if unspecified. */
|
2704
|
+
title?: ComponentTitle;
|
2705
|
+
/**
|
2706
|
+
* The custom id optionally set at `meta.id` if it needs to differ from the id generated via {@link title}.
|
2707
|
+
* If unspecified, the meta id will be auto-generated from {@link title}.
|
2708
|
+
* If specified, the meta in the CSF file _must_ have a matching id set at `meta.id`, to be correctly matched.
|
2709
|
+
*/
|
2710
|
+
metaId?: MetaId;
|
2711
|
+
/** Tags for filtering entries in Storybook and its tools. */
|
2712
|
+
tags?: Tag[];
|
2713
|
+
/**
|
2714
|
+
* The id of the entry, auto-generated from {@link title}/{@link metaId} and {@link exportName} if unspecified.
|
2715
|
+
* If specified, the story in the CSF file _must_ have a matching id set at `parameters.__id`, to be correctly matched.
|
2716
|
+
* Only use this if you need to override the auto-generated id.
|
2717
|
+
*/
|
2718
|
+
__id?: StoryId;
|
2719
|
+
};
|
2720
|
+
/**
|
2721
|
+
* The input for indexing a story entry.
|
2722
|
+
*/
|
2723
|
+
type StoryIndexInput = BaseIndexInput & {
|
2724
|
+
type: 'story';
|
2725
|
+
};
|
2726
|
+
/**
|
2727
|
+
* The input for indexing a docs entry.
|
2728
|
+
*/
|
2729
|
+
type DocsIndexInput = BaseIndexInput & {
|
2730
|
+
type: 'docs';
|
2731
|
+
/** Paths to story files that must be pre-loaded for this docs entry. */
|
2732
|
+
storiesImports?: Path[];
|
2733
|
+
};
|
2734
|
+
type IndexInput = StoryIndexInput | DocsIndexInput;
|
2735
|
+
|
2736
|
+
/**
|
2737
|
+
* ⚠️ This file contains internal WIP types they MUST NOT be exported outside this package for now!
|
2738
|
+
*/
|
2739
|
+
type BuilderName$1 = 'webpack5' | '@storybook/builder-webpack5' | string;
|
2740
|
+
type RendererName = string;
|
2741
|
+
interface CoreConfig {
|
2742
|
+
builder?: BuilderName$1 | {
|
2743
|
+
name: BuilderName$1;
|
2744
|
+
options?: Record<string, any>;
|
2745
|
+
};
|
2746
|
+
renderer?: RendererName;
|
2747
|
+
disableWebpackDefaults?: boolean;
|
2748
|
+
channelOptions?: Partial<Options$1>;
|
2749
|
+
/**
|
2750
|
+
* Disables the generation of project.json, a file containing Storybook metadata
|
2751
|
+
*/
|
2752
|
+
disableProjectJson?: boolean;
|
2753
|
+
/**
|
2754
|
+
* Disables Storybook telemetry
|
2755
|
+
* @see https://storybook.js.org/telemetry
|
2756
|
+
*/
|
2757
|
+
disableTelemetry?: boolean;
|
2758
|
+
/**
|
2759
|
+
* Disables notifications for Storybook updates.
|
2760
|
+
*/
|
2761
|
+
disableWhatsNewNotifications?: boolean;
|
2762
|
+
/**
|
2763
|
+
* Enable crash reports to be sent to Storybook telemetry
|
2764
|
+
* @see https://storybook.js.org/telemetry
|
2765
|
+
*/
|
2766
|
+
enableCrashReports?: boolean;
|
2767
|
+
/**
|
2768
|
+
* enable CORS headings to run document in a "secure context"
|
2769
|
+
* see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements
|
2770
|
+
* This enables these headers in development-mode:
|
2771
|
+
* Cross-Origin-Opener-Policy: same-origin
|
2772
|
+
* Cross-Origin-Embedder-Policy: require-corp
|
2773
|
+
*/
|
2774
|
+
crossOriginIsolated?: boolean;
|
2775
|
+
}
|
2776
|
+
interface DirectoryMapping {
|
2777
|
+
from: string;
|
2778
|
+
to: string;
|
2779
|
+
}
|
2780
|
+
interface Presets {
|
2781
|
+
apply(extension: 'typescript', config: TypescriptOptions, args?: Options): Promise<TypescriptOptions>;
|
2782
|
+
apply(extension: 'framework', config?: {}, args?: any): Promise<Preset>;
|
2783
|
+
apply(extension: 'babel', config?: {}, args?: any): Promise<TransformOptions>;
|
2784
|
+
apply(extension: 'swc', config?: {}, args?: any): Promise<Options$2>;
|
2785
|
+
apply(extension: 'entries', config?: [], args?: any): Promise<unknown>;
|
2786
|
+
apply(extension: 'stories', config?: [], args?: any): Promise<StoriesEntry[]>;
|
2787
|
+
apply(extension: 'managerEntries', config: [], args?: any): Promise<string[]>;
|
2788
|
+
apply(extension: 'refs', config?: [], args?: any): Promise<unknown>;
|
2789
|
+
apply(extension: 'core', config?: {}, args?: any): Promise<CoreConfig>;
|
2790
|
+
apply(extension: 'build', config?: {}, args?: any): Promise<StorybookConfig$1['build']>;
|
2791
|
+
apply<T>(extension: string, config?: T, args?: unknown): Promise<T>;
|
2792
|
+
}
|
2793
|
+
interface LoadedPreset {
|
2794
|
+
name: string;
|
2795
|
+
preset: any;
|
2796
|
+
options: any;
|
2797
|
+
}
|
2798
|
+
interface VersionCheck {
|
2799
|
+
success: boolean;
|
2800
|
+
cached: boolean;
|
2801
|
+
data?: any;
|
2802
|
+
error?: any;
|
2803
|
+
time: number;
|
2804
|
+
}
|
2805
|
+
type PackageJson = PackageJson$1 & Record<string, any>;
|
2806
|
+
interface LoadOptions {
|
2807
|
+
packageJson: PackageJson;
|
2808
|
+
outputDir?: string;
|
2809
|
+
configDir?: string;
|
2810
|
+
ignorePreview?: boolean;
|
2811
|
+
extendServer?: (server: Server) => void;
|
2812
|
+
}
|
2813
|
+
interface CLIOptions {
|
2814
|
+
port?: number;
|
2815
|
+
ignorePreview?: boolean;
|
2816
|
+
previewUrl?: string;
|
2817
|
+
forceBuildPreview?: boolean;
|
2818
|
+
disableTelemetry?: boolean;
|
2819
|
+
enableCrashReports?: boolean;
|
2820
|
+
host?: string;
|
2821
|
+
initialPath?: string;
|
2822
|
+
/**
|
2823
|
+
* @deprecated Use 'staticDirs' Storybook Configuration option instead
|
2824
|
+
*/
|
2825
|
+
staticDir?: string[];
|
2826
|
+
configDir?: string;
|
2827
|
+
https?: boolean;
|
2828
|
+
sslCa?: string[];
|
2829
|
+
sslCert?: string;
|
2830
|
+
sslKey?: string;
|
2831
|
+
smokeTest?: boolean;
|
2832
|
+
managerCache?: boolean;
|
2833
|
+
open?: boolean;
|
2834
|
+
ci?: boolean;
|
2835
|
+
loglevel?: string;
|
2836
|
+
quiet?: boolean;
|
2837
|
+
versionUpdates?: boolean;
|
2838
|
+
docs?: boolean;
|
2839
|
+
test?: boolean;
|
2840
|
+
debugWebpack?: boolean;
|
2841
|
+
webpackStatsJson?: string | boolean;
|
2842
|
+
outputDir?: string;
|
2843
|
+
}
|
2844
|
+
interface BuilderOptions {
|
2845
|
+
configType?: 'DEVELOPMENT' | 'PRODUCTION';
|
2846
|
+
ignorePreview?: boolean;
|
2847
|
+
cache?: FileSystemCache;
|
2848
|
+
configDir: string;
|
2849
|
+
docsMode?: boolean;
|
2850
|
+
features?: StorybookConfig$1['features'];
|
2851
|
+
versionCheck?: VersionCheck;
|
2852
|
+
disableWebpackDefaults?: boolean;
|
2853
|
+
serverChannelUrl?: string;
|
2854
|
+
}
|
2855
|
+
interface StorybookConfigOptions {
|
2856
|
+
presets: Presets;
|
2857
|
+
presetsList?: LoadedPreset[];
|
2858
|
+
}
|
2859
|
+
type Options = LoadOptions & StorybookConfigOptions & CLIOptions & BuilderOptions & {
|
2860
|
+
build?: TestBuildConfig;
|
2861
|
+
};
|
2862
|
+
/**
|
2863
|
+
* Options for TypeScript usage within Storybook.
|
2864
|
+
*/
|
2865
|
+
interface TypescriptOptions {
|
2866
|
+
/**
|
2867
|
+
* Enables type checking within Storybook.
|
2868
|
+
*
|
2869
|
+
* @default `false`
|
2870
|
+
*/
|
2871
|
+
check: boolean;
|
2872
|
+
/**
|
2873
|
+
* Disable parsing typescript files through babel.
|
2874
|
+
*
|
2875
|
+
* @default `false`
|
2876
|
+
*/
|
2877
|
+
skipBabel: boolean;
|
2878
|
+
}
|
2879
|
+
type Preset = string | {
|
2880
|
+
name: string;
|
2881
|
+
options?: any;
|
2882
|
+
};
|
2883
|
+
/**
|
2884
|
+
* An additional script that gets injected into the
|
2885
|
+
* preview or the manager,
|
2886
|
+
*/
|
2887
|
+
type Entry = string;
|
2888
|
+
type CoreCommon_StorybookRefs = Record<string, {
|
2889
|
+
title: string;
|
2890
|
+
url: string;
|
2891
|
+
} | {
|
2892
|
+
disable: boolean;
|
2893
|
+
expanded?: boolean;
|
2894
|
+
}>;
|
2895
|
+
type DocsOptions = {
|
2896
|
+
/**
|
2897
|
+
* What should we call the generated docs entries?
|
2898
|
+
*/
|
2899
|
+
defaultName?: string;
|
2900
|
+
/**
|
2901
|
+
* Should we generate a docs entry per CSF file?
|
2902
|
+
* Set to 'tag' (the default) to generate an entry for every CSF file with the
|
2903
|
+
* 'autodocs' tag.
|
2904
|
+
*/
|
2905
|
+
autodocs?: boolean | 'tag';
|
2906
|
+
/**
|
2907
|
+
* Only show doc entries in the side bar (usually set with the `--docs` CLI flag)
|
2908
|
+
*/
|
2909
|
+
docsMode?: boolean;
|
2910
|
+
};
|
2911
|
+
interface TestBuildFlags {
|
2912
|
+
/**
|
2913
|
+
* The package @storybook/blocks will be excluded from the bundle, even when imported in e.g. the preview.
|
2914
|
+
*/
|
2915
|
+
emptyBlocks?: boolean;
|
2916
|
+
/**
|
2917
|
+
* Disable all addons
|
2918
|
+
*/
|
2919
|
+
removeNonFastAddons?: boolean;
|
2920
|
+
/**
|
2921
|
+
* Filter out .mdx stories entries
|
2922
|
+
*/
|
2923
|
+
removeMDXEntries?: boolean;
|
2924
|
+
/**
|
2925
|
+
* Override autodocs to be disabled
|
2926
|
+
*/
|
2927
|
+
removeAutoDocs?: boolean;
|
2928
|
+
/**
|
2929
|
+
* Override docgen to be disabled.
|
2930
|
+
*/
|
2931
|
+
disableDocgen?: boolean;
|
2932
|
+
/**
|
2933
|
+
* Override sourcemaps generation to be disabled.
|
2934
|
+
*/
|
2935
|
+
disableSourcemaps?: boolean;
|
2936
|
+
/**
|
2937
|
+
* Override tree-shaking (dead code elimination) to be disabled.
|
2938
|
+
*/
|
2939
|
+
disableTreeShaking?: boolean;
|
2940
|
+
/**
|
2941
|
+
* Compile/Optimize with SWC.
|
2942
|
+
*/
|
2943
|
+
optimizeCompilation?: boolean;
|
2944
|
+
}
|
2945
|
+
interface TestBuildConfig {
|
2946
|
+
test?: TestBuildFlags;
|
2947
|
+
}
|
2948
|
+
/**
|
2949
|
+
* The interface for Storybook configuration in `main.ts` files.
|
2950
|
+
*/
|
2951
|
+
interface StorybookConfig$1 {
|
2952
|
+
/**
|
2953
|
+
* Sets the addons you want to use with Storybook.
|
2954
|
+
*
|
2955
|
+
* @example `['@storybook/addon-essentials']` or `[{ name: '@storybook/addon-essentials', options: { backgrounds: false } }]`
|
2956
|
+
*/
|
2957
|
+
addons?: Preset[];
|
2958
|
+
core?: CoreConfig;
|
2959
|
+
/**
|
2960
|
+
* Sets a list of directories of static files to be loaded by Storybook server
|
2961
|
+
*
|
2962
|
+
* @example `['./public']` or `[{from: './public', 'to': '/assets'}]`
|
2963
|
+
*/
|
2964
|
+
staticDirs?: (DirectoryMapping | string)[];
|
2965
|
+
logLevel?: string;
|
2966
|
+
features?: {
|
2967
|
+
/**
|
2968
|
+
* Build stories.json automatically on start/build
|
2969
|
+
*/
|
2970
|
+
buildStoriesJson?: boolean;
|
2971
|
+
/**
|
2972
|
+
* Activate on demand story store
|
2973
|
+
*/
|
2974
|
+
storyStoreV7?: boolean;
|
2975
|
+
/**
|
2976
|
+
* Do not throw errors if using `.mdx` files in SSv7
|
2977
|
+
* (for internal use in sandboxes)
|
2978
|
+
*/
|
2979
|
+
storyStoreV7MdxErrors?: boolean;
|
2980
|
+
/**
|
2981
|
+
* Filter args with a "target" on the type from the render function (EXPERIMENTAL)
|
2982
|
+
*/
|
2983
|
+
argTypeTargetsV7?: boolean;
|
2984
|
+
/**
|
2985
|
+
* Warn when there is a pre-6.0 hierarchy separator ('.' / '|') in the story title.
|
2986
|
+
* Will be removed in 7.0.
|
2987
|
+
*/
|
2988
|
+
warnOnLegacyHierarchySeparator?: boolean;
|
2989
|
+
/**
|
2990
|
+
* Use legacy MDX1, to help smooth migration to 7.0
|
2991
|
+
*/
|
2992
|
+
legacyMdx1?: boolean;
|
2993
|
+
/**
|
2994
|
+
* Apply decorators from preview.js before decorators from addons or frameworks
|
2995
|
+
*/
|
2996
|
+
legacyDecoratorFileOrder?: boolean;
|
2997
|
+
};
|
2998
|
+
build?: TestBuildConfig;
|
2999
|
+
/**
|
3000
|
+
* Tells Storybook where to find stories.
|
3001
|
+
*
|
3002
|
+
* @example `['./src/*.stories.@(j|t)sx?']`
|
3003
|
+
*/
|
3004
|
+
stories: StoriesEntry[];
|
3005
|
+
/**
|
3006
|
+
* Framework, e.g. '@storybook/react-vite', required in v7
|
3007
|
+
*/
|
3008
|
+
framework?: Preset;
|
3009
|
+
/**
|
3010
|
+
* Controls how Storybook handles TypeScript files.
|
3011
|
+
*/
|
3012
|
+
typescript?: Partial<TypescriptOptions>;
|
3013
|
+
/**
|
3014
|
+
* References external Storybooks
|
3015
|
+
*/
|
3016
|
+
refs?: PresetValue<CoreCommon_StorybookRefs>;
|
3017
|
+
/**
|
3018
|
+
* Modify or return babel config.
|
3019
|
+
*/
|
3020
|
+
babel?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
|
3021
|
+
/**
|
3022
|
+
* Modify or return swc config.
|
3023
|
+
*/
|
3024
|
+
swc?: (config: Options$2, options: Options) => Options$2 | Promise<Options$2>;
|
3025
|
+
/**
|
3026
|
+
* Modify or return env config.
|
3027
|
+
*/
|
3028
|
+
env?: PresetValue<Record<string, string>>;
|
3029
|
+
/**
|
3030
|
+
* Modify or return babel config.
|
3031
|
+
*/
|
3032
|
+
babelDefault?: (config: TransformOptions, options: Options) => TransformOptions | Promise<TransformOptions>;
|
3033
|
+
/**
|
3034
|
+
* Add additional scripts to run in the preview a la `.storybook/preview.js`
|
3035
|
+
*
|
3036
|
+
* @deprecated use `previewAnnotations` or `/preview.js` file instead
|
3037
|
+
*/
|
3038
|
+
config?: PresetValue<Entry[]>;
|
3039
|
+
/**
|
3040
|
+
* Add additional scripts to run in the preview a la `.storybook/preview.js`
|
3041
|
+
*/
|
3042
|
+
previewAnnotations?: PresetValue<Entry[]>;
|
3043
|
+
/**
|
3044
|
+
* Process CSF files for the story index.
|
3045
|
+
* @deprecated use {@link experimental_indexers} instead
|
3046
|
+
*/
|
3047
|
+
storyIndexers?: PresetValue<StoryIndexer[]>;
|
3048
|
+
/**
|
3049
|
+
* Process CSF files for the story index.
|
3050
|
+
*/
|
3051
|
+
experimental_indexers?: PresetValue<Indexer[]>;
|
3052
|
+
/**
|
3053
|
+
* Docs related features in index generation
|
3054
|
+
*/
|
3055
|
+
docs?: DocsOptions;
|
3056
|
+
/**
|
3057
|
+
* Programmatically modify the preview head/body HTML.
|
3058
|
+
* The previewHead and previewBody functions accept a string,
|
3059
|
+
* which is the existing head/body, and return a modified string.
|
3060
|
+
*/
|
3061
|
+
previewHead?: PresetValue<string>;
|
3062
|
+
previewBody?: PresetValue<string>;
|
3063
|
+
/**
|
3064
|
+
* Programmatically override the preview's main page template.
|
3065
|
+
* This should return a reference to a file containing an `.ejs` template
|
3066
|
+
* that will be interpolated with environment variables.
|
3067
|
+
*
|
3068
|
+
* @example '.storybook/index.ejs'
|
3069
|
+
*/
|
3070
|
+
previewMainTemplate?: string;
|
3071
|
+
/**
|
3072
|
+
* Programmatically modify the preview head/body HTML.
|
3073
|
+
* The managerHead function accept a string,
|
3074
|
+
* which is the existing head content, and return a modified string.
|
3075
|
+
*/
|
3076
|
+
managerHead?: PresetValue<string>;
|
3077
|
+
}
|
3078
|
+
type PresetValue<T> = T | ((config: T, options: Options) => T | Promise<T>);
|
3079
|
+
type PresetProperty<K, TStorybookConfig = StorybookConfig$1> = TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | PresetPropertyFn<K, TStorybookConfig>;
|
3080
|
+
type PresetPropertyFn<K, TStorybookConfig = StorybookConfig$1, TOptions = {}> = (config: TStorybookConfig[K extends keyof TStorybookConfig ? K : never], options: Options & TOptions) => TStorybookConfig[K extends keyof TStorybookConfig ? K : never] | Promise<TStorybookConfig[K extends keyof TStorybookConfig ? K : never]>;
|
3081
|
+
type Path = string;
|
3082
|
+
|
3083
|
+
type FrameworkName = '@storybook/preact-vite';
|
3084
|
+
type BuilderName = '@storybook/builder-vite';
|
3085
|
+
type FrameworkOptions = {
|
3086
|
+
builder?: BuilderOptions$1;
|
3087
|
+
};
|
3088
|
+
type StorybookConfigFramework = {
|
3089
|
+
framework: FrameworkName | {
|
3090
|
+
name: FrameworkName;
|
3091
|
+
options: FrameworkOptions;
|
3092
|
+
};
|
3093
|
+
core?: StorybookConfig$1['core'] & {
|
3094
|
+
builder?: BuilderName | {
|
3095
|
+
name: BuilderName;
|
3096
|
+
options: BuilderOptions$1;
|
3097
|
+
};
|
3098
|
+
};
|
3099
|
+
};
|
3100
|
+
/**
|
3101
|
+
* The interface for Storybook configuration in `main.ts` files.
|
3102
|
+
*/
|
3103
|
+
type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigVite | keyof StorybookConfigFramework> & StorybookConfigVite & StorybookConfigFramework;
|
3104
|
+
|
3105
|
+
export { FrameworkOptions as F, PresetProperty as P, StorybookConfig as S };
|