rollup 0.55.1 → 0.55.5

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 (189) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +40 -4
  3. package/bin/rollup +13 -4
  4. package/dist/rollup.browser.js +134 -79
  5. package/dist/rollup.es.js +135 -80
  6. package/dist/rollup.js +136 -81
  7. package/dist/typings/Chunk.d.ts +4 -0
  8. package/dist/typings/Graph.d.ts +1 -2
  9. package/dist/typings/rollup/index.d.ts +1 -0
  10. package/dist/typings/utils/defaults.d.ts +2 -1
  11. package/dist/typings/utils/renderHelpers.d.ts +12 -0
  12. package/dist/typings/watch/index.d.ts +1 -1
  13. package/package.json +10 -5
  14. package/dist/typings/Bundle.d.ts +0 -29
  15. package/dist/typings/ast/Node.d.ts +0 -185
  16. package/dist/typings/ast/nodes/Declaration.d.ts +0 -8
  17. package/dist/typings/ast/nodes/Expression.d.ts +0 -46
  18. package/dist/typings/ast/nodes/Pattern.d.ts +0 -12
  19. package/dist/typings/ast/nodes/Statement.d.ts +0 -10
  20. package/dist/typings/ast/nodes/shared/VirtualObjectExpression.d.ts +0 -7
  21. package/dist/typings/ast/nodes/shared/disallowIllegalReassignment.d.ts +0 -6
  22. package/dist/typings/bin/src/index.d.ts +0 -1
  23. package/dist/typings/bin/src/logging.d.ts +0 -3
  24. package/dist/typings/bin/src/run/alternateScreen.d.ts +0 -8
  25. package/dist/typings/bin/src/run/batchWarnings.d.ts +0 -11
  26. package/dist/typings/bin/src/run/build.d.ts +0 -9
  27. package/dist/typings/bin/src/run/index.d.ts +0 -1
  28. package/dist/typings/bin/src/run/loadConfigFile.d.ts +0 -6
  29. package/dist/typings/bin/src/run/watch.d.ts +0 -8
  30. package/dist/typings/bin/src/sourceMappingUrl.d.ts +0 -2
  31. package/dist/typings/bin/src/utils/sequence.d.ts +0 -4
  32. package/dist/typings/browser/fs.d.ts +0 -5
  33. package/dist/typings/browser/path.d.ts +0 -10
  34. package/dist/typings/src/Bundle.d.ts +0 -29
  35. package/dist/typings/src/ExternalModule.d.ts +0 -23
  36. package/dist/typings/src/Graph.d.ts +0 -60
  37. package/dist/typings/src/Module.d.ts +0 -137
  38. package/dist/typings/src/ast/CallOptions.d.ts +0 -24
  39. package/dist/typings/src/ast/Entity.d.ts +0 -19
  40. package/dist/typings/src/ast/ExecutionPathOptions.d.ts +0 -97
  41. package/dist/typings/src/ast/Node.d.ts +0 -186
  42. package/dist/typings/src/ast/clone.d.ts +0 -1
  43. package/dist/typings/src/ast/comment.d.ts +0 -4
  44. package/dist/typings/src/ast/enhance.d.ts +0 -7
  45. package/dist/typings/src/ast/keys.d.ts +0 -4
  46. package/dist/typings/src/ast/nodes/ArrayExpression.d.ts +0 -9
  47. package/dist/typings/src/ast/nodes/ArrayPattern.d.ts +0 -21
  48. package/dist/typings/src/ast/nodes/ArrowFunctionExpression.d.ts +0 -48
  49. package/dist/typings/src/ast/nodes/AssignmentExpression.d.ts +0 -16
  50. package/dist/typings/src/ast/nodes/AssignmentPattern.d.ts +0 -23
  51. package/dist/typings/src/ast/nodes/AssignmentProperty.d.ts +0 -10
  52. package/dist/typings/src/ast/nodes/AwaitExpression.d.ts +0 -8
  53. package/dist/typings/src/ast/nodes/BinaryExpression.d.ts +0 -38
  54. package/dist/typings/src/ast/nodes/BlockStatement.d.ts +0 -19
  55. package/dist/typings/src/ast/nodes/BreakStatement.d.ts +0 -9
  56. package/dist/typings/src/ast/nodes/CallExpression.d.ts +0 -45
  57. package/dist/typings/src/ast/nodes/CatchClause.d.ts +0 -14
  58. package/dist/typings/src/ast/nodes/ClassBody.d.ts +0 -17
  59. package/dist/typings/src/ast/nodes/ClassDeclaration.d.ts +0 -11
  60. package/dist/typings/src/ast/nodes/ClassExpression.d.ts +0 -10
  61. package/dist/typings/src/ast/nodes/ConditionalExpression.d.ts +0 -50
  62. package/dist/typings/src/ast/nodes/Declaration.d.ts +0 -8
  63. package/dist/typings/src/ast/nodes/DoWhileStatement.d.ts +0 -10
  64. package/dist/typings/src/ast/nodes/EmptyStatement.d.ts +0 -7
  65. package/dist/typings/src/ast/nodes/ExportAllDeclaration.d.ts +0 -11
  66. package/dist/typings/src/ast/nodes/ExportDefaultDeclaration.d.ts +0 -18
  67. package/dist/typings/src/ast/nodes/ExportNamedDeclaration.d.ts +0 -24
  68. package/dist/typings/src/ast/nodes/ExportSpecifier.d.ts +0 -8
  69. package/dist/typings/src/ast/nodes/Expression.d.ts +0 -46
  70. package/dist/typings/src/ast/nodes/ExpressionStatement.d.ts +0 -5
  71. package/dist/typings/src/ast/nodes/ForInStatement.d.ts +0 -17
  72. package/dist/typings/src/ast/nodes/ForOfStatement.d.ts +0 -18
  73. package/dist/typings/src/ast/nodes/ForStatement.d.ts +0 -16
  74. package/dist/typings/src/ast/nodes/FunctionDeclaration.d.ts +0 -9
  75. package/dist/typings/src/ast/nodes/FunctionExpression.d.ts +0 -6
  76. package/dist/typings/src/ast/nodes/Identifier.d.ts +0 -56
  77. package/dist/typings/src/ast/nodes/IfStatement.d.ts +0 -15
  78. package/dist/typings/src/ast/nodes/Import.d.ts +0 -20
  79. package/dist/typings/src/ast/nodes/ImportDeclaration.d.ts +0 -19
  80. package/dist/typings/src/ast/nodes/ImportDefaultSpecifier.d.ts +0 -7
  81. package/dist/typings/src/ast/nodes/ImportNamespaceSpecifier.d.ts +0 -7
  82. package/dist/typings/src/ast/nodes/ImportSpecifier.d.ts +0 -8
  83. package/dist/typings/src/ast/nodes/LabeledStatement.d.ts +0 -10
  84. package/dist/typings/src/ast/nodes/Literal.d.ts +0 -22
  85. package/dist/typings/src/ast/nodes/LogicalExpression.d.ts +0 -47
  86. package/dist/typings/src/ast/nodes/MemberExpression.d.ts +0 -61
  87. package/dist/typings/src/ast/nodes/MethodDefinition.d.ts +0 -20
  88. package/dist/typings/src/ast/nodes/NewExpression.d.ts +0 -17
  89. package/dist/typings/src/ast/nodes/ObjectExpression.d.ts +0 -52
  90. package/dist/typings/src/ast/nodes/ObjectPattern.d.ts +0 -22
  91. package/dist/typings/src/ast/nodes/Pattern.d.ts +0 -12
  92. package/dist/typings/src/ast/nodes/Program.d.ts +0 -7
  93. package/dist/typings/src/ast/nodes/Property.d.ts +0 -57
  94. package/dist/typings/src/ast/nodes/RestElement.d.ts +0 -21
  95. package/dist/typings/src/ast/nodes/ReturnStatement.d.ts +0 -10
  96. package/dist/typings/src/ast/nodes/SequenceExpression.d.ts +0 -12
  97. package/dist/typings/src/ast/nodes/SpreadElement.d.ts +0 -6
  98. package/dist/typings/src/ast/nodes/Statement.d.ts +0 -10
  99. package/dist/typings/src/ast/nodes/SwitchCase.d.ts +0 -9
  100. package/dist/typings/src/ast/nodes/SwitchStatement.d.ts +0 -13
  101. package/dist/typings/src/ast/nodes/TaggedTemplateExpression.d.ts +0 -13
  102. package/dist/typings/src/ast/nodes/TemplateElement.d.ts +0 -12
  103. package/dist/typings/src/ast/nodes/TemplateLiteral.d.ts +0 -10
  104. package/dist/typings/src/ast/nodes/ThisExpression.d.ts +0 -22
  105. package/dist/typings/src/ast/nodes/ThrowStatement.d.ts +0 -9
  106. package/dist/typings/src/ast/nodes/UnaryExpression.d.ts +0 -19
  107. package/dist/typings/src/ast/nodes/UnknownNode.d.ts +0 -5
  108. package/dist/typings/src/ast/nodes/UpdateExpression.d.ts +0 -16
  109. package/dist/typings/src/ast/nodes/VariableDeclaration.d.ts +0 -23
  110. package/dist/typings/src/ast/nodes/VariableDeclarator.d.ts +0 -15
  111. package/dist/typings/src/ast/nodes/WhileStatement.d.ts +0 -10
  112. package/dist/typings/src/ast/nodes/YieldExpression.d.ts +0 -9
  113. package/dist/typings/src/ast/nodes/index.d.ts +0 -69
  114. package/dist/typings/src/ast/nodes/shared/ClassNode.d.ts +0 -27
  115. package/dist/typings/src/ast/nodes/shared/Expression.d.ts +0 -42
  116. package/dist/typings/src/ast/nodes/shared/FunctionNode.d.ts +0 -42
  117. package/dist/typings/src/ast/nodes/shared/Node.d.ts +0 -169
  118. package/dist/typings/src/ast/nodes/shared/Pattern.d.ts +0 -3
  119. package/dist/typings/src/ast/nodes/shared/Statement.d.ts +0 -6
  120. package/dist/typings/src/ast/nodes/shared/VirtualObjectExpression.d.ts +0 -7
  121. package/dist/typings/src/ast/nodes/shared/disallowIllegalReassignment.d.ts +0 -6
  122. package/dist/typings/src/ast/nodes/shared/pureFunctions.d.ts +0 -4
  123. package/dist/typings/src/ast/scopes/BlockScope.d.ts +0 -12
  124. package/dist/typings/src/ast/scopes/CatchScope.d.ts +0 -13
  125. package/dist/typings/src/ast/scopes/FunctionScope.d.ts +0 -27
  126. package/dist/typings/src/ast/scopes/GlobalScope.d.ts +0 -6
  127. package/dist/typings/src/ast/scopes/ModuleScope.d.ts +0 -11
  128. package/dist/typings/src/ast/scopes/ParameterScope.d.ts +0 -16
  129. package/dist/typings/src/ast/scopes/ReturnValueScope.d.ts +0 -24
  130. package/dist/typings/src/ast/scopes/Scope.d.ts +0 -49
  131. package/dist/typings/src/ast/utils/extractNames.d.ts +0 -2
  132. package/dist/typings/src/ast/values.d.ts +0 -5
  133. package/dist/typings/src/ast/variables/ArgumentsVariable.d.ts +0 -30
  134. package/dist/typings/src/ast/variables/ExportDefaultVariable.d.ts +0 -19
  135. package/dist/typings/src/ast/variables/ExternalVariable.d.ts +0 -17
  136. package/dist/typings/src/ast/variables/GlobalVariable.d.ts +0 -12
  137. package/dist/typings/src/ast/variables/LocalVariable.d.ts +0 -51
  138. package/dist/typings/src/ast/variables/NamespaceVariable.d.ts +0 -23
  139. package/dist/typings/src/ast/variables/ParameterVariable.d.ts +0 -6
  140. package/dist/typings/src/ast/variables/ReplaceableInitializationVariable.d.ts +0 -33
  141. package/dist/typings/src/ast/variables/ThisVariable.d.ts +0 -4
  142. package/dist/typings/src/ast/variables/Variable.d.ts +0 -63
  143. package/dist/typings/src/ast/variables/VariableReassignmentTracker.d.ts +0 -25
  144. package/dist/typings/src/banner.d.ts +0 -0
  145. package/dist/typings/src/browser-entry.d.ts +0 -2
  146. package/dist/typings/src/finalisers/amd.d.ts +0 -21
  147. package/dist/typings/src/finalisers/cjs.d.ts +0 -20
  148. package/dist/typings/src/finalisers/es.d.ts +0 -17
  149. package/dist/typings/src/finalisers/iife.d.ts +0 -20
  150. package/dist/typings/src/finalisers/index.d.ts +0 -25
  151. package/dist/typings/src/finalisers/shared/esModuleExport.d.ts +0 -2
  152. package/dist/typings/src/finalisers/shared/getExportBlock.d.ts +0 -6
  153. package/dist/typings/src/finalisers/shared/getGlobalNameMaker.d.ts +0 -9
  154. package/dist/typings/src/finalisers/shared/getInteropBlock.d.ts +0 -6
  155. package/dist/typings/src/finalisers/shared/sanitize.d.ts +0 -2
  156. package/dist/typings/src/finalisers/shared/setupNamespace.d.ts +0 -7
  157. package/dist/typings/src/finalisers/shared/trimEmptyImports.d.ts +0 -5
  158. package/dist/typings/src/finalisers/shared/warnOnBuiltins.d.ts +0 -2
  159. package/dist/typings/src/finalisers/umd.d.ts +0 -21
  160. package/dist/typings/src/node-entry.d.ts +0 -5
  161. package/dist/typings/src/rollup/index.d.ts +0 -172
  162. package/dist/typings/src/utils/array.d.ts +0 -4
  163. package/dist/typings/src/utils/callIfFunction.d.ts +0 -1
  164. package/dist/typings/src/utils/collapseSourcemaps.d.ts +0 -11
  165. package/dist/typings/src/utils/defaults.d.ts +0 -6
  166. package/dist/typings/src/utils/deprecateOptions.d.ts +0 -9
  167. package/dist/typings/src/utils/dynamic-import-plugin.d.ts +0 -8
  168. package/dist/typings/src/utils/ensureArray.d.ts +0 -2
  169. package/dist/typings/src/utils/error.d.ts +0 -18
  170. package/dist/typings/src/utils/first.d.ts +0 -3
  171. package/dist/typings/src/utils/flushTime.d.ts +0 -5
  172. package/dist/typings/src/utils/fs.d.ts +0 -6
  173. package/dist/typings/src/utils/getCodeFrame.d.ts +0 -5
  174. package/dist/typings/src/utils/getExportMode.d.ts +0 -6
  175. package/dist/typings/src/utils/getIndentString.d.ts +0 -7
  176. package/dist/typings/src/utils/identifierHelpers.d.ts +0 -3
  177. package/dist/typings/src/utils/mergeOptions.d.ts +0 -21
  178. package/dist/typings/src/utils/object.d.ts +0 -9
  179. package/dist/typings/src/utils/path.d.ts +0 -6
  180. package/dist/typings/src/utils/promise.d.ts +0 -5
  181. package/dist/typings/src/utils/relativeId.d.ts +0 -1
  182. package/dist/typings/src/utils/sourceMappingURL.d.ts +0 -3
  183. package/dist/typings/src/utils/transform.d.ts +0 -16
  184. package/dist/typings/src/utils/transformBundle.d.ts +0 -8
  185. package/dist/typings/src/watch/chokidar.d.ts +0 -4
  186. package/dist/typings/src/watch/fileWatchers.d.ts +0 -23
  187. package/dist/typings/src/watch/index.d.ts +0 -48
  188. package/dist/typings/utils/array.d.ts +0 -4
  189. package/dist/typings/utils/dynamic-import-plugin.d.ts +0 -13
@@ -1,169 +0,0 @@
1
- /// <reference path="../../../../../../src/ast/nodes/shared/Node.d.ts" />
2
- import ExecutionPathOptions from "../../ExecutionPathOptions";
3
- import Scope from "../../scopes/Scope";
4
- import Module from "../../../Module";
5
- import MagicString from "magic-string";
6
- import Variable from "../../variables/Variable";
7
- import {
8
- ExpressionEntity,
9
- ForEachReturnExpressionCallback,
10
- SomeReturnExpressionCallback
11
- } from "./Expression";
12
- import { ObjectPath } from "../../variables/VariableReassignmentTracker";
13
- import CallOptions from "../../CallOptions";
14
- import { Entity } from "../../Entity";
15
- export interface Node extends Entity {
16
- end: number;
17
- included: boolean;
18
- keys: string[];
19
- leadingCommentStart: number;
20
- module: Module;
21
- next: number;
22
- parent:
23
- | Node
24
- | {
25
- type?: string;
26
- };
27
- start: number;
28
- type: string;
29
- variable?: Variable;
30
- __enhanced: boolean;
31
- /**
32
- * Called once all nodes have been initialised and the scopes have been populated.
33
- * Usually one should not override this function but override bindNode and/or
34
- * bindChildren instead.
35
- */
36
- bind(): void;
37
- eachChild(callback: (node: Node) => void): void;
38
- /**
39
- * Determine if this Node would have an effect on the bundle.
40
- * This is usually true for already included nodes. Exceptions are e.g. break statements
41
- * which only have an effect if their surrounding loop or switch statement is included.
42
- * The options pass on information like this about the current execution path.
43
- */
44
- hasEffects(options: ExecutionPathOptions): boolean;
45
- /**
46
- * Includes the node in the bundle. Children are usually included if they are
47
- * necessary for this node (e.g. a function body) or if they have effects.
48
- * Necessary variables need to be included as well. Should return true if any
49
- * nodes or variables have been added that were missing before.
50
- */
51
- includeInBundle(): boolean;
52
- /**
53
- * Alternative version of includeInBundle to override the default behaviour of
54
- * declarations to only include nodes for declarators that have an effect. Necessary
55
- * for for-loops that do not use a declared loop variable.
56
- */
57
- includeWithAllDeclarations(): boolean;
58
- /**
59
- * Assign a scope to this node and make sure all children have the right scopes.
60
- * Perform any additional initialisation that does not depend on the scope being
61
- * populated with variables.
62
- * Usually one should not override this function but override initialiseScope,
63
- * initialiseNode and/or initialiseChildren instead. BlockScopes have a special
64
- * alternative initialisation initialiseAndReplaceScope.
65
- */
66
- initialise(parentScope: Scope): void;
67
- initialiseAndDeclare(
68
- parentScope: Scope,
69
- kind: string,
70
- init: ExpressionEntity | null
71
- ): void;
72
- render(code: MagicString, es: boolean): void;
73
- /**
74
- * Start a new execution path to determine if this node has an effect on the bundle and
75
- * should therefore be included. Included nodes should always be included again in subsequent
76
- * visits as the inclusion of additional variables may require the inclusion of more child
77
- * nodes in e.g. block statements.
78
- */
79
- shouldBeIncluded(): boolean;
80
- someChild(callback: (node: Node) => boolean): boolean;
81
- }
82
- export interface ExpressionNode extends ExpressionEntity, Node {}
83
- export declare class NodeBase implements ExpressionNode {
84
- type: string;
85
- keys: string[];
86
- included: boolean;
87
- scope: Scope;
88
- start: number;
89
- end: number;
90
- leadingCommentStart: number;
91
- trailingCommentEnd: number;
92
- next: number;
93
- module: Module;
94
- parent:
95
- | Node
96
- | {
97
- type?: string;
98
- };
99
- __enhanced: boolean;
100
- constructor();
101
- bind(): void;
102
- /**
103
- * Override to control on which children "bind" is called.
104
- */
105
- bindChildren(): void;
106
- /**
107
- * Override this to bind assignments to variables and do any initialisations that
108
- * require the scopes to be populated with variables.
109
- */
110
- bindNode(): void;
111
- eachChild(callback: (node: Node) => void): void;
112
- forEachReturnExpressionWhenCalledAtPath(
113
- _path: ObjectPath,
114
- _callOptions: CallOptions,
115
- _callback: ForEachReturnExpressionCallback,
116
- _options: ExecutionPathOptions
117
- ): void;
118
- getValue(): {
119
- toString: () => string;
120
- };
121
- hasEffects(options: ExecutionPathOptions): boolean;
122
- hasEffectsWhenAccessedAtPath(
123
- path: ObjectPath,
124
- _options: ExecutionPathOptions
125
- ): boolean;
126
- hasEffectsWhenAssignedAtPath(
127
- _path: ObjectPath,
128
- _options: ExecutionPathOptions
129
- ): boolean;
130
- hasEffectsWhenCalledAtPath(
131
- _path: ObjectPath,
132
- _callOptions: CallOptions,
133
- _options: ExecutionPathOptions
134
- ): boolean;
135
- private hasIncludedChild();
136
- includeInBundle(): boolean;
137
- includeWithAllDeclarations(): boolean;
138
- initialise(parentScope: Scope): void;
139
- initialiseAndDeclare(
140
- _parentScope: Scope,
141
- _kind: string,
142
- _init: ExpressionEntity | null
143
- ): void;
144
- /**
145
- * Override to change how and with what scopes children are initialised
146
- */
147
- initialiseChildren(_parentScope: Scope): void;
148
- /**
149
- * Override to perform special initialisation steps after the scope is initialised
150
- */
151
- initialiseNode(_parentScope: Scope): void;
152
- /**
153
- * Override if this scope should receive a different scope than the parent scope.
154
- */
155
- initialiseScope(parentScope: Scope): void;
156
- insertSemicolon(code: MagicString): void;
157
- locate(): any;
158
- reassignPath(_path: ObjectPath, _options: ExecutionPathOptions): void;
159
- render(code: MagicString, es: boolean): void;
160
- shouldBeIncluded(): boolean;
161
- someChild(callback: (node: NodeBase) => boolean): boolean;
162
- someReturnExpressionWhenCalledAtPath(
163
- _path: ObjectPath,
164
- _callOptions: CallOptions,
165
- predicateFunction: SomeReturnExpressionCallback,
166
- options: ExecutionPathOptions
167
- ): boolean;
168
- toString(): string;
169
- }
@@ -1,3 +0,0 @@
1
- import { WritableEntity } from "../../Entity";
2
- import { Node } from "./Node";
3
- export interface PatternNode extends WritableEntity, Node {}
@@ -1,6 +0,0 @@
1
- import { NodeBase, Node } from "./Node";
2
- import MagicString from "magic-string";
3
- export interface StatementNode extends Node {}
4
- export declare class StatementBase extends NodeBase implements StatementNode {
5
- render(code: MagicString, es: boolean): void;
6
- }
@@ -1,7 +0,0 @@
1
- import Node from "../../Node";
2
- import { ObjectPath } from "../../variables/VariableReassignmentTracker";
3
- export default class VirtualObjectExpression extends Node {
4
- hasEffectsWhenAccessedAtPath(path: ObjectPath): boolean;
5
- hasEffectsWhenAssignedAtPath(path: ObjectPath): boolean;
6
- toString(): string;
7
- }
@@ -1,6 +0,0 @@
1
- import Scope from "../../scopes/Scope";
2
- import Node from "../../Node";
3
- export default function disallowIllegalReassignment(
4
- scope: Scope,
5
- node: Node
6
- ): void;
@@ -1,4 +0,0 @@
1
- declare const pureFunctions: {
2
- [name: string]: boolean;
3
- };
4
- export default pureFunctions;
@@ -1,12 +0,0 @@
1
- import Scope from "./Scope";
2
- import Identifier from "../nodes/Identifier";
3
- import LocalVariable from "../variables/LocalVariable";
4
- export default class BlockScope extends Scope {
5
- parent: Scope;
6
- addDeclaration(
7
- identifier: Identifier,
8
- options?: {
9
- isHoisted: boolean;
10
- }
11
- ): LocalVariable;
12
- }
@@ -1,13 +0,0 @@
1
- import ParameterScope from "./ParameterScope";
2
- import Identifier from "../nodes/Identifier";
3
- import Scope from "./Scope";
4
- import LocalVariable from "../variables/LocalVariable";
5
- export default class CatchScope extends ParameterScope {
6
- parent: Scope;
7
- addDeclaration(
8
- identifier: Identifier,
9
- options?: {
10
- isHoisted: boolean;
11
- }
12
- ): LocalVariable;
13
- }
@@ -1,27 +0,0 @@
1
- import ReturnValueScope from "./ReturnValueScope";
2
- import ArgumentsVariable from "../variables/ArgumentsVariable";
3
- import ThisVariable from "../variables/ThisVariable";
4
- import ExecutionPathOptions from "../ExecutionPathOptions";
5
- import CallOptions from "../CallOptions";
6
- import ExportDefaultVariable from "../variables/ExportDefaultVariable";
7
- import LocalVariable from "../variables/LocalVariable";
8
- import GlobalVariable from "../variables/GlobalVariable";
9
- import ExternalVariable from "../variables/ExternalVariable";
10
- export default class FunctionScope extends ReturnValueScope {
11
- variables: {
12
- this: ThisVariable;
13
- default: ExportDefaultVariable;
14
- arguments: ArgumentsVariable;
15
- [name: string]:
16
- | LocalVariable
17
- | GlobalVariable
18
- | ExternalVariable
19
- | ArgumentsVariable;
20
- };
21
- constructor(options?: {});
22
- findLexicalBoundary(): this;
23
- getOptionsWhenCalledWith(
24
- { args, withNew }: CallOptions,
25
- options: ExecutionPathOptions
26
- ): ExecutionPathOptions;
27
- }
@@ -1,6 +0,0 @@
1
- import GlobalVariable from "../variables/GlobalVariable";
2
- import Scope from "./Scope";
3
- export default class GlobalScope extends Scope {
4
- parent: void;
5
- findVariable(name: string): GlobalVariable;
6
- }
@@ -1,11 +0,0 @@
1
- import Scope from "./Scope";
2
- import Module from "../../Module";
3
- import Variable from "../variables/Variable";
4
- export default class ModuleScope extends Scope {
5
- parent: Scope;
6
- module: Module;
7
- constructor(module: Module);
8
- deshadow(names: Set<string>): void;
9
- findLexicalBoundary(): this;
10
- findVariable(name: string): Variable;
11
- }
@@ -1,16 +0,0 @@
1
- import Scope from "./Scope";
2
- import ParameterVariable from "../variables/ParameterVariable";
3
- import Identifier from "../nodes/Identifier";
4
- export default class ParameterScope extends Scope {
5
- parent: Scope;
6
- _parameters: ParameterVariable[];
7
- constructor(options?: {});
8
- /**
9
- * Adds a parameter to this scope. Parameters must be added in the correct
10
- * order, e.g. from left to right.
11
- * @param {Identifier} identifier
12
- * @returns {Variable}
13
- */
14
- addParameterDeclaration(identifier: Identifier): ParameterVariable;
15
- getParameterVariables(): ParameterVariable[];
16
- }
@@ -1,24 +0,0 @@
1
- import ParameterScope from "./ParameterScope";
2
- import CallOptions from "../CallOptions";
3
- import ExecutionPathOptions from "../ExecutionPathOptions";
4
- import {
5
- ExpressionEntity,
6
- ForEachReturnExpressionCallback
7
- } from "../nodes/shared/Expression";
8
- export default class ReturnValueScope extends ParameterScope {
9
- _returnExpressions: Set<ExpressionEntity>;
10
- constructor(options?: {});
11
- addReturnExpression(expression: ExpressionEntity): void;
12
- forEachReturnExpressionWhenCalled(
13
- _callOptions: CallOptions,
14
- callback: ForEachReturnExpressionCallback,
15
- options: ExecutionPathOptions
16
- ): void;
17
- someReturnExpressionWhenCalled(
18
- _callOptions: CallOptions,
19
- predicateFunction: (
20
- options: ExecutionPathOptions
21
- ) => (node: ExpressionEntity) => boolean,
22
- options: ExecutionPathOptions
23
- ): boolean;
24
- }
@@ -1,49 +0,0 @@
1
- import LocalVariable from "../variables/LocalVariable";
2
- import ExportDefaultVariable from "../variables/ExportDefaultVariable";
3
- import Identifier from "../nodes/Identifier";
4
- import ExportDefaultDeclaration from "../nodes/ExportDefaultDeclaration";
5
- import GlobalVariable from "../variables/GlobalVariable";
6
- import ExternalVariable from "../variables/ExternalVariable";
7
- import ThisVariable from "../variables/ThisVariable";
8
- import ArgumentsVariable from "../variables/ArgumentsVariable";
9
- import Variable from "../variables/Variable";
10
- import { ExpressionEntity } from "../nodes/shared/Expression";
11
- export default class Scope {
12
- parent: Scope | void;
13
- variables: {
14
- this: ThisVariable | LocalVariable;
15
- default: ExportDefaultVariable;
16
- arguments: ArgumentsVariable;
17
- [name: string]:
18
- | LocalVariable
19
- | GlobalVariable
20
- | ExternalVariable
21
- | ArgumentsVariable;
22
- };
23
- isModuleScope: boolean;
24
- children: Scope[];
25
- constructor(options?: { parent?: Scope; isModuleScope?: boolean });
26
- /**
27
- * @param identifier
28
- * @param {Object} [options] - valid options are
29
- * {(Node|null)} init
30
- * {boolean} isHoisted
31
- * @return {Variable}
32
- */
33
- addDeclaration(
34
- identifier: Identifier,
35
- options?: {
36
- init?: ExpressionEntity | null;
37
- isHoisted?: boolean;
38
- }
39
- ): LocalVariable | GlobalVariable | ExternalVariable | ArgumentsVariable;
40
- addExportDefaultDeclaration(
41
- name: string,
42
- exportDefaultDeclaration: ExportDefaultDeclaration
43
- ): ExportDefaultVariable;
44
- addReturnExpression(expression: ExpressionEntity): void;
45
- contains(name: string): boolean;
46
- deshadow(names: Set<string>): void;
47
- findLexicalBoundary(): Scope;
48
- findVariable(name: string): Variable;
49
- }
@@ -1,2 +0,0 @@
1
- import { Node } from "../nodes/shared/Node";
2
- export default function extractNames(param: Node): string[];
@@ -1,5 +0,0 @@
1
- import { ExpressionEntity } from "./nodes/shared/Expression";
2
- export declare const UNKNOWN_VALUE: {
3
- toString: () => string;
4
- };
5
- export declare const UNKNOWN_EXPRESSION: ExpressionEntity;
@@ -1,30 +0,0 @@
1
- import LocalVariable from "./LocalVariable";
2
- import ExecutionPathOptions from "../ExecutionPathOptions";
3
- import CallOptions from "../CallOptions";
4
- import ParameterVariable from "./ParameterVariable";
5
- import { ObjectPath } from "./VariableReassignmentTracker";
6
- import { SomeReturnExpressionCallback } from "../nodes/shared/Expression";
7
- export default class ArgumentsVariable extends LocalVariable {
8
- private _parameters;
9
- constructor(parameters: ParameterVariable[]);
10
- reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
11
- hasEffectsWhenAccessedAtPath(
12
- path: ObjectPath,
13
- options: ExecutionPathOptions
14
- ): boolean;
15
- hasEffectsWhenAssignedAtPath(
16
- path: ObjectPath,
17
- options: ExecutionPathOptions
18
- ): boolean;
19
- hasEffectsWhenCalledAtPath(
20
- path: ObjectPath,
21
- callOptions: CallOptions,
22
- options: ExecutionPathOptions
23
- ): boolean;
24
- someReturnExpressionWhenCalledAtPath(
25
- path: ObjectPath,
26
- callOptions: CallOptions,
27
- predicateFunction: SomeReturnExpressionCallback,
28
- options: ExecutionPathOptions
29
- ): boolean;
30
- }
@@ -1,19 +0,0 @@
1
- import LocalVariable from "./LocalVariable";
2
- import ExportDefaultDeclaration from "../nodes/ExportDefaultDeclaration";
3
- import Identifier from "../nodes/Identifier";
4
- import Variable from "./Variable";
5
- export default class ExportDefaultVariable extends LocalVariable {
6
- isDefault: true;
7
- hasId: boolean;
8
- private _original;
9
- declarations: Set<ExportDefaultDeclaration>;
10
- constructor(
11
- name: string,
12
- exportDefaultDeclaration: ExportDefaultDeclaration
13
- );
14
- addReference(identifier: Identifier): void;
15
- getName(es: boolean): string;
16
- getOriginalVariableName(es: boolean): string;
17
- includeVariable(): boolean;
18
- setOriginalVariable(original: Variable): void;
19
- }
@@ -1,17 +0,0 @@
1
- import Variable from "./Variable";
2
- import Identifier from "../nodes/Identifier";
3
- import ExternalModule from "../../ExternalModule";
4
- export declare function isExternalVariable(
5
- variable: Variable
6
- ): variable is ExternalVariable;
7
- export default class ExternalVariable extends Variable {
8
- module: ExternalModule;
9
- safeName: string;
10
- isExternal: true;
11
- isNamespace: boolean;
12
- constructor(module: ExternalModule, name: string);
13
- addReference(identifier: Identifier): void;
14
- getName(es: boolean): string;
15
- includeVariable(): boolean;
16
- setSafeName(name: string): void;
17
- }
@@ -1,12 +0,0 @@
1
- import Variable from "./Variable";
2
- import { ObjectPath } from "./VariableReassignmentTracker";
3
- export declare function isGlobalVariable(
4
- variable: Variable
5
- ): variable is GlobalVariable;
6
- export default class GlobalVariable extends Variable {
7
- isExternal: true;
8
- isGlobal: true;
9
- constructor(name: string);
10
- hasEffectsWhenAccessedAtPath(path: ObjectPath): boolean;
11
- hasEffectsWhenCalledAtPath(path: ObjectPath): boolean;
12
- }
@@ -1,51 +0,0 @@
1
- import Variable from "./Variable";
2
- import VariableReassignmentTracker, {
3
- ObjectPath
4
- } from "./VariableReassignmentTracker";
5
- import ExecutionPathOptions from "../ExecutionPathOptions";
6
- import CallOptions from "../CallOptions";
7
- import Identifier from "../nodes/Identifier";
8
- import ExportDefaultDeclaration from "../nodes/ExportDefaultDeclaration";
9
- import {
10
- ExpressionEntity,
11
- ForEachReturnExpressionCallback,
12
- SomeReturnExpressionCallback
13
- } from "../nodes/shared/Expression";
14
- export default class LocalVariable extends Variable {
15
- declarations: Set<Identifier | ExportDefaultDeclaration>;
16
- boundExpressions: VariableReassignmentTracker;
17
- constructor(
18
- name: string,
19
- declarator: Identifier | ExportDefaultDeclaration | null,
20
- init: ExpressionEntity
21
- );
22
- addDeclaration(identifier: Identifier): void;
23
- forEachReturnExpressionWhenCalledAtPath(
24
- path: ObjectPath,
25
- callOptions: CallOptions,
26
- callback: ForEachReturnExpressionCallback,
27
- options: ExecutionPathOptions
28
- ): void;
29
- getName(es: boolean): string;
30
- hasEffectsWhenAccessedAtPath(
31
- path: ObjectPath,
32
- options: ExecutionPathOptions
33
- ): boolean;
34
- hasEffectsWhenAssignedAtPath(
35
- path: ObjectPath,
36
- options: ExecutionPathOptions
37
- ): boolean;
38
- hasEffectsWhenCalledAtPath(
39
- path: ObjectPath,
40
- callOptions: CallOptions,
41
- options: ExecutionPathOptions
42
- ): boolean;
43
- includeVariable(): boolean;
44
- reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
45
- someReturnExpressionWhenCalledAtPath(
46
- path: ObjectPath,
47
- callOptions: CallOptions,
48
- predicateFunction: SomeReturnExpressionCallback,
49
- options: ExecutionPathOptions
50
- ): boolean;
51
- }
@@ -1,23 +0,0 @@
1
- import Variable from "./Variable";
2
- import Identifier from "../nodes/Identifier";
3
- import Module from "../../Module";
4
- export declare function isNamespaceVariable(
5
- variable: Variable
6
- ): variable is NamespaceVariable;
7
- export default class NamespaceVariable extends Variable {
8
- isNamespace: true;
9
- module: Module;
10
- needsNamespaceBlock: boolean;
11
- originals: {
12
- [name: string]: Variable;
13
- };
14
- constructor(module: Module);
15
- addReference(identifier: Identifier): void;
16
- includeVariable(): boolean;
17
- renderBlock(
18
- es: boolean,
19
- legacy: boolean,
20
- freeze: boolean,
21
- indentString: string
22
- ): string;
23
- }
@@ -1,6 +0,0 @@
1
- import ReplaceableInitializationVariable from "./ReplaceableInitializationVariable";
2
- import Identifier from "../nodes/Identifier";
3
- export default class ParameterVariable extends ReplaceableInitializationVariable {
4
- constructor(identifier: Identifier);
5
- getName(): string;
6
- }
@@ -1,33 +0,0 @@
1
- import LocalVariable from "./LocalVariable";
2
- import ExecutionPathOptions from "../ExecutionPathOptions";
3
- import CallOptions from "../CallOptions";
4
- import Identifier from "../nodes/Identifier";
5
- import { ObjectPath } from "./VariableReassignmentTracker";
6
- import {
7
- ExpressionEntity,
8
- SomeReturnExpressionCallback
9
- } from "../nodes/shared/Expression";
10
- export default class ReplaceableInitializationVariable extends LocalVariable {
11
- constructor(name: string, declarator: Identifier | null);
12
- getName(): string;
13
- hasEffectsWhenAccessedAtPath(
14
- path: ObjectPath,
15
- options: ExecutionPathOptions
16
- ): boolean;
17
- hasEffectsWhenAssignedAtPath(
18
- path: ObjectPath,
19
- options: ExecutionPathOptions
20
- ): boolean;
21
- hasEffectsWhenCalledAtPath(
22
- path: ObjectPath,
23
- callOptions: CallOptions,
24
- options: ExecutionPathOptions
25
- ): boolean;
26
- someReturnExpressionWhenCalledAtPath(
27
- path: ObjectPath,
28
- callOptions: CallOptions,
29
- predicateFunction: SomeReturnExpressionCallback,
30
- options: ExecutionPathOptions
31
- ): boolean;
32
- _getInit(options: ExecutionPathOptions): ExpressionEntity;
33
- }
@@ -1,4 +0,0 @@
1
- import ReplaceableInitializationVariable from "./ReplaceableInitializationVariable";
2
- export default class ThisVariable extends ReplaceableInitializationVariable {
3
- constructor();
4
- }
@@ -1,63 +0,0 @@
1
- import CallOptions from "../CallOptions";
2
- import ExecutionPathOptions from "../ExecutionPathOptions";
3
- import Identifier from "../nodes/Identifier";
4
- import { ObjectPath } from "./VariableReassignmentTracker";
5
- import {
6
- ExpressionEntity,
7
- ForEachReturnExpressionCallback,
8
- SomeReturnExpressionCallback
9
- } from "../nodes/shared/Expression";
10
- export default class Variable implements ExpressionEntity {
11
- exportName?: string;
12
- included: boolean;
13
- isExternal?: boolean;
14
- isGlobal?: boolean;
15
- isNamespace?: boolean;
16
- isReassigned: boolean;
17
- name: string;
18
- reexported?: boolean;
19
- constructor(name: string);
20
- /**
21
- * Binds identifiers that reference this variable to this variable.
22
- * Necessary to be able to change variable names.
23
- */
24
- addReference(_identifier: Identifier): void;
25
- reassignPath(_path: ObjectPath, _options: ExecutionPathOptions): void;
26
- forEachReturnExpressionWhenCalledAtPath(
27
- _path: ObjectPath,
28
- _callOptions: CallOptions,
29
- _callback: ForEachReturnExpressionCallback,
30
- _options: ExecutionPathOptions
31
- ): void;
32
- getName(_es?: boolean): string;
33
- getValue(): {
34
- toString: () => string;
35
- };
36
- hasEffectsWhenAccessedAtPath(
37
- path: ObjectPath,
38
- _options: ExecutionPathOptions
39
- ): boolean;
40
- hasEffectsWhenAssignedAtPath(
41
- _path: ObjectPath,
42
- _options: ExecutionPathOptions
43
- ): boolean;
44
- hasEffectsWhenCalledAtPath(
45
- _path: ObjectPath,
46
- _callOptions: CallOptions,
47
- _options: ExecutionPathOptions
48
- ): boolean;
49
- /**
50
- * Marks this variable as being part of the bundle, which is usually the case when one of
51
- * its identifiers becomes part of the bundle. Returns true if it has not been included
52
- * previously.
53
- * Once a variable is included, it should take care all its declarations are included.
54
- */
55
- includeVariable(): boolean;
56
- someReturnExpressionWhenCalledAtPath(
57
- _path: ObjectPath,
58
- _callOptions: CallOptions,
59
- predicateFunction: SomeReturnExpressionCallback,
60
- options: ExecutionPathOptions
61
- ): boolean;
62
- toString(): string;
63
- }