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