rollup 0.57.0 → 0.58.2

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +3 -11
  3. package/bin/rollup +591 -413
  4. package/dist/rollup.browser.js +19731 -18315
  5. package/dist/rollup.d.ts +341 -0
  6. package/dist/rollup.es.js +6582 -4875
  7. package/dist/rollup.js +6581 -4874
  8. package/dist/typings/Chunk.d.ts +37 -25
  9. package/dist/typings/ExternalModule.d.ts +3 -0
  10. package/dist/typings/Graph.d.ts +7 -6
  11. package/dist/typings/Module.d.ts +5 -1
  12. package/dist/typings/ast/nodes/ConditionalExpression.d.ts +4 -6
  13. package/dist/typings/ast/nodes/ExportDefaultDeclaration.d.ts +0 -1
  14. package/dist/typings/ast/nodes/Identifier.d.ts +2 -2
  15. package/dist/typings/ast/nodes/Import.d.ts +5 -3
  16. package/dist/typings/ast/nodes/LogicalExpression.d.ts +8 -4
  17. package/dist/typings/ast/nodes/MemberExpression.d.ts +2 -2
  18. package/dist/typings/ast/nodes/ObjectExpression.d.ts +3 -0
  19. package/dist/typings/ast/nodes/SequenceExpression.d.ts +10 -2
  20. package/dist/typings/ast/variables/GlobalVariable.d.ts +0 -1
  21. package/dist/typings/chunk-optimization.d.ts +3 -0
  22. package/dist/typings/finalisers/amd.d.ts +2 -9
  23. package/dist/typings/finalisers/cjs.d.ts +2 -8
  24. package/dist/typings/finalisers/es.d.ts +2 -8
  25. package/dist/typings/finalisers/iife.d.ts +2 -8
  26. package/dist/typings/finalisers/index.d.ts +9 -4
  27. package/dist/typings/finalisers/shared/warnOnBuiltins.d.ts +3 -2
  28. package/dist/typings/finalisers/system.d.ts +2 -7
  29. package/dist/typings/finalisers/umd.d.ts +2 -8
  30. package/dist/typings/rollup/index.d.ts +36 -28
  31. package/dist/typings/utils/addons.d.ts +10 -0
  32. package/dist/typings/utils/blank.d.ts +1 -0
  33. package/dist/typings/utils/collapseSourcemaps.d.ts +2 -2
  34. package/dist/typings/utils/defaults.d.ts +1 -1
  35. package/dist/typings/utils/mergeOptions.d.ts +4 -1
  36. package/dist/typings/utils/relativeId.d.ts +2 -0
  37. package/dist/typings/utils/renderHelpers.d.ts +2 -0
  38. package/dist/typings/watch/index.d.ts +5 -2
  39. package/package.json +33 -32
  40. package/dist/typings/finalisers/shared/getGlobalNameMaker.d.ts +0 -4
  41. package/dist/typings/utils/flushTime.d.ts +0 -5
  42. package/dist/typings/utils/object.d.ts +0 -7
  43. package/typings/package.json.d.ts +0 -3
@@ -1,9 +1,10 @@
1
1
  import { SourceMap } from 'magic-string';
2
- import Module, { ModuleJSON } from './Module';
2
+ import Module from './Module';
3
3
  import { OutputOptions } from './rollup/index';
4
4
  import Graph from './Graph';
5
5
  import ExternalModule from './ExternalModule';
6
6
  import Variable from './ast/variables/Variable';
7
+ import { Addons } from './utils/addons';
7
8
  export interface ModuleDeclarations {
8
9
  exports: ChunkExports;
9
10
  dependencies: ModuleDeclarationDependency[];
@@ -11,6 +12,7 @@ export interface ModuleDeclarations {
11
12
  export interface ModuleDeclarationDependency {
12
13
  id: string;
13
14
  name: string;
15
+ globalName: string;
14
16
  isChunk: boolean;
15
17
  exportsDefault: boolean;
16
18
  exportsNames: boolean;
@@ -39,47 +41,57 @@ export interface DynamicImportMechanism {
39
41
  interopRight?: string;
40
42
  }
41
43
  export default class Chunk {
44
+ hasDynamicImport: boolean;
45
+ indentString: string;
46
+ usedModules: Module[];
42
47
  id: string;
43
48
  name: string;
44
49
  graph: Graph;
45
50
  private orderedModules;
46
- private exportedVariableNames;
47
51
  private imports;
48
52
  private exports;
53
+ private exportNames;
49
54
  private dependencies;
50
55
  entryModule: Module;
51
56
  isEntryModuleFacade: boolean;
57
+ isManualChunk: boolean;
58
+ private renderedHash;
59
+ private renderedModuleSources;
60
+ private renderedSource;
61
+ private renderedSourceLength;
62
+ private renderedDeclarations;
52
63
  constructor(graph: Graph, orderedModules: Module[]);
53
- setId(id: string): void;
54
- ensureExport(module: Module | ExternalModule, variable: Variable, exportName: string): string;
55
- generateEntryExports(entryModule: Module, onlyIncluded?: boolean): void;
56
- collectDependencies(entryFacade?: Module): void;
57
- generateImports(): void;
58
- populateImport(variable: Variable, tracedExport: {
59
- name: string;
60
- module: Module | ExternalModule;
61
- }): void;
62
64
  getImportIds(): string[];
63
65
  getExportNames(): string[];
64
- getJsonModules(): ModuleJSON[];
65
- traceImport(module: Module | ExternalModule, exportName: string): {
66
- name: string;
67
- module: ExternalModule | Module;
68
- };
69
- traceExport(module: Module | ExternalModule, name: string): {
70
- name: string;
66
+ getModuleIds(): string[];
67
+ private inlineDeepModuleDependencies();
68
+ linkFacade(entryFacade: Module): void;
69
+ link(): void;
70
+ populateEntryExports(preserveModules: boolean): void;
71
+ private traceImport(exportName, module);
72
+ traceExport(name: string, module: Module | ExternalModule): {
73
+ variable: Variable;
71
74
  module: Module | ExternalModule;
72
75
  };
73
- collectAddon(initialAddon: string, addonName: 'banner' | 'footer' | 'intro' | 'outro', sep?: string): Promise<string>;
74
- private setDynamicImportResolutions({format});
76
+ getVariableExportName(variable: Variable): string;
77
+ generateInternalExports(options: OutputOptions): void;
78
+ private prepareDynamicImports({format});
79
+ private finaliseDynamicImports();
75
80
  private setIdentifierRenderResolutions(options);
76
- private getCheckReexportDeclarations();
77
- private getChunkDependencyDeclarations();
81
+ private getChunkDependencyDeclarations(options);
78
82
  private getChunkExportDeclarations();
79
- getModuleDeclarations(): ModuleDeclarations;
80
- render(options: OutputOptions): Promise<{
83
+ getRenderedHash(): string;
84
+ postVisitChunkDependencies(visitor: (dep: Chunk | ExternalModule) => any): boolean;
85
+ private computeFullHash(addons, options);
86
+ preRender(options: OutputOptions): void;
87
+ getRenderedSourceLength(): number;
88
+ merge(chunk: Chunk, chunkList: Chunk[], options: OutputOptions): void;
89
+ generateNamePreserveModules(preserveModulesRelativeDir: string): string;
90
+ generateName(pattern: string, addons: Addons, options: OutputOptions, existingNames?: {
91
+ [name: string]: boolean;
92
+ }): void;
93
+ render(options: OutputOptions, addons: Addons): Promise<{
81
94
  code: string;
82
95
  map: SourceMap;
83
96
  }>;
84
- private createGetPath(options);
85
97
  }
@@ -1,6 +1,7 @@
1
1
  import ExternalVariable from './ast/variables/ExternalVariable';
2
2
  import Graph from './Graph';
3
3
  import Variable from './ast/variables/Variable';
4
+ import { OutputOptions } from './rollup';
4
5
  export default class ExternalModule {
5
6
  private graph;
6
7
  chunk: void;
@@ -10,6 +11,7 @@ export default class ExternalModule {
10
11
  exportsNames: boolean;
11
12
  exportsNamespace: boolean;
12
13
  id: string;
14
+ renderPath: string;
13
15
  isExternal: true;
14
16
  isEntryPoint: false;
15
17
  name: string;
@@ -24,6 +26,7 @@ export default class ExternalModule {
24
26
  graph: Graph;
25
27
  id: string;
26
28
  });
29
+ setRenderPath(options: OutputOptions, inputPath: string): void;
27
30
  suggestName(name: string): void;
28
31
  warnUnusedImports(): void;
29
32
  traceExport(name: string): Variable;
@@ -8,6 +8,7 @@ import Chunk from './Chunk';
8
8
  import GlobalScope from './ast/scopes/GlobalScope';
9
9
  export declare type ResolveDynamicImportHandler = (specifier: string | Node, parentId: string) => Promise<string | void>;
10
10
  export default class Graph {
11
+ curChunkIndex: number;
11
12
  acornOptions: acorn.Options;
12
13
  acornParse: acorn.IParse;
13
14
  cachedModules: Map<string, ModuleJSON>;
@@ -18,7 +19,6 @@ export default class Graph {
18
19
  hasLoaders: boolean;
19
20
  isExternal: IsExternalHook;
20
21
  isPureExternalModule: (id: string) => boolean;
21
- legacy: boolean;
22
22
  load: (id: string) => Promise<SourceDescription | string | void>;
23
23
  handleMissingExport: (exportName: string, importingModule: Module, importedModule: string, importerStart?: number) => void;
24
24
  moduleById: Map<string, Module | ExternalModule>;
@@ -32,15 +32,16 @@ export default class Graph {
32
32
  varOrConst: 'var' | 'const';
33
33
  treeshake: boolean;
34
34
  constructor(options: InputOptions);
35
- getPathRelativeToBaseDirname(resolvedId: string, parentId: string): string;
35
+ getCache(): {
36
+ modules: ModuleJSON[];
37
+ };
36
38
  private loadModule(entryName);
37
39
  private link();
38
40
  includeMarked(modules: Module[]): void;
39
41
  buildSingle(entryModuleId: string): Promise<Chunk>;
40
- buildChunks(entryModuleIds: string[], preserveModules: boolean): Promise<{
41
- [name: string]: Chunk;
42
- }>;
43
- private analyseExecution(entryModules, preserveModules?);
42
+ private loadEntryModules(entryModules, manualChunks);
43
+ buildChunks(entryModules: Record<string, string> | string[], manualChunks: Record<string, string[]> | void, preserveModules: boolean): Promise<Chunk[]>;
44
+ private analyseExecution(entryModules, graphColouring, chunkModules?);
44
45
  private warnCycle(id, parentId, parents);
45
46
  private fetchModule(id, importer);
46
47
  private fetchAllDependencies(module);
@@ -84,9 +84,13 @@ export default class Module {
84
84
  sourcemapChain: RawSourceMap[];
85
85
  sources: string[];
86
86
  dynamicImports: Import[];
87
- dynamicImportResolutions: (Module | ExternalModule | string | void)[];
87
+ dynamicImportResolutions: {
88
+ alias: string;
89
+ resolution: Module | ExternalModule | string | void;
90
+ }[];
88
91
  execIndex: number;
89
92
  isEntryPoint: boolean;
93
+ chunkAlias: string;
90
94
  entryPointsHash: Uint8Array;
91
95
  chunk: Chunk;
92
96
  ast: Program;
@@ -1,27 +1,25 @@
1
1
  import { ObjectPath } from '../values';
2
2
  import ExecutionPathOptions from '../ExecutionPathOptions';
3
3
  import CallOptions from '../CallOptions';
4
- import Scope from '../scopes/Scope';
5
4
  import MagicString from 'magic-string';
6
5
  import { ForEachReturnExpressionCallback, SomeReturnExpressionCallback } from './shared/Expression';
7
6
  import { NodeType } from './NodeType';
8
7
  import { ExpressionNode, NodeBase } from './shared/Node';
9
- import { RenderOptions } from '../../utils/renderHelpers';
8
+ import { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers';
10
9
  export default class ConditionalExpression extends NodeBase {
11
10
  type: NodeType.ConditionalExpression;
12
11
  test: ExpressionNode;
13
12
  alternate: ExpressionNode;
14
13
  consequent: ExpressionNode;
15
- testValue: any;
16
- reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
17
14
  forEachReturnExpressionWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, callback: ForEachReturnExpressionCallback, options: ExecutionPathOptions): void;
18
15
  getValue(): any;
19
16
  hasEffects(options: ExecutionPathOptions): boolean;
20
17
  hasEffectsWhenAccessedAtPath(path: ObjectPath, options: ExecutionPathOptions): boolean;
21
18
  hasEffectsWhenAssignedAtPath(path: ObjectPath, options: ExecutionPathOptions): boolean;
22
19
  hasEffectsWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, options: ExecutionPathOptions): boolean;
23
- initialiseChildren(parentScope: Scope): void;
24
- render(code: MagicString, options: RenderOptions): void;
20
+ includeInBundle(): boolean;
21
+ reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
22
+ render(code: MagicString, options: RenderOptions, {renderedParentType, isCalleeOfRenderedParent}?: NodeRenderOptions): void;
25
23
  someReturnExpressionWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, predicateFunction: SomeReturnExpressionCallback, options: ExecutionPathOptions): boolean;
26
24
  private forEachRelevantBranch(callback);
27
25
  private someRelevantBranch(predicateFunction);
@@ -17,5 +17,4 @@ export default class ExportDefaultDeclaration extends NodeBase {
17
17
  render(code: MagicString, options: RenderOptions, {start, end}?: NodeRenderOptions): void;
18
18
  private renderNamedDeclaration(code, declarationStart, declarationKeyword, needsId, options);
19
19
  private renderVariableDeclaration(code, declarationStart, options);
20
- private renderForSideEffectsOnly(code, declarationStart);
21
20
  }
@@ -7,7 +7,7 @@ import CallOptions from '../CallOptions';
7
7
  import MagicString from 'magic-string';
8
8
  import { ExpressionEntity, ForEachReturnExpressionCallback, SomeReturnExpressionCallback } from './shared/Expression';
9
9
  import { NodeType } from './NodeType';
10
- import { RenderOptions } from '../../utils/renderHelpers';
10
+ import { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers';
11
11
  export declare function isIdentifier(node: Node): node is Identifier;
12
12
  export default class Identifier extends NodeBase {
13
13
  type: NodeType.Identifier;
@@ -24,6 +24,6 @@ export default class Identifier extends NodeBase {
24
24
  reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
25
25
  private disallowImportReassignment();
26
26
  renderSystemBindingUpdate(code: MagicString, name: string): void;
27
- render(code: MagicString, options: RenderOptions): void;
27
+ render(code: MagicString, options: RenderOptions, {renderedParentType, isCalleeOfRenderedParent}?: NodeRenderOptions): void;
28
28
  someReturnExpressionWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, predicateFunction: SomeReturnExpressionCallback, options: ExecutionPathOptions): boolean;
29
29
  }
@@ -2,13 +2,15 @@ import CallExpression from './CallExpression';
2
2
  import { NodeType } from './NodeType';
3
3
  import { NodeBase } from './shared/Node';
4
4
  import MagicString from 'magic-string';
5
- import NamespaceVariable from '../variables/NamespaceVariable';
6
5
  import { RenderOptions } from '../../utils/renderHelpers';
7
6
  export default class Import extends NodeBase {
8
7
  type: NodeType.Import;
9
8
  parent: CallExpression;
10
- private resolution;
9
+ constructor();
10
+ private resolutionNamespace;
11
11
  private resolutionInterop;
12
- setResolution(resolution: NamespaceVariable | string | void, interop: boolean): void;
12
+ private rendered;
13
+ setResolution(interop: boolean, namespace?: string): void;
14
+ renderFinalResolution(code: MagicString, resolution: string): void;
13
15
  render(code: MagicString, options: RenderOptions): void;
14
16
  }
@@ -1,23 +1,27 @@
1
1
  import { ObjectPath } from '../values';
2
2
  import CallOptions from '../CallOptions';
3
3
  import ExecutionPathOptions from '../ExecutionPathOptions';
4
- import { ForEachReturnExpressionCallback, PredicateFunction, SomeReturnExpressionCallback } from './shared/Expression';
4
+ import { ForEachReturnExpressionCallback, SomeReturnExpressionCallback } from './shared/Expression';
5
5
  import { NodeType } from './NodeType';
6
6
  import { ExpressionNode, NodeBase } from './shared/Node';
7
+ import { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers';
8
+ import MagicString from 'magic-string';
7
9
  export declare type LogicalOperator = '||' | '&&';
8
10
  export default class LogicalExpression extends NodeBase {
9
11
  type: NodeType.LogicalExpression;
10
12
  operator: LogicalOperator;
11
13
  left: ExpressionNode;
12
14
  right: ExpressionNode;
13
- reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
14
15
  forEachReturnExpressionWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, callback: ForEachReturnExpressionCallback, options: ExecutionPathOptions): void;
15
16
  getValue(): any;
16
17
  hasEffects(options: ExecutionPathOptions): boolean;
17
18
  hasEffectsWhenAccessedAtPath(path: ObjectPath, options: ExecutionPathOptions): boolean;
18
19
  hasEffectsWhenAssignedAtPath(path: ObjectPath, options: ExecutionPathOptions): boolean;
19
20
  hasEffectsWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, options: ExecutionPathOptions): boolean;
21
+ includeInBundle(): boolean;
22
+ reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
23
+ render(code: MagicString, options: RenderOptions, {renderedParentType, isCalleeOfRenderedParent}?: NodeRenderOptions): void;
20
24
  someReturnExpressionWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, predicateFunction: SomeReturnExpressionCallback, options: ExecutionPathOptions): boolean;
21
- _forEachRelevantBranch(callback: (node: ExpressionNode) => void): void;
22
- _someRelevantBranch(predicateFunction: PredicateFunction): boolean;
25
+ private forEachRelevantBranch(callback);
26
+ private someRelevantBranch(predicateFunction);
23
27
  }
@@ -5,7 +5,7 @@ import CallOptions from '../CallOptions';
5
5
  import MagicString from 'magic-string';
6
6
  import { ForEachReturnExpressionCallback, SomeReturnExpressionCallback } from './shared/Expression';
7
7
  import { NodeType } from './NodeType';
8
- import { RenderOptions } from '../../utils/renderHelpers';
8
+ import { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers';
9
9
  import { ObjectPath, ObjectPathKey } from '../values';
10
10
  export declare function isMemberExpression(node: Node): node is MemberExpression;
11
11
  export default class MemberExpression extends NodeBase {
@@ -29,6 +29,6 @@ export default class MemberExpression extends NodeBase {
29
29
  initialiseNode(): void;
30
30
  reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
31
31
  private disallowNamespaceReassignment();
32
- render(code: MagicString, options: RenderOptions): void;
32
+ render(code: MagicString, options: RenderOptions, {renderedParentType, isCalleeOfRenderedParent}?: NodeRenderOptions): void;
33
33
  someReturnExpressionWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, predicateFunction: SomeReturnExpressionCallback, options: ExecutionPathOptions): boolean;
34
34
  }
@@ -5,6 +5,8 @@ import { ForEachReturnExpressionCallback, SomeReturnExpressionCallback } from '.
5
5
  import { ObjectPath, ObjectPathKey } from '../values';
6
6
  import { Node, NodeBase } from './shared/Node';
7
7
  import { NodeType } from './NodeType';
8
+ import { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers';
9
+ import MagicString from 'magic-string';
8
10
  export declare function isObjectExpression(node: Node): node is ObjectExpression;
9
11
  export default class ObjectExpression extends NodeBase {
10
12
  type: NodeType.ObjectExpression;
@@ -18,5 +20,6 @@ export default class ObjectExpression extends NodeBase {
18
20
  hasEffectsWhenAccessedAtPath(path: ObjectPath, options: ExecutionPathOptions): boolean;
19
21
  hasEffectsWhenAssignedAtPath(path: ObjectPath, options: ExecutionPathOptions): boolean;
20
22
  hasEffectsWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, options: ExecutionPathOptions): boolean;
23
+ render(code: MagicString, options: RenderOptions, {renderedParentType}?: NodeRenderOptions): void;
21
24
  someReturnExpressionWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, predicateFunction: SomeReturnExpressionCallback, options: ExecutionPathOptions): boolean;
22
25
  }
@@ -2,12 +2,20 @@ import ExecutionPathOptions from '../ExecutionPathOptions';
2
2
  import MagicString from 'magic-string';
3
3
  import { ExpressionNode, NodeBase } from './shared/Node';
4
4
  import { NodeType } from './NodeType';
5
- import { RenderOptions } from '../../utils/renderHelpers';
5
+ import { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers';
6
+ import { ObjectPath } from '../values';
7
+ import CallOptions from '../CallOptions';
8
+ import { ForEachReturnExpressionCallback } from './shared/Expression';
6
9
  export default class SequenceExpression extends NodeBase {
7
10
  type: NodeType.SequenceExpression;
8
11
  expressions: ExpressionNode[];
12
+ forEachReturnExpressionWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, callback: ForEachReturnExpressionCallback, options: ExecutionPathOptions): void;
9
13
  getValue(): any;
10
14
  hasEffects(options: ExecutionPathOptions): boolean;
15
+ hasEffectsWhenAccessedAtPath(path: ObjectPath, options: ExecutionPathOptions): boolean;
16
+ hasEffectsWhenAssignedAtPath(path: ObjectPath, options: ExecutionPathOptions): boolean;
17
+ hasEffectsWhenCalledAtPath(path: ObjectPath, callOptions: CallOptions, options: ExecutionPathOptions): boolean;
11
18
  includeInBundle(): boolean;
12
- render(code: MagicString, options: RenderOptions): void;
19
+ reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
20
+ render(code: MagicString, options: RenderOptions, {renderedParentType, isCalleeOfRenderedParent}?: NodeRenderOptions): void;
13
21
  }
@@ -1,6 +1,5 @@
1
1
  import Variable from './Variable';
2
2
  import { ObjectPath } from '../values';
3
- export declare function isGlobalVariable(variable: Variable): variable is GlobalVariable;
4
3
  export default class GlobalVariable extends Variable {
5
4
  isExternal: true;
6
5
  isGlobal: true;
@@ -0,0 +1,3 @@
1
+ import Chunk from './Chunk';
2
+ import { OutputOptions } from './rollup';
3
+ export declare function optimizeChunks(chunks: Chunk[], options: OutputOptions, CHUNK_GROUPING_SIZE: number): Chunk[];
@@ -1,11 +1,4 @@
1
- import Chunk from '../Chunk';
2
1
  import { Bundle as MagicStringBundle } from 'magic-string';
3
2
  import { OutputOptions } from '../rollup/index';
4
- export default function amd(chunk: Chunk, magicString: MagicStringBundle, {exportMode, getPath, indentString, intro, outro, dynamicImport}: {
5
- exportMode: string;
6
- indentString: string;
7
- getPath: (name: string) => string;
8
- intro: string;
9
- outro: string;
10
- dynamicImport: boolean;
11
- }, options: OutputOptions): MagicStringBundle;
3
+ import { FinaliserOptions } from './index';
4
+ export default function amd(magicString: MagicStringBundle, {graph, exportMode, indentString, intro, outro, dynamicImport, dependencies, exports, isEntryModuleFacade}: FinaliserOptions, options: OutputOptions): MagicStringBundle;
@@ -1,10 +1,4 @@
1
1
  import { OutputOptions } from '../rollup/index';
2
2
  import { Bundle as MagicStringBundle } from 'magic-string';
3
- import Chunk from '../Chunk';
4
- export default function cjs(chunk: Chunk, magicString: MagicStringBundle, {exportMode, getPath, intro, outro}: {
5
- exportMode: string;
6
- indentString: string;
7
- getPath: (name: string) => string;
8
- intro: string;
9
- outro: string;
10
- }, options: OutputOptions): MagicStringBundle;
3
+ import { FinaliserOptions } from './index';
4
+ export default function cjs(magicString: MagicStringBundle, {graph, isEntryModuleFacade, exportMode, intro, outro, dependencies, exports}: FinaliserOptions, options: OutputOptions): MagicStringBundle;
@@ -1,9 +1,3 @@
1
1
  import { Bundle as MagicStringBundle } from 'magic-string';
2
- import Chunk from '../Chunk';
3
- export default function es(chunk: Chunk, magicString: MagicStringBundle, {getPath, intro, outro}: {
4
- exportMode: string;
5
- indentString: string;
6
- getPath: (name: string) => string;
7
- intro: string;
8
- outro: string;
9
- }): MagicStringBundle;
2
+ import { FinaliserOptions } from './index';
3
+ export default function es(magicString: MagicStringBundle, {intro, outro, dependencies, exports}: FinaliserOptions): MagicStringBundle;
@@ -1,10 +1,4 @@
1
- import Chunk from '../Chunk';
2
1
  import { Bundle as MagicStringBundle } from 'magic-string';
3
2
  import { OutputOptions } from '../rollup/index';
4
- export default function iife(chunk: Chunk, magicString: MagicStringBundle, {exportMode, indentString, intro, outro}: {
5
- exportMode: string;
6
- indentString: string;
7
- getPath: (name: string) => string;
8
- intro: string;
9
- outro: string;
10
- }, options: OutputOptions): MagicStringBundle;
3
+ import { FinaliserOptions } from './index';
4
+ export default function iife(magicString: MagicStringBundle, {graph, exportMode, indentString, intro, outro, dependencies, exports}: FinaliserOptions, options: OutputOptions): MagicStringBundle;
@@ -1,14 +1,19 @@
1
- import Chunk from '../Chunk';
1
+ import { ChunkDependencies, ChunkExports } from '../Chunk';
2
2
  import { Bundle as MagicStringBundle } from 'magic-string';
3
3
  import { OutputOptions } from '../rollup/index';
4
- export declare type Finaliser = (chunk: Chunk, magicString: MagicStringBundle, {exportMode, getPath, indentString, intro, outro}: {
4
+ import Graph from '../Graph';
5
+ export interface FinaliserOptions {
5
6
  exportMode: string;
6
7
  indentString: string;
7
- getPath: (name: string) => string;
8
8
  intro: string;
9
9
  outro: string;
10
10
  dynamicImport: boolean;
11
- }, options: OutputOptions) => MagicStringBundle;
11
+ dependencies: ChunkDependencies;
12
+ exports: ChunkExports;
13
+ graph: Graph;
14
+ isEntryModuleFacade: boolean;
15
+ }
16
+ export declare type Finaliser = (magicString: MagicStringBundle, finaliserOptions: FinaliserOptions, options: OutputOptions) => MagicStringBundle;
12
17
  declare const _default: {
13
18
  [format: string]: Finaliser;
14
19
  };
@@ -1,2 +1,3 @@
1
- import Chunk from '../../Chunk';
2
- export default function warnOnBuiltins(chunk: Chunk): void;
1
+ import { ChunkDependencies } from '../../Chunk';
2
+ import Graph from '../../Graph';
3
+ export default function warnOnBuiltins(graph: Graph, dependencies: ChunkDependencies): void;
@@ -1,8 +1,3 @@
1
- import Chunk from '../Chunk';
2
1
  import { Bundle as MagicStringBundle } from 'magic-string';
3
- export default function system(chunk: Chunk, magicString: MagicStringBundle, {getPath, indentString: t, intro, outro}: {
4
- indentString: string;
5
- getPath: (name: string) => string;
6
- intro: string;
7
- outro: string;
8
- }): MagicStringBundle;
2
+ import { FinaliserOptions } from './index';
3
+ export default function system(magicString: MagicStringBundle, {graph, indentString: t, intro, outro, dependencies, exports}: FinaliserOptions): MagicStringBundle;
@@ -1,10 +1,4 @@
1
- import Chunk from '../Chunk';
2
1
  import { Bundle as MagicStringBundle } from 'magic-string';
3
2
  import { OutputOptions } from '../rollup/index';
4
- export default function umd(chunk: Chunk, magicString: MagicStringBundle, {exportMode, indentString, getPath, intro, outro}: {
5
- exportMode: string;
6
- indentString: string;
7
- getPath: (name: string) => string;
8
- intro: string;
9
- outro: string;
10
- }, options: OutputOptions): MagicStringBundle;
3
+ import { FinaliserOptions } from './index';
4
+ export default function umd(magicString: MagicStringBundle, {graph, exportMode, indentString, intro, outro, dependencies, exports}: FinaliserOptions, options: OutputOptions): MagicStringBundle;
@@ -1,4 +1,5 @@
1
1
  import { SerializedTimings } from '../utils/timers';
2
+ import { GenericConfigObject } from '../utils/mergeOptions';
2
3
  import { ModuleJSON } from '../Module';
3
4
  import { RawSourceMap } from 'source-map';
4
5
  import Program from '../ast/nodes/Program';
@@ -43,20 +44,19 @@ export declare type ExternalOption = string[] | IsExternalHook;
43
44
  export declare type GlobalsOption = {
44
45
  [name: string]: string;
45
46
  } | ((name: string) => string);
46
- export declare type CachedChunk = {
47
- modules: ModuleJSON[];
48
- };
49
- export declare type CachedChunkSet = {
50
- chunks: {
51
- [chunkName: string]: CachedChunk;
52
- };
53
- };
54
47
  export interface InputOptions {
55
- input: string | string[];
48
+ input: string | string[] | {
49
+ [entryAlias: string]: string;
50
+ };
51
+ manualChunks?: {
52
+ [chunkAlias: string]: string[];
53
+ };
56
54
  external?: ExternalOption;
57
55
  plugins?: Plugin[];
58
56
  onwarn?: WarningHandler;
59
- cache?: CachedChunk | CachedChunkSet;
57
+ cache?: {
58
+ modules: ModuleJSON[];
59
+ };
60
60
  acorn?: {};
61
61
  acornInjectPlugins?: Function[];
62
62
  treeshake?: boolean | TreeshakingOptions;
@@ -64,12 +64,13 @@ export interface InputOptions {
64
64
  moduleContext?: string | ((id: string) => string) | {
65
65
  [id: string]: string;
66
66
  };
67
- legacy?: boolean;
68
67
  watch?: WatcherOptions;
69
68
  experimentalDynamicImport?: boolean;
70
69
  experimentalCodeSplitting?: boolean;
71
70
  preserveSymlinks?: boolean;
72
71
  experimentalPreserveModules?: boolean;
72
+ optimizeChunks?: boolean;
73
+ chunkGroupingSize?: number;
73
74
  pureExternalModules?: boolean;
74
75
  preferConst?: boolean;
75
76
  perf?: boolean;
@@ -80,13 +81,16 @@ export interface InputOptions {
80
81
  resolveExternal?: any;
81
82
  }
82
83
  export declare type ModuleFormat = 'amd' | 'cjs' | 'system' | 'es' | 'es6' | 'iife' | 'umd';
84
+ export declare type OptionsPaths = Record<string, string> | ((id: string) => string);
83
85
  export interface OutputOptions {
84
86
  file?: string;
85
87
  dir?: string;
86
88
  format?: ModuleFormat;
87
89
  name?: string;
88
90
  globals?: GlobalsOption;
89
- paths?: Record<string, string> | ((id: string, parent: string) => string);
91
+ chunkNames?: string;
92
+ entryNames?: string;
93
+ paths?: OptionsPaths;
90
94
  banner?: string;
91
95
  footer?: string;
92
96
  intro?: string;
@@ -140,29 +144,33 @@ export interface RollupWarning {
140
144
  }
141
145
  export declare type WarningHandler = (warning: string | RollupWarning) => void;
142
146
  export interface OutputChunk {
147
+ imports: string[];
148
+ exports: string[];
149
+ modules: string[];
150
+ code: string;
151
+ map?: SourceMap;
152
+ }
153
+ export interface Bundle {
143
154
  imports: string[];
144
155
  exports: string[];
145
156
  modules: ModuleJSON[];
146
- generate: (outputOptions: OutputOptions) => Promise<{
147
- code: string;
148
- map: SourceMap;
149
- }>;
150
- write: (options: OutputOptions) => Promise<void>;
157
+ cache: {
158
+ modules: ModuleJSON[];
159
+ };
160
+ generate: (outputOptions: OutputOptions) => Promise<OutputChunk>;
161
+ write: (options: OutputOptions) => Promise<OutputChunk>;
151
162
  getTimings?: () => SerializedTimings;
152
163
  }
153
- export interface OutputChunkSet {
154
- chunks: {
155
- [chunkName: string]: {
156
- name: string;
157
- imports: string[];
158
- exports: string[];
159
- modules: ModuleJSON[];
160
- };
164
+ export interface BundleSet {
165
+ cache: {
166
+ modules: ModuleJSON[];
161
167
  };
162
168
  generate: (outputOptions: OutputOptions) => Promise<{
163
- [chunkName: string]: SourceDescription;
169
+ [chunkName: string]: OutputChunk;
170
+ }>;
171
+ write: (options: OutputOptions) => Promise<{
172
+ [chunkName: string]: OutputChunk;
164
173
  }>;
165
- write: (options: OutputOptions) => Promise<void>;
166
174
  getTimings?: () => SerializedTimings;
167
175
  }
168
- export default function rollup(rawInputOptions: InputOptions): Promise<OutputChunk | OutputChunkSet>;
176
+ export default function rollup(rawInputOptions: GenericConfigObject | InputOptions): Promise<Bundle | BundleSet>;
@@ -0,0 +1,10 @@
1
+ import Graph from '../Graph';
2
+ import { OutputOptions } from '../rollup';
3
+ export interface Addons {
4
+ intro?: string;
5
+ outro?: string;
6
+ banner?: string;
7
+ footer?: string;
8
+ hash: Uint8Array;
9
+ }
10
+ export declare function createAddons(graph: Graph, options: OutputOptions): Promise<Addons>;
@@ -0,0 +1 @@
1
+ export declare const BLANK: any;
@@ -1,5 +1,5 @@
1
1
  import Module from '../Module';
2
2
  import { RawSourceMap } from 'source-map';
3
3
  import Chunk from '../Chunk';
4
- import { SourceMap } from 'magic-string';
5
- export default function collapseSourcemaps(bundle: Chunk, file: string, map: SourceMap, modules: Module[], bundleSourcemapChain: RawSourceMap[]): SourceMap;
4
+ import { SourceMap, DecodedSourceMap } from 'magic-string';
5
+ export default function collapseSourcemaps(bundle: Chunk, file: string, map: DecodedSourceMap, modules: Module[], bundleSourcemapChain: RawSourceMap[]): SourceMap;
@@ -1,6 +1,6 @@
1
1
  import Module from '../Module';
2
2
  import { InputOptions } from '../rollup';
3
3
  export declare function load(id: string): string;
4
- export declare function resolveId(options: InputOptions): (importee: string, importer: string) => string | void;
4
+ export declare function resolveId(options: InputOptions): (importee: string, importer: string) => string;
5
5
  export declare function makeOnwarn(): (warning: any) => void;
6
6
  export declare function handleMissingExport(exportName: string, importingModule: Module, importedModule: string, importerStart?: number): void;
@@ -3,7 +3,10 @@ import { WarningHandler } from '../rollup/index';
3
3
  export declare type GenericConfigObject = {
4
4
  [key: string]: any;
5
5
  };
6
- export default function mergeOptions({config, command, deprecateConfig, defaultOnWarnHandler}: {
6
+ export declare const commandAliases: {
7
+ [key: string]: string;
8
+ };
9
+ export default function mergeOptions({config, command: rawCommandOptions, deprecateConfig, defaultOnWarnHandler}: {
7
10
  config: GenericConfigObject;
8
11
  command?: GenericConfigObject;
9
12
  deprecateConfig?: GenericConfigObject;