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