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