kirbyup 0.1.0

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.
@@ -0,0 +1,812 @@
1
+ import { MarkRequired } from 'ts-essentials';
2
+
3
+ interface RollupError extends RollupLogProps {
4
+ parserError?: Error;
5
+ stack?: string;
6
+ watchFiles?: string[];
7
+ }
8
+
9
+ interface RollupWarning extends RollupLogProps {
10
+ chunkName?: string;
11
+ cycle?: string[];
12
+ exportName?: string;
13
+ exporter?: string;
14
+ guess?: string;
15
+ importer?: string;
16
+ missing?: string;
17
+ modules?: string[];
18
+ names?: string[];
19
+ reexporter?: string;
20
+ source?: string;
21
+ sources?: string[];
22
+ }
23
+
24
+ interface RollupLogProps {
25
+ code?: string;
26
+ frame?: string;
27
+ hook?: string;
28
+ id?: string;
29
+ loc?: {
30
+ column: number;
31
+ file?: string;
32
+ line: number;
33
+ };
34
+ message: string;
35
+ name?: string;
36
+ plugin?: string;
37
+ pluginCode?: string;
38
+ pos?: number;
39
+ url?: string;
40
+ }
41
+
42
+ type SourceMapSegment =
43
+ | [number]
44
+ | [number, number, number, number]
45
+ | [number, number, number, number, number];
46
+
47
+ interface ExistingDecodedSourceMap {
48
+ file?: string;
49
+ mappings: SourceMapSegment[][];
50
+ names: string[];
51
+ sourceRoot?: string;
52
+ sources: string[];
53
+ sourcesContent?: string[];
54
+ version: number;
55
+ }
56
+
57
+ interface ExistingRawSourceMap {
58
+ file?: string;
59
+ mappings: string;
60
+ names: string[];
61
+ sourceRoot?: string;
62
+ sources: string[];
63
+ sourcesContent?: string[];
64
+ version: number;
65
+ }
66
+
67
+ type DecodedSourceMapOrMissing =
68
+ | {
69
+ mappings?: never;
70
+ missing: true;
71
+ plugin: string;
72
+ }
73
+ | ExistingDecodedSourceMap;
74
+
75
+ interface SourceMap {
76
+ file: string;
77
+ mappings: string;
78
+ names: string[];
79
+ sources: string[];
80
+ sourcesContent: string[];
81
+ version: number;
82
+ toString(): string;
83
+ toUrl(): string;
84
+ }
85
+
86
+ type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
87
+
88
+ type PartialNull<T> = {
89
+ [P in keyof T]: T[P] | null;
90
+ };
91
+
92
+ interface ModuleOptions {
93
+ meta: CustomPluginOptions;
94
+ moduleSideEffects: boolean | 'no-treeshake';
95
+ syntheticNamedExports: boolean | string;
96
+ }
97
+
98
+ interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
99
+ ast?: AcornNode;
100
+ code: string;
101
+ map?: SourceMapInput;
102
+ }
103
+
104
+ interface TransformModuleJSON extends Partial<PartialNull<ModuleOptions>> {
105
+ ast?: AcornNode;
106
+ code: string;
107
+ // note if plugins use new this.cache to opt-out auto transform cache
108
+ customTransformCache: boolean;
109
+ originalCode: string;
110
+ originalSourcemap: ExistingDecodedSourceMap | null;
111
+ resolvedIds?: ResolvedIdMap;
112
+ sourcemapChain: DecodedSourceMapOrMissing[];
113
+ transformDependencies: string[];
114
+ }
115
+
116
+ interface ModuleJSON extends TransformModuleJSON {
117
+ ast: AcornNode;
118
+ dependencies: string[];
119
+ id: string;
120
+ transformFiles: EmittedFile[] | undefined;
121
+ }
122
+
123
+ interface PluginCache {
124
+ delete(id: string): boolean;
125
+ get<T = any>(id: string): T;
126
+ has(id: string): boolean;
127
+ set<T = any>(id: string, value: T): void;
128
+ }
129
+
130
+ interface MinimalPluginContext {
131
+ meta: PluginContextMeta;
132
+ }
133
+
134
+ interface EmittedAsset {
135
+ fileName?: string;
136
+ name?: string;
137
+ source?: string | Uint8Array;
138
+ type: 'asset';
139
+ }
140
+
141
+ interface EmittedChunk {
142
+ fileName?: string;
143
+ id: string;
144
+ implicitlyLoadedAfterOneOf?: string[];
145
+ importer?: string;
146
+ name?: string;
147
+ preserveSignature?: PreserveEntrySignaturesOption;
148
+ type: 'chunk';
149
+ }
150
+
151
+ type EmittedFile = EmittedAsset | EmittedChunk;
152
+
153
+ type EmitAsset = (name: string, source?: string | Uint8Array) => string;
154
+
155
+ type EmitChunk = (id: string, options?: { name?: string }) => string;
156
+
157
+ type EmitFile = (emittedFile: EmittedFile) => string;
158
+
159
+ interface ModuleInfo {
160
+ ast: AcornNode | null;
161
+ code: string | null;
162
+ dynamicImporters: readonly string[];
163
+ dynamicallyImportedIds: readonly string[];
164
+ hasModuleSideEffects: boolean | 'no-treeshake';
165
+ id: string;
166
+ implicitlyLoadedAfterOneOf: readonly string[];
167
+ implicitlyLoadedBefore: readonly string[];
168
+ importedIds: readonly string[];
169
+ importers: readonly string[];
170
+ isEntry: boolean;
171
+ isExternal: boolean;
172
+ meta: CustomPluginOptions;
173
+ syntheticNamedExports: boolean | string;
174
+ }
175
+
176
+ type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
177
+
178
+ interface CustomPluginOptions {
179
+ [plugin: string]: any;
180
+ }
181
+
182
+ interface PluginContext extends MinimalPluginContext {
183
+ addWatchFile: (id: string) => void;
184
+ cache: PluginCache;
185
+ /** @deprecated Use `this.emitFile` instead */
186
+ emitAsset: EmitAsset;
187
+ /** @deprecated Use `this.emitFile` instead */
188
+ emitChunk: EmitChunk;
189
+ emitFile: EmitFile;
190
+ error: (err: RollupError | string, pos?: number | { column: number; line: number }) => never;
191
+ /** @deprecated Use `this.getFileName` instead */
192
+ getAssetFileName: (assetReferenceId: string) => string;
193
+ /** @deprecated Use `this.getFileName` instead */
194
+ getChunkFileName: (chunkReferenceId: string) => string;
195
+ getFileName: (fileReferenceId: string) => string;
196
+ getModuleIds: () => IterableIterator<string>;
197
+ getModuleInfo: GetModuleInfo;
198
+ getWatchFiles: () => string[];
199
+ /** @deprecated Use `this.resolve` instead */
200
+ isExternal: IsExternal;
201
+ /** @deprecated Use `this.getModuleIds` instead */
202
+ moduleIds: IterableIterator<string>;
203
+ parse: (input: string, options?: any) => AcornNode;
204
+ resolve: (
205
+ source: string,
206
+ importer?: string,
207
+ options?: { custom?: CustomPluginOptions; skipSelf?: boolean }
208
+ ) => Promise<ResolvedId | null>;
209
+ /** @deprecated Use `this.resolve` instead */
210
+ resolveId: (source: string, importer?: string) => Promise<string | null>;
211
+ setAssetSource: (assetReferenceId: string, source: string | Uint8Array) => void;
212
+ warn: (warning: RollupWarning | string, pos?: number | { column: number; line: number }) => void;
213
+ }
214
+
215
+ interface PluginContextMeta {
216
+ rollupVersion: string;
217
+ watchMode: boolean;
218
+ }
219
+
220
+ interface ResolvedId extends ModuleOptions {
221
+ external: boolean | 'absolute';
222
+ id: string;
223
+ }
224
+
225
+ interface ResolvedIdMap {
226
+ [key: string]: ResolvedId;
227
+ }
228
+
229
+ interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
230
+ external?: boolean | 'absolute' | 'relative';
231
+ id: string;
232
+ }
233
+
234
+ type ResolveIdResult = string | false | null | undefined | PartialResolvedId;
235
+
236
+ type ResolveIdHook = (
237
+ this: PluginContext,
238
+ source: string,
239
+ importer: string | undefined,
240
+ options: { custom?: CustomPluginOptions }
241
+ ) => Promise<ResolveIdResult> | ResolveIdResult;
242
+
243
+ type IsExternal = (
244
+ source: string,
245
+ importer: string | undefined,
246
+ isResolved: boolean
247
+ ) => boolean;
248
+
249
+ type IsPureModule = (id: string) => boolean | null | undefined;
250
+
251
+ type HasModuleSideEffects = (id: string, external: boolean) => boolean;
252
+
253
+ type LoadResult = SourceDescription | string | null | undefined;
254
+
255
+ type LoadHook = (this: PluginContext, id: string) => Promise<LoadResult> | LoadResult;
256
+
257
+ interface TransformPluginContext extends PluginContext {
258
+ getCombinedSourcemap: () => SourceMap;
259
+ }
260
+
261
+ type TransformResult = string | null | undefined | Partial<SourceDescription>;
262
+
263
+ type TransformHook = (
264
+ this: TransformPluginContext,
265
+ code: string,
266
+ id: string
267
+ ) => Promise<TransformResult> | TransformResult;
268
+
269
+ type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => Promise<void> | void;
270
+
271
+ type RenderChunkHook = (
272
+ this: PluginContext,
273
+ code: string,
274
+ chunk: RenderedChunk,
275
+ options: NormalizedOutputOptions
276
+ ) =>
277
+ | Promise<{ code: string; map?: SourceMapInput } | null>
278
+ | { code: string; map?: SourceMapInput }
279
+ | string
280
+ | null
281
+ | undefined;
282
+
283
+ type ResolveDynamicImportHook = (
284
+ this: PluginContext,
285
+ specifier: string | AcornNode,
286
+ importer: string
287
+ ) => Promise<ResolveIdResult> | ResolveIdResult;
288
+
289
+ type ResolveImportMetaHook = (
290
+ this: PluginContext,
291
+ prop: string | null,
292
+ options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
293
+ ) => string | null | undefined;
294
+
295
+ type ResolveAssetUrlHook = (
296
+ this: PluginContext,
297
+ options: {
298
+ assetFileName: string;
299
+ chunkId: string;
300
+ format: InternalModuleFormat;
301
+ moduleId: string;
302
+ relativeAssetPath: string;
303
+ }
304
+ ) => string | null | undefined;
305
+
306
+ type ResolveFileUrlHook = (
307
+ this: PluginContext,
308
+ options: {
309
+ assetReferenceId: string | null;
310
+ chunkId: string;
311
+ chunkReferenceId: string | null;
312
+ fileName: string;
313
+ format: InternalModuleFormat;
314
+ moduleId: string;
315
+ referenceId: string;
316
+ relativePath: string;
317
+ }
318
+ ) => string | null | undefined;
319
+
320
+ type AddonHookFunction = (this: PluginContext) => string | Promise<string>;
321
+ type AddonHook = string | AddonHookFunction;
322
+
323
+ type ChangeEvent = 'create' | 'update' | 'delete';
324
+ type WatchChangeHook = (
325
+ this: PluginContext,
326
+ id: string,
327
+ change: { event: ChangeEvent }
328
+ ) => void;
329
+
330
+ interface OutputBundle {
331
+ [fileName: string]: OutputAsset | OutputChunk;
332
+ }
333
+
334
+ interface PluginHooks extends OutputPluginHooks {
335
+ buildEnd: (this: PluginContext, err?: Error) => Promise<void> | void;
336
+ buildStart: (this: PluginContext, options: NormalizedInputOptions) => Promise<void> | void;
337
+ closeBundle: (this: PluginContext) => Promise<void> | void;
338
+ closeWatcher: (this: PluginContext) => void;
339
+ load: LoadHook;
340
+ moduleParsed: ModuleParsedHook;
341
+ options: (
342
+ this: MinimalPluginContext,
343
+ options: InputOptions
344
+ ) => Promise<InputOptions | null | undefined> | InputOptions | null | undefined;
345
+ resolveDynamicImport: ResolveDynamicImportHook;
346
+ resolveId: ResolveIdHook;
347
+ transform: TransformHook;
348
+ watchChange: WatchChangeHook;
349
+ }
350
+
351
+ interface OutputPluginHooks {
352
+ augmentChunkHash: (this: PluginContext, chunk: PreRenderedChunk) => string | void;
353
+ generateBundle: (
354
+ this: PluginContext,
355
+ options: NormalizedOutputOptions,
356
+ bundle: OutputBundle,
357
+ isWrite: boolean
358
+ ) => void | Promise<void>;
359
+ outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | undefined;
360
+ renderChunk: RenderChunkHook;
361
+ renderDynamicImport: (
362
+ this: PluginContext,
363
+ options: {
364
+ customResolution: string | null;
365
+ format: InternalModuleFormat;
366
+ moduleId: string;
367
+ targetModuleId: string | null;
368
+ }
369
+ ) => { left: string; right: string } | null | undefined;
370
+ renderError: (this: PluginContext, err?: Error) => Promise<void> | void;
371
+ renderStart: (
372
+ this: PluginContext,
373
+ outputOptions: NormalizedOutputOptions,
374
+ inputOptions: NormalizedInputOptions
375
+ ) => Promise<void> | void;
376
+ /** @deprecated Use `resolveFileUrl` instead */
377
+ resolveAssetUrl: ResolveAssetUrlHook;
378
+ resolveFileUrl: ResolveFileUrlHook;
379
+ resolveImportMeta: ResolveImportMetaHook;
380
+ writeBundle: (
381
+ this: PluginContext,
382
+ options: NormalizedOutputOptions,
383
+ bundle: OutputBundle
384
+ ) => void | Promise<void>;
385
+ }
386
+
387
+ interface OutputPluginValueHooks {
388
+ banner: AddonHook;
389
+ cacheKey: string;
390
+ footer: AddonHook;
391
+ intro: AddonHook;
392
+ outro: AddonHook;
393
+ }
394
+
395
+ interface Plugin extends Partial<PluginHooks>, Partial<OutputPluginValueHooks> {
396
+ // for inter-plugin communication
397
+ api?: any;
398
+ name: string;
399
+ }
400
+
401
+ interface OutputPlugin extends Partial<OutputPluginHooks>, Partial<OutputPluginValueHooks> {
402
+ name: string;
403
+ }
404
+
405
+ type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
406
+
407
+ interface TreeshakingOptions {
408
+ annotations?: boolean;
409
+ correctVarValueBeforeDeclaration?: boolean;
410
+ moduleSideEffects?: ModuleSideEffectsOption;
411
+ preset?: TreeshakingPreset;
412
+ propertyReadSideEffects?: boolean | 'always';
413
+ /** @deprecated Use `moduleSideEffects` instead */
414
+ pureExternalModules?: PureModulesOption;
415
+ tryCatchDeoptimization?: boolean;
416
+ unknownGlobalSideEffects?: boolean;
417
+ }
418
+
419
+ interface NormalizedTreeshakingOptions {
420
+ annotations: boolean;
421
+ correctVarValueBeforeDeclaration: boolean;
422
+ moduleSideEffects: HasModuleSideEffects;
423
+ propertyReadSideEffects: boolean | 'always';
424
+ tryCatchDeoptimization: boolean;
425
+ unknownGlobalSideEffects: boolean;
426
+ }
427
+
428
+ interface GetManualChunkApi {
429
+ getModuleIds: () => IterableIterator<string>;
430
+ getModuleInfo: GetModuleInfo;
431
+ }
432
+ type GetManualChunk = (id: string, api: GetManualChunkApi) => string | null | undefined;
433
+
434
+ type ExternalOption =
435
+ | (string | RegExp)[]
436
+ | string
437
+ | RegExp
438
+ | ((
439
+ source: string,
440
+ importer: string | undefined,
441
+ isResolved: boolean
442
+ ) => boolean | null | undefined);
443
+ type PureModulesOption = boolean | string[] | IsPureModule;
444
+ type GlobalsOption = { [name: string]: string } | ((name: string) => string);
445
+ type InputOption = string | string[] | { [entryAlias: string]: string };
446
+ type ManualChunksOption = { [chunkAlias: string]: string[] } | GetManualChunk;
447
+ type ModuleSideEffectsOption = boolean | 'no-external' | string[] | HasModuleSideEffects;
448
+ type PreserveEntrySignaturesOption = false | 'strict' | 'allow-extension' | 'exports-only';
449
+ type SourcemapPathTransformOption = (
450
+ relativeSourcePath: string,
451
+ sourcemapPath: string
452
+ ) => string;
453
+
454
+ interface InputOptions {
455
+ acorn?: Record<string, unknown>;
456
+ acornInjectPlugins?: (() => unknown)[] | (() => unknown);
457
+ cache?: false | RollupCache;
458
+ context?: string;
459
+ experimentalCacheExpiry?: number;
460
+ external?: ExternalOption;
461
+ /** @deprecated Use the "inlineDynamicImports" output option instead. */
462
+ inlineDynamicImports?: boolean;
463
+ input?: InputOption;
464
+ makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
465
+ /** @deprecated Use the "manualChunks" output option instead. */
466
+ manualChunks?: ManualChunksOption;
467
+ maxParallelFileReads?: number;
468
+ moduleContext?: ((id: string) => string | null | undefined) | { [id: string]: string };
469
+ onwarn?: WarningHandlerWithDefault;
470
+ perf?: boolean;
471
+ plugins?: (Plugin | null | false | undefined)[];
472
+ preserveEntrySignatures?: PreserveEntrySignaturesOption;
473
+ /** @deprecated Use the "preserveModules" output option instead. */
474
+ preserveModules?: boolean;
475
+ preserveSymlinks?: boolean;
476
+ shimMissingExports?: boolean;
477
+ strictDeprecations?: boolean;
478
+ treeshake?: boolean | TreeshakingPreset | TreeshakingOptions;
479
+ watch?: WatcherOptions | false;
480
+ }
481
+
482
+ interface NormalizedInputOptions {
483
+ acorn: Record<string, unknown>;
484
+ acornInjectPlugins: (() => unknown)[];
485
+ cache: false | undefined | RollupCache;
486
+ context: string;
487
+ experimentalCacheExpiry: number;
488
+ external: IsExternal;
489
+ /** @deprecated Use the "inlineDynamicImports" output option instead. */
490
+ inlineDynamicImports: boolean | undefined;
491
+ input: string[] | { [entryAlias: string]: string };
492
+ makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
493
+ /** @deprecated Use the "manualChunks" output option instead. */
494
+ manualChunks: ManualChunksOption | undefined;
495
+ maxParallelFileReads: number;
496
+ moduleContext: (id: string) => string;
497
+ onwarn: WarningHandler;
498
+ perf: boolean;
499
+ plugins: Plugin[];
500
+ preserveEntrySignatures: PreserveEntrySignaturesOption;
501
+ /** @deprecated Use the "preserveModules" output option instead. */
502
+ preserveModules: boolean | undefined;
503
+ preserveSymlinks: boolean;
504
+ shimMissingExports: boolean;
505
+ strictDeprecations: boolean;
506
+ treeshake: false | NormalizedTreeshakingOptions;
507
+ }
508
+
509
+ type InternalModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd';
510
+
511
+ type ModuleFormat = InternalModuleFormat | 'commonjs' | 'esm' | 'module' | 'systemjs';
512
+
513
+ type OptionsPaths = Record<string, string> | ((id: string) => string);
514
+
515
+ type InteropType = boolean | 'auto' | 'esModule' | 'default' | 'defaultOnly';
516
+
517
+ type GetInterop = (id: string | null) => InteropType;
518
+
519
+ type AmdOptions = (
520
+ | {
521
+ autoId?: false;
522
+ id: string;
523
+ }
524
+ | {
525
+ autoId: true;
526
+ basePath?: string;
527
+ id?: undefined;
528
+ }
529
+ | {
530
+ autoId?: false;
531
+ id?: undefined;
532
+ }
533
+ ) & {
534
+ define?: string;
535
+ };
536
+
537
+ type NormalizedAmdOptions = (
538
+ | {
539
+ autoId: false;
540
+ id?: string;
541
+ }
542
+ | {
543
+ autoId: true;
544
+ basePath: string;
545
+ }
546
+ ) & {
547
+ define: string;
548
+ };
549
+
550
+ interface OutputOptions {
551
+ amd?: AmdOptions;
552
+ assetFileNames?: string | ((chunkInfo: PreRenderedAsset) => string);
553
+ banner?: string | (() => string | Promise<string>);
554
+ chunkFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
555
+ compact?: boolean;
556
+ // only required for bundle.write
557
+ dir?: string;
558
+ /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
559
+ dynamicImportFunction?: string;
560
+ entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
561
+ esModule?: boolean;
562
+ exports?: 'default' | 'named' | 'none' | 'auto';
563
+ extend?: boolean;
564
+ externalLiveBindings?: boolean;
565
+ // only required for bundle.write
566
+ file?: string;
567
+ footer?: string | (() => string | Promise<string>);
568
+ format?: ModuleFormat;
569
+ freeze?: boolean;
570
+ globals?: GlobalsOption;
571
+ hoistTransitiveImports?: boolean;
572
+ indent?: string | boolean;
573
+ inlineDynamicImports?: boolean;
574
+ interop?: InteropType | GetInterop;
575
+ intro?: string | (() => string | Promise<string>);
576
+ manualChunks?: ManualChunksOption;
577
+ minifyInternalExports?: boolean;
578
+ name?: string;
579
+ namespaceToStringTag?: boolean;
580
+ noConflict?: boolean;
581
+ outro?: string | (() => string | Promise<string>);
582
+ paths?: OptionsPaths;
583
+ plugins?: (OutputPlugin | null | false | undefined)[];
584
+ preferConst?: boolean;
585
+ preserveModules?: boolean;
586
+ preserveModulesRoot?: string;
587
+ sanitizeFileName?: boolean | ((fileName: string) => string);
588
+ sourcemap?: boolean | 'inline' | 'hidden';
589
+ sourcemapExcludeSources?: boolean;
590
+ sourcemapFile?: string;
591
+ sourcemapPathTransform?: SourcemapPathTransformOption;
592
+ strict?: boolean;
593
+ systemNullSetters?: boolean;
594
+ validate?: boolean;
595
+ }
596
+
597
+ interface NormalizedOutputOptions {
598
+ amd: NormalizedAmdOptions;
599
+ assetFileNames: string | ((chunkInfo: PreRenderedAsset) => string);
600
+ banner: () => string | Promise<string>;
601
+ chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
602
+ compact: boolean;
603
+ dir: string | undefined;
604
+ /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
605
+ dynamicImportFunction: string | undefined;
606
+ entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
607
+ esModule: boolean;
608
+ exports: 'default' | 'named' | 'none' | 'auto';
609
+ extend: boolean;
610
+ externalLiveBindings: boolean;
611
+ file: string | undefined;
612
+ footer: () => string | Promise<string>;
613
+ format: InternalModuleFormat;
614
+ freeze: boolean;
615
+ globals: GlobalsOption;
616
+ hoistTransitiveImports: boolean;
617
+ indent: true | string;
618
+ inlineDynamicImports: boolean;
619
+ interop: GetInterop;
620
+ intro: () => string | Promise<string>;
621
+ manualChunks: ManualChunksOption;
622
+ minifyInternalExports: boolean;
623
+ name: string | undefined;
624
+ namespaceToStringTag: boolean;
625
+ noConflict: boolean;
626
+ outro: () => string | Promise<string>;
627
+ paths: OptionsPaths;
628
+ plugins: OutputPlugin[];
629
+ preferConst: boolean;
630
+ preserveModules: boolean;
631
+ preserveModulesRoot: string | undefined;
632
+ sanitizeFileName: (fileName: string) => string;
633
+ sourcemap: boolean | 'inline' | 'hidden';
634
+ sourcemapExcludeSources: boolean;
635
+ sourcemapFile: string | undefined;
636
+ sourcemapPathTransform: SourcemapPathTransformOption | undefined;
637
+ strict: boolean;
638
+ systemNullSetters: boolean;
639
+ validate: boolean;
640
+ }
641
+
642
+ type WarningHandlerWithDefault = (
643
+ warning: RollupWarning,
644
+ defaultHandler: WarningHandler
645
+ ) => void;
646
+ type WarningHandler = (warning: RollupWarning) => void;
647
+
648
+ interface SerializedTimings {
649
+ [label: string]: [number, number, number];
650
+ }
651
+
652
+ interface PreRenderedAsset {
653
+ name: string | undefined;
654
+ source: string | Uint8Array;
655
+ type: 'asset';
656
+ }
657
+
658
+ interface OutputAsset extends PreRenderedAsset {
659
+ fileName: string;
660
+ /** @deprecated Accessing "isAsset" on files in the bundle is deprecated, please use "type === \'asset\'" instead */
661
+ isAsset: true;
662
+ }
663
+
664
+ interface RenderedModule {
665
+ code: string | null;
666
+ originalLength: number;
667
+ removedExports: string[];
668
+ renderedExports: string[];
669
+ renderedLength: number;
670
+ }
671
+
672
+ interface PreRenderedChunk {
673
+ exports: string[];
674
+ facadeModuleId: string | null;
675
+ isDynamicEntry: boolean;
676
+ isEntry: boolean;
677
+ isImplicitEntry: boolean;
678
+ modules: {
679
+ [id: string]: RenderedModule;
680
+ };
681
+ name: string;
682
+ type: 'chunk';
683
+ }
684
+
685
+ interface RenderedChunk extends PreRenderedChunk {
686
+ code?: string;
687
+ dynamicImports: string[];
688
+ fileName: string;
689
+ implicitlyLoadedBefore: string[];
690
+ importedBindings: {
691
+ [imported: string]: string[];
692
+ };
693
+ imports: string[];
694
+ map?: SourceMap;
695
+ referencedFiles: string[];
696
+ }
697
+
698
+ interface OutputChunk extends RenderedChunk {
699
+ code: string;
700
+ }
701
+
702
+ interface SerializablePluginCache {
703
+ [key: string]: [number, any];
704
+ }
705
+
706
+ interface RollupCache {
707
+ modules: ModuleJSON[];
708
+ plugins?: Record<string, SerializablePluginCache>;
709
+ }
710
+
711
+ interface RollupOutput {
712
+ output: [OutputChunk, ...(OutputChunk | OutputAsset)[]];
713
+ }
714
+
715
+ interface RollupBuild {
716
+ cache: RollupCache | undefined;
717
+ close: () => Promise<void>;
718
+ closed: boolean;
719
+ generate: (outputOptions: OutputOptions) => Promise<RollupOutput>;
720
+ getTimings?: () => SerializedTimings;
721
+ watchFiles: string[];
722
+ write: (options: OutputOptions) => Promise<RollupOutput>;
723
+ }
724
+
725
+ interface ChokidarOptions {
726
+ alwaysStat?: boolean;
727
+ atomic?: boolean | number;
728
+ awaitWriteFinish?:
729
+ | {
730
+ pollInterval?: number;
731
+ stabilityThreshold?: number;
732
+ }
733
+ | boolean;
734
+ binaryInterval?: number;
735
+ cwd?: string;
736
+ depth?: number;
737
+ disableGlobbing?: boolean;
738
+ followSymlinks?: boolean;
739
+ ignoreInitial?: boolean;
740
+ ignorePermissionErrors?: boolean;
741
+ ignored?: any;
742
+ interval?: number;
743
+ persistent?: boolean;
744
+ useFsEvents?: boolean;
745
+ usePolling?: boolean;
746
+ }
747
+
748
+ interface WatcherOptions {
749
+ buildDelay?: number;
750
+ chokidar?: ChokidarOptions;
751
+ clearScreen?: boolean;
752
+ exclude?: string | RegExp | (string | RegExp)[];
753
+ include?: string | RegExp | (string | RegExp)[];
754
+ skipWrite?: boolean;
755
+ }
756
+
757
+ interface TypedEventEmitter<T extends { [event: string]: (...args: any) => any }> {
758
+ addListener<K extends keyof T>(event: K, listener: T[K]): this;
759
+ emit<K extends keyof T>(event: K, ...args: Parameters<T[K]>): boolean;
760
+ eventNames(): Array<keyof T>;
761
+ getMaxListeners(): number;
762
+ listenerCount(type: keyof T): number;
763
+ listeners<K extends keyof T>(event: K): Array<T[K]>;
764
+ off<K extends keyof T>(event: K, listener: T[K]): this;
765
+ on<K extends keyof T>(event: K, listener: T[K]): this;
766
+ once<K extends keyof T>(event: K, listener: T[K]): this;
767
+ prependListener<K extends keyof T>(event: K, listener: T[K]): this;
768
+ prependOnceListener<K extends keyof T>(event: K, listener: T[K]): this;
769
+ rawListeners<K extends keyof T>(event: K): Array<T[K]>;
770
+ removeAllListeners<K extends keyof T>(event?: K): this;
771
+ removeListener<K extends keyof T>(event: K, listener: T[K]): this;
772
+ setMaxListeners(n: number): this;
773
+ }
774
+
775
+ type RollupWatcherEvent =
776
+ | { code: 'START' }
777
+ | { code: 'BUNDLE_START'; input?: InputOption; output: readonly string[] }
778
+ | {
779
+ code: 'BUNDLE_END';
780
+ duration: number;
781
+ input?: InputOption;
782
+ output: readonly string[];
783
+ result: RollupBuild;
784
+ }
785
+ | { code: 'END' }
786
+ | { code: 'ERROR'; error: RollupError; result: RollupBuild | null };
787
+
788
+ interface RollupWatcher
789
+ extends TypedEventEmitter<{
790
+ change: (id: string, change: { event: ChangeEvent }) => void;
791
+ close: () => void;
792
+ event: (event: RollupWatcherEvent) => void;
793
+ restart: () => void;
794
+ }> {
795
+ close(): void;
796
+ }
797
+
798
+ interface AcornNode {
799
+ end: number;
800
+ start: number;
801
+ type: string;
802
+ }
803
+
804
+ declare type Options = {
805
+ entry?: string;
806
+ watch?: boolean | string | (string | boolean)[];
807
+ };
808
+ declare type NormalizedOptions = MarkRequired<Options, 'entry'>;
809
+ declare function runViteBuild(options: NormalizedOptions): Promise<RollupOutput | RollupWatcher | RollupOutput[]>;
810
+ declare function build(_options: Options): Promise<void>;
811
+
812
+ export { NormalizedOptions, Options, build, runViteBuild };