storybook 9.1.0-alpha.1 → 9.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/index.cjs +50 -50
- package/dist/bin/index.js +50 -50
- package/dist/builder-manager/index.cjs +379 -378
- package/dist/builder-manager/index.d.ts +567 -2
- package/dist/builder-manager/index.js +280 -279
- package/dist/cli/bin/index.cjs +1 -1
- package/dist/cli/bin/index.js +1 -1
- package/dist/common/index.cjs +714 -707
- package/dist/common/index.js +703 -696
- package/dist/components/index.cjs +1899 -1895
- package/dist/components/index.js +1343 -1339
- package/dist/manager/globals-runtime.js +5191 -5144
- package/dist/manager-api/index.cjs +1 -1
- package/dist/manager-api/index.js +1 -1
- package/dist/measure/index.cjs +64 -64
- package/dist/measure/index.js +65 -65
- package/dist/measure/preview.cjs +59 -59
- package/dist/measure/preview.js +53 -53
- package/dist/preview/runtime.js +4913 -4870
- package/dist/telemetry/index.cjs +1477 -1288
- package/dist/telemetry/index.js +1503 -1314
- package/dist/test/index.cjs +4437 -4394
- package/dist/test/index.js +3776 -3733
- package/package.json +1 -1
|
@@ -1,11 +1,576 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
|
-
import { BuildOptions } from 'esbuild';
|
|
2
|
+
import { BuildOptions, Plugin as Plugin$1, Loader, Metafile } from 'esbuild';
|
|
3
3
|
import { Builder, Builder_WithRequiredProperty, BuilderStats } from 'storybook/internal/types';
|
|
4
4
|
|
|
5
5
|
type ManagerBuilder = Builder<Builder_WithRequiredProperty<BuildOptions, 'outdir'> & {
|
|
6
6
|
entryPoints: string[];
|
|
7
7
|
}, BuilderStats>;
|
|
8
8
|
|
|
9
|
+
interface SourceMap$1 {
|
|
10
|
+
file: string;
|
|
11
|
+
mappings: string;
|
|
12
|
+
names: string[];
|
|
13
|
+
sources: string[];
|
|
14
|
+
sourcesContent: (string | null)[];
|
|
15
|
+
version: number;
|
|
16
|
+
toString(): string;
|
|
17
|
+
toUrl(): string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type HasModuleSideEffects = (id: string, external: boolean) => boolean;
|
|
21
|
+
|
|
22
|
+
type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
|
|
23
|
+
|
|
24
|
+
interface NormalizedTreeshakingOptions {
|
|
25
|
+
annotations: boolean;
|
|
26
|
+
correctVarValueBeforeDeclaration: boolean;
|
|
27
|
+
manualPureFunctions: readonly string[];
|
|
28
|
+
moduleSideEffects: HasModuleSideEffects;
|
|
29
|
+
propertyReadSideEffects: boolean | 'always';
|
|
30
|
+
tryCatchDeoptimization: boolean;
|
|
31
|
+
unknownGlobalSideEffects: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface TreeshakingOptions
|
|
35
|
+
extends Partial<Omit<NormalizedTreeshakingOptions, 'moduleSideEffects'>> {
|
|
36
|
+
moduleSideEffects?: ModuleSideEffectsOption;
|
|
37
|
+
preset?: TreeshakingPreset;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type InputOption = string | string[] | { [entryAlias: string]: string };
|
|
41
|
+
|
|
42
|
+
type ModuleSideEffectsOption = boolean | 'no-external' | string[] | HasModuleSideEffects;
|
|
43
|
+
|
|
44
|
+
interface RawSourceMap {
|
|
45
|
+
version: number;
|
|
46
|
+
sources: string[];
|
|
47
|
+
names: string[];
|
|
48
|
+
sourceRoot?: string;
|
|
49
|
+
sourcesContent?: string[];
|
|
50
|
+
mappings: string;
|
|
51
|
+
file: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
55
|
+
|
|
56
|
+
/** Mark some properties as required, leaving others unchanged */
|
|
57
|
+
declare type MarkRequired<T, RK extends keyof T> = Exclude<T, RK> & Required<Pick<T, RK>>;
|
|
58
|
+
|
|
59
|
+
type Logger = ReturnType<typeof createLogger>;
|
|
60
|
+
declare const createLogger: (name?: string) => {
|
|
61
|
+
setName(_name: string): void;
|
|
62
|
+
success(label: string, ...args: any[]): void;
|
|
63
|
+
info(label: string, ...args: any[]): void;
|
|
64
|
+
error(label: string, ...args: any[]): void;
|
|
65
|
+
warn(label: string, ...args: any[]): void;
|
|
66
|
+
log(label: string, type: 'info' | 'success' | 'error' | 'warn', ...data: unknown[]): void;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
type ChunkInfo = {
|
|
70
|
+
type: 'chunk';
|
|
71
|
+
code: string;
|
|
72
|
+
map?: string | RawSourceMap | null;
|
|
73
|
+
path: string;
|
|
74
|
+
/**
|
|
75
|
+
* Sets the file mode
|
|
76
|
+
*/
|
|
77
|
+
mode?: number;
|
|
78
|
+
entryPoint?: string;
|
|
79
|
+
exports?: string[];
|
|
80
|
+
imports?: Metafile['outputs'][string]['imports'];
|
|
81
|
+
};
|
|
82
|
+
type RenderChunk = (this: PluginContext, code: string, chunkInfo: ChunkInfo) => MaybePromise<{
|
|
83
|
+
code: string;
|
|
84
|
+
map?: object | string | SourceMap$1 | null;
|
|
85
|
+
} | undefined | null | void>;
|
|
86
|
+
type BuildStart = (this: PluginContext) => MaybePromise<void>;
|
|
87
|
+
type BuildEnd = (this: PluginContext, ctx: {
|
|
88
|
+
writtenFiles: WrittenFile[];
|
|
89
|
+
}) => MaybePromise<void>;
|
|
90
|
+
type ModifyEsbuildOptions = (this: PluginContext, options: BuildOptions) => void;
|
|
91
|
+
type Plugin = {
|
|
92
|
+
name: string;
|
|
93
|
+
esbuildOptions?: ModifyEsbuildOptions;
|
|
94
|
+
buildStart?: BuildStart;
|
|
95
|
+
renderChunk?: RenderChunk;
|
|
96
|
+
buildEnd?: BuildEnd;
|
|
97
|
+
};
|
|
98
|
+
type PluginContext = {
|
|
99
|
+
format: Format;
|
|
100
|
+
splitting?: boolean;
|
|
101
|
+
options: NormalizedOptions;
|
|
102
|
+
logger: Logger;
|
|
103
|
+
};
|
|
104
|
+
type WrittenFile = {
|
|
105
|
+
readonly name: string;
|
|
106
|
+
readonly size: number;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
type TreeshakingStrategy = boolean | TreeshakingOptions | TreeshakingPreset;
|
|
110
|
+
|
|
111
|
+
declare type GeneratedColumn = number;
|
|
112
|
+
declare type SourcesIndex = number;
|
|
113
|
+
declare type SourceLine = number;
|
|
114
|
+
declare type SourceColumn = number;
|
|
115
|
+
declare type NamesIndex = number;
|
|
116
|
+
declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];
|
|
117
|
+
|
|
118
|
+
declare class TraceMap implements SourceMap {
|
|
119
|
+
version: SourceMapV3['version'];
|
|
120
|
+
file: SourceMapV3['file'];
|
|
121
|
+
names: SourceMapV3['names'];
|
|
122
|
+
sourceRoot: SourceMapV3['sourceRoot'];
|
|
123
|
+
sources: SourceMapV3['sources'];
|
|
124
|
+
sourcesContent: SourceMapV3['sourcesContent'];
|
|
125
|
+
resolvedSources: string[];
|
|
126
|
+
private _encoded;
|
|
127
|
+
private _decoded;
|
|
128
|
+
private _decodedMemo;
|
|
129
|
+
private _bySources;
|
|
130
|
+
private _bySourceMemos;
|
|
131
|
+
constructor(map: SourceMapInput, mapUrl?: string | null);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface SourceMapV3 {
|
|
135
|
+
file?: string | null;
|
|
136
|
+
names: string[];
|
|
137
|
+
sourceRoot?: string;
|
|
138
|
+
sources: (string | null)[];
|
|
139
|
+
sourcesContent?: (string | null)[];
|
|
140
|
+
version: 3;
|
|
141
|
+
}
|
|
142
|
+
interface EncodedSourceMap extends SourceMapV3 {
|
|
143
|
+
mappings: string;
|
|
144
|
+
}
|
|
145
|
+
interface DecodedSourceMap extends SourceMapV3 {
|
|
146
|
+
mappings: SourceMapSegment[][];
|
|
147
|
+
}
|
|
148
|
+
interface Section {
|
|
149
|
+
offset: {
|
|
150
|
+
line: number;
|
|
151
|
+
column: number;
|
|
152
|
+
};
|
|
153
|
+
map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap;
|
|
154
|
+
}
|
|
155
|
+
interface SectionedSourceMap {
|
|
156
|
+
file?: string | null;
|
|
157
|
+
sections: Section[];
|
|
158
|
+
version: 3;
|
|
159
|
+
}
|
|
160
|
+
declare type SourceMapInput = string | Ro<EncodedSourceMap> | Ro<DecodedSourceMap> | TraceMap;
|
|
161
|
+
declare type SectionedSourceMapInput = SourceMapInput | Ro<SectionedSourceMap>;
|
|
162
|
+
declare abstract class SourceMap {
|
|
163
|
+
version: SourceMapV3['version'];
|
|
164
|
+
file: SourceMapV3['file'];
|
|
165
|
+
names: SourceMapV3['names'];
|
|
166
|
+
sourceRoot: SourceMapV3['sourceRoot'];
|
|
167
|
+
sources: SourceMapV3['sources'];
|
|
168
|
+
sourcesContent: SourceMapV3['sourcesContent'];
|
|
169
|
+
resolvedSources: SourceMapV3['sources'];
|
|
170
|
+
}
|
|
171
|
+
declare type Ro<T> = T extends Array<infer V> ? V[] | Readonly<V[]> | RoArray<V> | Readonly<RoArray<V>> : T extends object ? T | Readonly<T> | RoObject<T> | Readonly<RoObject<T>> : T;
|
|
172
|
+
declare type RoArray<T> = Ro<T>[];
|
|
173
|
+
declare type RoObject<T> = {
|
|
174
|
+
[K in keyof T]: T[K] | Ro<T[K]>;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
/// <reference lib="es2015" />
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
type ECMA = 5 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020;
|
|
181
|
+
|
|
182
|
+
interface ParseOptions {
|
|
183
|
+
bare_returns?: boolean;
|
|
184
|
+
/** @deprecated legacy option. Currently, all supported EcmaScript is valid to parse. */
|
|
185
|
+
ecma?: ECMA;
|
|
186
|
+
html5_comments?: boolean;
|
|
187
|
+
shebang?: boolean;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
interface CompressOptions {
|
|
191
|
+
arguments?: boolean;
|
|
192
|
+
arrows?: boolean;
|
|
193
|
+
booleans_as_integers?: boolean;
|
|
194
|
+
booleans?: boolean;
|
|
195
|
+
collapse_vars?: boolean;
|
|
196
|
+
comparisons?: boolean;
|
|
197
|
+
computed_props?: boolean;
|
|
198
|
+
conditionals?: boolean;
|
|
199
|
+
dead_code?: boolean;
|
|
200
|
+
defaults?: boolean;
|
|
201
|
+
directives?: boolean;
|
|
202
|
+
drop_console?: boolean;
|
|
203
|
+
drop_debugger?: boolean;
|
|
204
|
+
ecma?: ECMA;
|
|
205
|
+
evaluate?: boolean;
|
|
206
|
+
expression?: boolean;
|
|
207
|
+
global_defs?: object;
|
|
208
|
+
hoist_funs?: boolean;
|
|
209
|
+
hoist_props?: boolean;
|
|
210
|
+
hoist_vars?: boolean;
|
|
211
|
+
ie8?: boolean;
|
|
212
|
+
if_return?: boolean;
|
|
213
|
+
inline?: boolean | InlineFunctions;
|
|
214
|
+
join_vars?: boolean;
|
|
215
|
+
keep_classnames?: boolean | RegExp;
|
|
216
|
+
keep_fargs?: boolean;
|
|
217
|
+
keep_fnames?: boolean | RegExp;
|
|
218
|
+
keep_infinity?: boolean;
|
|
219
|
+
loops?: boolean;
|
|
220
|
+
module?: boolean;
|
|
221
|
+
negate_iife?: boolean;
|
|
222
|
+
passes?: number;
|
|
223
|
+
properties?: boolean;
|
|
224
|
+
pure_funcs?: string[];
|
|
225
|
+
pure_getters?: boolean | 'strict';
|
|
226
|
+
reduce_funcs?: boolean;
|
|
227
|
+
reduce_vars?: boolean;
|
|
228
|
+
sequences?: boolean | number;
|
|
229
|
+
side_effects?: boolean;
|
|
230
|
+
switches?: boolean;
|
|
231
|
+
toplevel?: boolean;
|
|
232
|
+
top_retain?: null | string | string[] | RegExp;
|
|
233
|
+
typeofs?: boolean;
|
|
234
|
+
unsafe_arrows?: boolean;
|
|
235
|
+
unsafe?: boolean;
|
|
236
|
+
unsafe_comps?: boolean;
|
|
237
|
+
unsafe_Function?: boolean;
|
|
238
|
+
unsafe_math?: boolean;
|
|
239
|
+
unsafe_symbols?: boolean;
|
|
240
|
+
unsafe_methods?: boolean;
|
|
241
|
+
unsafe_proto?: boolean;
|
|
242
|
+
unsafe_regexp?: boolean;
|
|
243
|
+
unsafe_undefined?: boolean;
|
|
244
|
+
unused?: boolean;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
declare enum InlineFunctions {
|
|
248
|
+
Disabled = 0,
|
|
249
|
+
SimpleFunctions = 1,
|
|
250
|
+
WithArguments = 2,
|
|
251
|
+
WithArgumentsAndVariables = 3
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
interface MangleOptions {
|
|
255
|
+
eval?: boolean;
|
|
256
|
+
keep_classnames?: boolean | RegExp;
|
|
257
|
+
keep_fnames?: boolean | RegExp;
|
|
258
|
+
module?: boolean;
|
|
259
|
+
nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler;
|
|
260
|
+
properties?: boolean | ManglePropertiesOptions;
|
|
261
|
+
reserved?: string[];
|
|
262
|
+
safari10?: boolean;
|
|
263
|
+
toplevel?: boolean;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* An identifier mangler for which the output is invariant with respect to the source code.
|
|
268
|
+
*/
|
|
269
|
+
interface SimpleIdentifierMangler {
|
|
270
|
+
/**
|
|
271
|
+
* Obtains the nth most favored (usually shortest) identifier to rename a variable to.
|
|
272
|
+
* The mangler will increment n and retry until the return value is not in use in scope, and is not a reserved word.
|
|
273
|
+
* This function is expected to be stable; Evaluating get(n) === get(n) should always return true.
|
|
274
|
+
* @param n The ordinal of the identifier.
|
|
275
|
+
*/
|
|
276
|
+
get(n: number): string;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* An identifier mangler that leverages character frequency analysis to determine identifier precedence.
|
|
281
|
+
*/
|
|
282
|
+
interface WeightedIdentifierMangler extends SimpleIdentifierMangler {
|
|
283
|
+
/**
|
|
284
|
+
* Modifies the internal weighting of the input characters by the specified delta.
|
|
285
|
+
* Will be invoked on the entire printed AST, and then deduct mangleable identifiers.
|
|
286
|
+
* @param chars The characters to modify the weighting of.
|
|
287
|
+
* @param delta The numeric weight to add to the characters.
|
|
288
|
+
*/
|
|
289
|
+
consider(chars: string, delta: number): number;
|
|
290
|
+
/**
|
|
291
|
+
* Resets character weights.
|
|
292
|
+
*/
|
|
293
|
+
reset(): void;
|
|
294
|
+
/**
|
|
295
|
+
* Sorts identifiers by character frequency, in preparation for calls to get(n).
|
|
296
|
+
*/
|
|
297
|
+
sort(): void;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
interface ManglePropertiesOptions {
|
|
301
|
+
builtins?: boolean;
|
|
302
|
+
debug?: boolean;
|
|
303
|
+
keep_quoted?: boolean | 'strict';
|
|
304
|
+
nth_identifier?: SimpleIdentifierMangler | WeightedIdentifierMangler;
|
|
305
|
+
regex?: RegExp | string;
|
|
306
|
+
reserved?: string[];
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
interface FormatOptions {
|
|
310
|
+
ascii_only?: boolean;
|
|
311
|
+
/** @deprecated Not implemented anymore */
|
|
312
|
+
beautify?: boolean;
|
|
313
|
+
braces?: boolean;
|
|
314
|
+
comments?: boolean | 'all' | 'some' | RegExp | ( (node: any, comment: {
|
|
315
|
+
value: string,
|
|
316
|
+
type: 'comment1' | 'comment2' | 'comment3' | 'comment4',
|
|
317
|
+
pos: number,
|
|
318
|
+
line: number,
|
|
319
|
+
col: number,
|
|
320
|
+
}) => boolean );
|
|
321
|
+
ecma?: ECMA;
|
|
322
|
+
ie8?: boolean;
|
|
323
|
+
keep_numbers?: boolean;
|
|
324
|
+
indent_level?: number;
|
|
325
|
+
indent_start?: number;
|
|
326
|
+
inline_script?: boolean;
|
|
327
|
+
keep_quoted_props?: boolean;
|
|
328
|
+
max_line_len?: number | false;
|
|
329
|
+
preamble?: string;
|
|
330
|
+
preserve_annotations?: boolean;
|
|
331
|
+
quote_keys?: boolean;
|
|
332
|
+
quote_style?: OutputQuoteStyle;
|
|
333
|
+
safari10?: boolean;
|
|
334
|
+
semicolons?: boolean;
|
|
335
|
+
shebang?: boolean;
|
|
336
|
+
shorthand?: boolean;
|
|
337
|
+
source_map?: SourceMapOptions;
|
|
338
|
+
webkit?: boolean;
|
|
339
|
+
width?: number;
|
|
340
|
+
wrap_iife?: boolean;
|
|
341
|
+
wrap_func_args?: boolean;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare enum OutputQuoteStyle {
|
|
345
|
+
PreferDouble = 0,
|
|
346
|
+
AlwaysSingle = 1,
|
|
347
|
+
AlwaysDouble = 2,
|
|
348
|
+
AlwaysOriginal = 3
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
interface MinifyOptions {
|
|
352
|
+
compress?: boolean | CompressOptions;
|
|
353
|
+
ecma?: ECMA;
|
|
354
|
+
enclose?: boolean | string;
|
|
355
|
+
ie8?: boolean;
|
|
356
|
+
keep_classnames?: boolean | RegExp;
|
|
357
|
+
keep_fnames?: boolean | RegExp;
|
|
358
|
+
mangle?: boolean | MangleOptions;
|
|
359
|
+
module?: boolean;
|
|
360
|
+
nameCache?: object;
|
|
361
|
+
format?: FormatOptions;
|
|
362
|
+
/** @deprecated */
|
|
363
|
+
output?: FormatOptions;
|
|
364
|
+
parse?: ParseOptions;
|
|
365
|
+
safari10?: boolean;
|
|
366
|
+
sourceMap?: boolean | SourceMapOptions;
|
|
367
|
+
toplevel?: boolean;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
interface SourceMapOptions {
|
|
371
|
+
/** Source map object, 'inline' or source map file content */
|
|
372
|
+
content?: SectionedSourceMapInput | string;
|
|
373
|
+
includeSources?: boolean;
|
|
374
|
+
filename?: string;
|
|
375
|
+
root?: string;
|
|
376
|
+
url?: string | 'inline';
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
type Format = 'cjs' | 'esm' | 'iife';
|
|
380
|
+
type ContextForOutPathGeneration = {
|
|
381
|
+
options: NormalizedOptions;
|
|
382
|
+
format: Format;
|
|
383
|
+
/** "type" field in project's package.json */
|
|
384
|
+
pkgType?: string;
|
|
385
|
+
};
|
|
386
|
+
type OutExtensionObject = {
|
|
387
|
+
js?: string;
|
|
388
|
+
};
|
|
389
|
+
type OutExtensionFactory = (ctx: ContextForOutPathGeneration) => OutExtensionObject;
|
|
390
|
+
type DtsConfig = {
|
|
391
|
+
entry?: InputOption;
|
|
392
|
+
/** Resolve external types used in dts files from node_modules */
|
|
393
|
+
resolve?: boolean | (string | RegExp)[];
|
|
394
|
+
/** Emit declaration files only */
|
|
395
|
+
only?: boolean;
|
|
396
|
+
/** Insert at the top of each output .d.ts file */
|
|
397
|
+
banner?: string;
|
|
398
|
+
/** Insert at the bottom */
|
|
399
|
+
footer?: string;
|
|
400
|
+
/**
|
|
401
|
+
* Overrides `compilerOptions`
|
|
402
|
+
* This option takes higher priority than `compilerOptions` in tsconfig.json
|
|
403
|
+
*/
|
|
404
|
+
compilerOptions?: any;
|
|
405
|
+
};
|
|
406
|
+
type BannerOrFooter = {
|
|
407
|
+
js?: string;
|
|
408
|
+
css?: string;
|
|
409
|
+
} | ((ctx: {
|
|
410
|
+
format: Format;
|
|
411
|
+
}) => {
|
|
412
|
+
js?: string;
|
|
413
|
+
css?: string;
|
|
414
|
+
} | undefined);
|
|
415
|
+
type BrowserTarget = 'chrome' | 'deno' | 'edge' | 'firefox' | 'hermes' | 'ie' | 'ios' | 'node' | 'opera' | 'rhino' | 'safari';
|
|
416
|
+
type BrowserTargetWithVersion = `${BrowserTarget}${number}` | `${BrowserTarget}${number}.${number}` | `${BrowserTarget}${number}.${number}.${number}`;
|
|
417
|
+
type EsTarget = 'es3' | 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'esnext';
|
|
418
|
+
type Target = BrowserTarget | BrowserTargetWithVersion | EsTarget;
|
|
419
|
+
type Entry = string[] | Record<string, string>;
|
|
420
|
+
/**
|
|
421
|
+
* The options available in tsup.config.ts
|
|
422
|
+
* Not all of them are available from CLI flags
|
|
423
|
+
*/
|
|
424
|
+
type Options = {
|
|
425
|
+
/** Optional config name to show in CLI output */
|
|
426
|
+
name?: string;
|
|
427
|
+
/**
|
|
428
|
+
* @deprecated Use `entry` instead
|
|
429
|
+
*/
|
|
430
|
+
entryPoints?: Entry;
|
|
431
|
+
entry?: Entry;
|
|
432
|
+
/**
|
|
433
|
+
* Output different formats to different folder instead of using different extensions
|
|
434
|
+
*/
|
|
435
|
+
legacyOutput?: boolean;
|
|
436
|
+
/**
|
|
437
|
+
* Compile target
|
|
438
|
+
*
|
|
439
|
+
* default to `node14`
|
|
440
|
+
*/
|
|
441
|
+
target?: Target | Target[];
|
|
442
|
+
minify?: boolean | 'terser';
|
|
443
|
+
terserOptions?: MinifyOptions;
|
|
444
|
+
minifyWhitespace?: boolean;
|
|
445
|
+
minifyIdentifiers?: boolean;
|
|
446
|
+
minifySyntax?: boolean;
|
|
447
|
+
keepNames?: boolean;
|
|
448
|
+
watch?: boolean | string | (string | boolean)[];
|
|
449
|
+
ignoreWatch?: string[] | string;
|
|
450
|
+
onSuccess?: string | (() => Promise<void | undefined | (() => void | Promise<void>)>);
|
|
451
|
+
jsxFactory?: string;
|
|
452
|
+
jsxFragment?: string;
|
|
453
|
+
outDir?: string;
|
|
454
|
+
outExtension?: OutExtensionFactory;
|
|
455
|
+
format?: Format[] | string;
|
|
456
|
+
globalName?: string;
|
|
457
|
+
env?: {
|
|
458
|
+
[k: string]: string;
|
|
459
|
+
};
|
|
460
|
+
define?: {
|
|
461
|
+
[k: string]: string;
|
|
462
|
+
};
|
|
463
|
+
dts?: boolean | string | DtsConfig;
|
|
464
|
+
sourcemap?: boolean | 'inline';
|
|
465
|
+
/** Always bundle modules matching given patterns */
|
|
466
|
+
noExternal?: (string | RegExp)[];
|
|
467
|
+
/** Don't bundle these modules */
|
|
468
|
+
external?: (string | RegExp)[];
|
|
469
|
+
/**
|
|
470
|
+
* Replace `process.env.NODE_ENV` with `production` or `development`
|
|
471
|
+
* `production` when the bundled is minified, `development` otherwise
|
|
472
|
+
*/
|
|
473
|
+
replaceNodeEnv?: boolean;
|
|
474
|
+
/**
|
|
475
|
+
* Code splitting
|
|
476
|
+
* Default to `true`
|
|
477
|
+
* You may want to disable code splitting sometimes: [`#255`](https://github.com/egoist/tsup/issues/255)
|
|
478
|
+
*/
|
|
479
|
+
splitting?: boolean;
|
|
480
|
+
/**
|
|
481
|
+
* Clean output directory before each build
|
|
482
|
+
*/
|
|
483
|
+
clean?: boolean | string[];
|
|
484
|
+
esbuildPlugins?: Plugin$1[];
|
|
485
|
+
esbuildOptions?: (options: BuildOptions, context: {
|
|
486
|
+
format: Format;
|
|
487
|
+
}) => void;
|
|
488
|
+
/**
|
|
489
|
+
* Suppress non-error logs (excluding "onSuccess" process output)
|
|
490
|
+
*/
|
|
491
|
+
silent?: boolean;
|
|
492
|
+
/**
|
|
493
|
+
* Skip node_modules bundling
|
|
494
|
+
* Will still bundle modules matching the `noExternal` option
|
|
495
|
+
*/
|
|
496
|
+
skipNodeModulesBundle?: boolean;
|
|
497
|
+
/**
|
|
498
|
+
* @see https://esbuild.github.io/api/#pure
|
|
499
|
+
*/
|
|
500
|
+
pure?: string | string[];
|
|
501
|
+
/**
|
|
502
|
+
* Disable bundling, default to true
|
|
503
|
+
*/
|
|
504
|
+
bundle?: boolean;
|
|
505
|
+
/**
|
|
506
|
+
* This option allows you to automatically replace a global variable with an import from another file.
|
|
507
|
+
* @see https://esbuild.github.io/api/#inject
|
|
508
|
+
*/
|
|
509
|
+
inject?: string[];
|
|
510
|
+
/**
|
|
511
|
+
* Emit esbuild metafile
|
|
512
|
+
* @see https://esbuild.github.io/api/#metafile
|
|
513
|
+
*/
|
|
514
|
+
metafile?: boolean;
|
|
515
|
+
footer?: BannerOrFooter;
|
|
516
|
+
banner?: BannerOrFooter;
|
|
517
|
+
/**
|
|
518
|
+
* Target platform
|
|
519
|
+
* @default `node`
|
|
520
|
+
*/
|
|
521
|
+
platform?: 'node' | 'browser' | 'neutral';
|
|
522
|
+
/**
|
|
523
|
+
* Esbuild loader option
|
|
524
|
+
*/
|
|
525
|
+
loader?: Record<string, Loader>;
|
|
526
|
+
/**
|
|
527
|
+
* Disable config file with `false`
|
|
528
|
+
* Or pass a custom config filename
|
|
529
|
+
*/
|
|
530
|
+
config?: boolean | string;
|
|
531
|
+
/**
|
|
532
|
+
* Use a custom tsconfig
|
|
533
|
+
*/
|
|
534
|
+
tsconfig?: string;
|
|
535
|
+
/**
|
|
536
|
+
* Inject CSS as style tags to document head
|
|
537
|
+
* @default {false}
|
|
538
|
+
*/
|
|
539
|
+
injectStyle?: boolean | ((css: string, fileId: string) => string);
|
|
540
|
+
/**
|
|
541
|
+
* Inject cjs and esm shims if needed
|
|
542
|
+
* @default false
|
|
543
|
+
*/
|
|
544
|
+
shims?: boolean;
|
|
545
|
+
/**
|
|
546
|
+
* TSUP plugins
|
|
547
|
+
* @experimental
|
|
548
|
+
* @alpha
|
|
549
|
+
*/
|
|
550
|
+
plugins?: Plugin[];
|
|
551
|
+
/**
|
|
552
|
+
* By default esbuild already does treeshaking
|
|
553
|
+
*
|
|
554
|
+
* But this option allow you to perform additional treeshaking with Rollup
|
|
555
|
+
*
|
|
556
|
+
* This can result in smaller bundle size
|
|
557
|
+
*/
|
|
558
|
+
treeshake?: TreeshakingStrategy;
|
|
559
|
+
/**
|
|
560
|
+
* Copy the files inside `publicDir` to output directory
|
|
561
|
+
*/
|
|
562
|
+
publicDir?: string | boolean;
|
|
563
|
+
};
|
|
564
|
+
type NormalizedOptions = Omit<MarkRequired<Options, 'entry' | 'outDir'>, 'dts' | 'format'> & {
|
|
565
|
+
dts?: DtsConfig;
|
|
566
|
+
tsconfigResolvePaths: Record<string, string[]>;
|
|
567
|
+
tsconfigDecoratorMetadata?: boolean;
|
|
568
|
+
format: Format[];
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
declare const BROWSER_TARGETS: Options['target'];
|
|
572
|
+
declare const NODE_TARGET: Options['target'];
|
|
573
|
+
|
|
9
574
|
declare const getConfig: ManagerBuilder['getConfig'];
|
|
10
575
|
declare const executor: {
|
|
11
576
|
get: () => Promise<typeof esbuild.build>;
|
|
@@ -16,4 +581,4 @@ declare const build: ManagerBuilder['build'];
|
|
|
16
581
|
declare const corePresets: ManagerBuilder['corePresets'];
|
|
17
582
|
declare const overridePresets: ManagerBuilder['overridePresets'];
|
|
18
583
|
|
|
19
|
-
export { bail, build, corePresets, executor, getConfig, overridePresets, start };
|
|
584
|
+
export { BROWSER_TARGETS, NODE_TARGET, bail, build, corePresets, executor, getConfig, overridePresets, start };
|