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,97 +0,0 @@
1
- import CallExpression from "./nodes/CallExpression";
2
- import CallOptions from "./CallOptions";
3
- import ThisVariable from "./variables/ThisVariable";
4
- import ParameterVariable from "./variables/ParameterVariable";
5
- import { ObjectPath } from "./variables/VariableReassignmentTracker";
6
- import { Entity, WritableEntity } from "./Entity";
7
- import Property from "./nodes/Property";
8
- import { ExpressionEntity } from "./nodes/shared/Expression";
9
- export declare enum OptionTypes {
10
- IGNORED_LABELS = 0,
11
- ACCESSED_NODES = 1,
12
- ARGUMENTS_VARIABLES = 2,
13
- ASSIGNED_NODES = 3,
14
- IGNORE_BREAK_STATEMENTS = 4,
15
- IGNORE_RETURN_AWAIT_YIELD = 5,
16
- NODES_CALLED_AT_PATH_WITH_OPTIONS = 6,
17
- REPLACED_VARIABLE_INITS = 7,
18
- RETURN_EXPRESSIONS_ACCESSED_AT_PATH = 8,
19
- RETURN_EXPRESSIONS_ASSIGNED_AT_PATH = 9,
20
- RETURN_EXPRESSIONS_CALLED_AT_PATH = 10
21
- }
22
- export declare type RESULT_KEY = {};
23
- export declare const RESULT_KEY: RESULT_KEY;
24
- export declare type KeyTypes = OptionTypes | Entity | RESULT_KEY;
25
- export default class ExecutionPathOptions {
26
- private optionValues;
27
- static create(): ExecutionPathOptions;
28
- private constructor();
29
- private get(option);
30
- private remove(option);
31
- private set(option, value);
32
- private setIn(optionPath, value);
33
- addAccessedNodeAtPath(
34
- path: ObjectPath,
35
- node: ExpressionEntity
36
- ): ExecutionPathOptions;
37
- addAccessedReturnExpressionAtPath(
38
- path: ObjectPath,
39
- callExpression: CallExpression | Property
40
- ): ExecutionPathOptions;
41
- addAssignedNodeAtPath(
42
- path: ObjectPath,
43
- node: WritableEntity
44
- ): ExecutionPathOptions;
45
- addAssignedReturnExpressionAtPath(
46
- path: ObjectPath,
47
- callExpression: CallExpression | Property
48
- ): ExecutionPathOptions;
49
- addCalledNodeAtPathWithOptions(
50
- path: ObjectPath,
51
- node: ExpressionEntity,
52
- callOptions: CallOptions
53
- ): ExecutionPathOptions;
54
- addCalledReturnExpressionAtPath(
55
- path: ObjectPath,
56
- callExpression: CallExpression | Property
57
- ): ExecutionPathOptions;
58
- getArgumentsVariables(): ExpressionEntity[];
59
- getHasEffectsWhenCalledOptions(): ExecutionPathOptions;
60
- getReplacedVariableInit(
61
- variable: ThisVariable | ParameterVariable
62
- ): ExpressionEntity;
63
- hasNodeBeenAccessedAtPath(
64
- path: ObjectPath,
65
- node: ExpressionEntity
66
- ): boolean;
67
- hasNodeBeenAssignedAtPath(path: ObjectPath, node: WritableEntity): boolean;
68
- hasNodeBeenCalledAtPathWithOptions(
69
- path: ObjectPath,
70
- node: ExpressionEntity,
71
- callOptions: CallOptions
72
- ): boolean;
73
- hasReturnExpressionBeenAccessedAtPath(
74
- path: ObjectPath,
75
- callExpression: CallExpression | Property
76
- ): boolean;
77
- hasReturnExpressionBeenAssignedAtPath(
78
- path: ObjectPath,
79
- callExpression: CallExpression | Property
80
- ): boolean;
81
- hasReturnExpressionBeenCalledAtPath(
82
- path: ObjectPath,
83
- callExpression: CallExpression | Property
84
- ): boolean;
85
- ignoreBreakStatements(): boolean | Entity | ExpressionEntity[];
86
- ignoreLabel(labelName: string): any;
87
- ignoreReturnAwaitYield(): boolean | Entity | ExpressionEntity[];
88
- replaceVariableInit(
89
- variable: ThisVariable | ParameterVariable,
90
- init: ExpressionEntity
91
- ): ExecutionPathOptions;
92
- setArgumentsVariables(variables: ExpressionEntity[]): ExecutionPathOptions;
93
- setIgnoreBreakStatements(value?: boolean): ExecutionPathOptions;
94
- setIgnoreLabel(labelName: string): ExecutionPathOptions;
95
- setIgnoreNoLabels(): ExecutionPathOptions;
96
- setIgnoreReturnAwaitYield(value?: boolean): ExecutionPathOptions;
97
- }
@@ -1,186 +0,0 @@
1
- /// <reference path="../../../../src/ast/Node.d.ts" />
2
- import { PredicateFunction, UnknownAssignment } from "./values";
3
- import ExecutionPathOptions from "./ExecutionPathOptions";
4
- import Scope from "./scopes/Scope";
5
- import Module from "../Module";
6
- import MagicString from "magic-string";
7
- import CallOptions from "./CallOptions";
8
- import Expression from "./nodes/Expression";
9
- import Declaration from "./nodes/Declaration";
10
- import { ObjectPath } from "./variables/VariableReassignmentTracker";
11
- export declare type ForEachReturnExpressionCallback = (
12
- options: ExecutionPathOptions
13
- ) => (node: Node | UnknownAssignment) => void;
14
- export default class Node {
15
- type: string;
16
- keys: string[];
17
- included: boolean;
18
- scope: Scope;
19
- start: number;
20
- end: number;
21
- leadingCommentStart: number;
22
- trailingCommentEnd: number;
23
- next: number;
24
- module: Module;
25
- parent: Node | Module;
26
- __enhanced: boolean;
27
- constructor();
28
- /**
29
- * Called once all nodes have been initialised and the scopes have been populated.
30
- * Usually one should not override this function but override bindNode and/or
31
- * bindChildren instead.
32
- */
33
- bind(): void;
34
- /**
35
- * Reassign a given path of an object.
36
- * E.g., node.reassignPath(['x', 'y']) is called when something
37
- * is assigned to node.x.y.
38
- * The default noop implementation is ok as long as hasEffectsWhenAssignedAtPath
39
- * always returns true for this node. Otherwise it should be overridden.
40
- * @param {String[]} _path
41
- * @param {ExecutionPathOptions} _options
42
- */
43
- reassignPath(_path: ObjectPath, _options: ExecutionPathOptions): void;
44
- /**
45
- * Override to control on which children "bind" is called.
46
- */
47
- bindChildren(): void;
48
- /**
49
- * Override this to bind assignments to variables and do any initialisations that
50
- * require the scopes to be populated with variables.
51
- */
52
- bindNode(): void;
53
- eachChild(callback: (node: Node) => void): void;
54
- /**
55
- * Executes the callback on each possible return expression when calling this node.
56
- * @param {String[]} _path
57
- * @param {CallOptions} _callOptions
58
- * @param {Function} _callback
59
- * @param {ExecutionPathOptions} _options
60
- */
61
- forEachReturnExpressionWhenCalledAtPath(
62
- _path: ObjectPath,
63
- _callOptions: CallOptions,
64
- _callback: ForEachReturnExpressionCallback,
65
- _options: ExecutionPathOptions
66
- ): void;
67
- getValue(): {
68
- toString: () => string;
69
- };
70
- /**
71
- * Determine if this Node would have an effect on the bundle.
72
- * This is usually true for already included nodes. Exceptions are e.g. break statements
73
- * which only have an effect if their surrounding loop or switch statement is included.
74
- * The options pass on information like this about the current execution path.
75
- * @param {ExecutionPathOptions} options
76
- * @return {boolean}
77
- */
78
- hasEffects(options: ExecutionPathOptions): boolean;
79
- /**
80
- * @param {String[]} path
81
- * @param {ExecutionPathOptions} _options
82
- * @return {boolean}
83
- */
84
- hasEffectsWhenAccessedAtPath(
85
- path: ObjectPath,
86
- _options: ExecutionPathOptions
87
- ): boolean;
88
- /**
89
- * @param {String[]} _path
90
- * @param {ExecutionPathOptions} _options
91
- * @return {boolean}
92
- */
93
- hasEffectsWhenAssignedAtPath(
94
- _path: ObjectPath,
95
- _options: ExecutionPathOptions
96
- ): boolean;
97
- /**
98
- * @param {String[]} _path
99
- * @param {CallOptions} _callOptions
100
- * @param {ExecutionPathOptions} _options
101
- * @return {boolean}
102
- */
103
- hasEffectsWhenCalledAtPath(
104
- _path: ObjectPath,
105
- _callOptions: CallOptions,
106
- _options: ExecutionPathOptions
107
- ): boolean;
108
- /**
109
- * Returns true if this node or any of its children is included.
110
- * @return {boolean}
111
- */
112
- hasIncludedChild(): boolean;
113
- /**
114
- * Includes the node in the bundle. Children are usually included if they are
115
- * necessary for this node (e.g. a function body) or if they have effects.
116
- * Necessary variables need to be included as well. Should return true if any
117
- * nodes or variables have been added that were missing before.
118
- * @return {boolean}
119
- */
120
- includeInBundle(): boolean;
121
- /**
122
- * Alternative version of includeInBundle to override the default behaviour of
123
- * declarations to only include nodes for declarators that have an effect. Necessary
124
- * for for-loops that do not use a declared loop variable.
125
- * @return {boolean}
126
- */
127
- includeWithAllDeclarations(): boolean;
128
- /**
129
- * Assign a scope to this node and make sure all children have the right scopes.
130
- * Perform any additional initialisation that does not depend on the scope being
131
- * populated with variables.
132
- * Usually one should not override this function but override initialiseScope,
133
- * initialiseNode and/or initialiseChildren instead. BlockScopes have a special
134
- * alternative initialisation initialiseAndReplaceScope.
135
- * @param {Scope} parentScope
136
- */
137
- initialise(parentScope: Scope): void;
138
- initialiseAndDeclare(
139
- _parentScope: Scope,
140
- _kind: string,
141
- _init: Declaration | Expression | UnknownAssignment | null
142
- ): void;
143
- /**
144
- * Override to change how and with what scopes children are initialised
145
- * @param {Scope} _parentScope
146
- */
147
- initialiseChildren(_parentScope: Scope): void;
148
- /**
149
- * Override to perform special initialisation steps after the scope is initialised
150
- * @param {Scope} _parentScope
151
- */
152
- initialiseNode(_parentScope: Scope): void;
153
- /**
154
- * Override if this scope should receive a different scope than the parent scope.
155
- * @param {Scope} parentScope
156
- */
157
- initialiseScope(parentScope: Scope): void;
158
- insertSemicolon(code: MagicString): void;
159
- locate(): any;
160
- render(code: MagicString, es: boolean): void;
161
- /**
162
- * Start a new execution path to determine if this node has an effect on the bundle and
163
- * should therefore be included. Included nodes should always be included again in subsequent
164
- * visits as the inclusion of additional variables may require the inclusion of more child
165
- * nodes in e.g. block statements.
166
- * @return {boolean}
167
- */
168
- shouldBeIncluded(): boolean;
169
- someChild(callback: (node: Node) => boolean): boolean;
170
- /**
171
- * Returns true if some possible return expression when called at the given
172
- * path returns true. predicateFunction receives a `node` as parameter.
173
- * @param {String[]} _path
174
- * @param {CallOptions} _callOptions
175
- * @param {Function} predicateFunction
176
- * @param {ExecutionPathOptions} options
177
- * @returns {boolean}
178
- */
179
- someReturnExpressionWhenCalledAtPath(
180
- _path: ObjectPath,
181
- _callOptions: CallOptions,
182
- predicateFunction: (options: ExecutionPathOptions) => PredicateFunction,
183
- options: ExecutionPathOptions
184
- ): boolean;
185
- toString(): string;
186
- }
@@ -1 +0,0 @@
1
- export default function clone<T>(node: T): T;
@@ -1,4 +0,0 @@
1
- export default interface Comment {
2
- start: number;
3
- end: number;
4
- };
@@ -1,7 +0,0 @@
1
- import Module from "../Module";
2
- import Comment from "./comment";
3
- export default function enhance(
4
- ast: any,
5
- module: Module,
6
- comments: Comment[]
7
- ): void;
@@ -1,4 +0,0 @@
1
- declare const keys: {
2
- [name: string]: string[];
3
- };
4
- export default keys;
@@ -1,9 +0,0 @@
1
- import SpreadElement from "./SpreadElement";
2
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
3
- import { ExpressionNode, NodeBase } from "./shared/Node";
4
- import { NodeType } from "./index";
5
- export default class ArrayExpression extends NodeBase {
6
- type: NodeType.ArrayExpression;
7
- elements: (ExpressionNode | SpreadElement | null)[];
8
- hasEffectsWhenAccessedAtPath(path: ObjectPath): boolean;
9
- }
@@ -1,21 +0,0 @@
1
- import Scope from "../scopes/Scope";
2
- import ExecutionPathOptions from "../ExecutionPathOptions";
3
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
4
- import { PatternNode } from "./shared/Pattern";
5
- import { ExpressionEntity } from "./shared/Expression";
6
- import { NodeBase } from "./shared/Node";
7
- import { NodeType } from "./index";
8
- export default class ArrayPattern extends NodeBase implements PatternNode {
9
- type: NodeType.ArrayPattern;
10
- elements: (PatternNode | null)[];
11
- reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
12
- hasEffectsWhenAssignedAtPath(
13
- path: ObjectPath,
14
- options: ExecutionPathOptions
15
- ): boolean;
16
- initialiseAndDeclare(
17
- parentScope: Scope,
18
- kind: string,
19
- _init: ExpressionEntity | null
20
- ): void;
21
- }
@@ -1,48 +0,0 @@
1
- import Scope from "../scopes/Scope";
2
- import ReturnValueScope from "../scopes/ReturnValueScope";
3
- import BlockStatement from "./BlockStatement";
4
- import CallOptions from "../CallOptions";
5
- import ExecutionPathOptions from "../ExecutionPathOptions";
6
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
7
- import {
8
- ForEachReturnExpressionCallback,
9
- SomeReturnExpressionCallback
10
- } from "./shared/Expression";
11
- import { PatternNode } from "./shared/Pattern";
12
- import { NodeType } from "./index";
13
- import { ExpressionNode, NodeBase } from "./shared/Node";
14
- export default class ArrowFunctionExpression extends NodeBase {
15
- type: NodeType.ArrowFunctionExpression;
16
- body: BlockStatement | ExpressionNode;
17
- params: PatternNode[];
18
- scope: ReturnValueScope;
19
- bindNode(): void;
20
- forEachReturnExpressionWhenCalledAtPath(
21
- path: ObjectPath,
22
- callOptions: CallOptions,
23
- callback: ForEachReturnExpressionCallback,
24
- options: ExecutionPathOptions
25
- ): void;
26
- hasEffects(_options: ExecutionPathOptions): boolean;
27
- hasEffectsWhenAccessedAtPath(
28
- path: ObjectPath,
29
- _options: ExecutionPathOptions
30
- ): boolean;
31
- hasEffectsWhenAssignedAtPath(
32
- path: ObjectPath,
33
- _options: ExecutionPathOptions
34
- ): boolean;
35
- hasEffectsWhenCalledAtPath(
36
- path: ObjectPath,
37
- _callOptions: CallOptions,
38
- options: ExecutionPathOptions
39
- ): boolean;
40
- initialiseChildren(): void;
41
- initialiseScope(parentScope: Scope): void;
42
- someReturnExpressionWhenCalledAtPath(
43
- path: ObjectPath,
44
- callOptions: CallOptions,
45
- predicateFunction: SomeReturnExpressionCallback,
46
- options: ExecutionPathOptions
47
- ): boolean;
48
- }
@@ -1,16 +0,0 @@
1
- import ExecutionPathOptions from "../ExecutionPathOptions";
2
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
3
- import { PatternNode } from "./shared/Pattern";
4
- import { ExpressionNode, NodeBase } from "./shared/Node";
5
- import { NodeType } from "./index";
6
- export default class AssignmentExpression extends NodeBase {
7
- type: NodeType.AssignmentExpression;
8
- left: PatternNode | ExpressionNode;
9
- right: ExpressionNode;
10
- bindNode(): void;
11
- hasEffects(options: ExecutionPathOptions): boolean;
12
- hasEffectsWhenAccessedAtPath(
13
- path: ObjectPath,
14
- options: ExecutionPathOptions
15
- ): boolean;
16
- }
@@ -1,23 +0,0 @@
1
- import ExecutionPathOptions from "../ExecutionPathOptions";
2
- import Scope from "../scopes/Scope";
3
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
4
- import { PatternNode } from "./shared/Pattern";
5
- import { ExpressionEntity } from "./shared/Expression";
6
- import { ExpressionNode, NodeBase } from "./shared/Node";
7
- import { NodeType } from "./index";
8
- export default class AssignmentPattern extends NodeBase implements PatternNode {
9
- type: NodeType.AssignmentPattern;
10
- left: PatternNode;
11
- right: ExpressionNode;
12
- bindNode(): void;
13
- reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
14
- hasEffectsWhenAssignedAtPath(
15
- path: ObjectPath,
16
- options: ExecutionPathOptions
17
- ): boolean;
18
- initialiseAndDeclare(
19
- parentScope: Scope,
20
- kind: string,
21
- init: ExpressionEntity | null
22
- ): void;
23
- }
@@ -1,10 +0,0 @@
1
- import { PatternNode } from "./shared/Pattern";
2
- import { ExpressionNode } from "./shared/Node";
3
- import { NodeType } from "./index";
4
- export default interface AssignmentProperty extends PatternNode {
5
- type: NodeType.Property;
6
- value: PatternNode;
7
- key: ExpressionNode;
8
- kind: "init";
9
- method: false;
10
- };
@@ -1,8 +0,0 @@
1
- import ExecutionPathOptions from "../ExecutionPathOptions";
2
- import { NodeType } from "./index";
3
- import { ExpressionNode, NodeBase } from "./shared/Node";
4
- export default class AwaitExpression extends NodeBase {
5
- type: NodeType.AwaitExpression;
6
- argument: ExpressionNode;
7
- hasEffects(options: ExecutionPathOptions): boolean;
8
- }
@@ -1,38 +0,0 @@
1
- import ExecutionPathOptions from "../ExecutionPathOptions";
2
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
3
- import { NodeType } from "./index";
4
- import { ExpressionNode, NodeBase } from "./shared/Node";
5
- export declare type BinaryOperator =
6
- | "=="
7
- | "!="
8
- | "==="
9
- | "!=="
10
- | "<"
11
- | "<="
12
- | ">"
13
- | ">="
14
- | "<<"
15
- | ">>"
16
- | ">>>"
17
- | "+"
18
- | "-"
19
- | "*"
20
- | "/"
21
- | "%"
22
- | " |"
23
- | "^"
24
- | "&"
25
- | "**"
26
- | "in"
27
- | "instanceof";
28
- export default class BinaryExpression extends NodeBase {
29
- type: NodeType.BinaryExpression;
30
- left: ExpressionNode;
31
- right: ExpressionNode;
32
- operator: BinaryOperator;
33
- getValue(): any;
34
- hasEffectsWhenAccessedAtPath(
35
- path: ObjectPath,
36
- _options: ExecutionPathOptions
37
- ): boolean;
38
- }
@@ -1,19 +0,0 @@
1
- import ExecutionPathOptions from "../ExecutionPathOptions";
2
- import Scope from "../scopes/Scope";
3
- import MagicString from "magic-string";
4
- import { Node } from "./shared/Node";
5
- import { StatementBase, StatementNode } from "./shared/Statement";
6
- import { NodeType } from "./index";
7
- export declare function isBlockStatement(node: Node): node is BlockStatement;
8
- export default class BlockStatement extends StatementBase {
9
- type: NodeType.BlockStatement;
10
- scope: Scope;
11
- body: StatementNode[];
12
- bindImplicitReturnExpressionToScope(): void;
13
- hasEffects(options: ExecutionPathOptions): boolean;
14
- includeInBundle(): boolean;
15
- initialiseAndReplaceScope(scope: Scope): void;
16
- initialiseChildren(_parentScope: Scope): void;
17
- initialiseScope(parentScope: Scope): void;
18
- render(code: MagicString, es: boolean): void;
19
- }
@@ -1,9 +0,0 @@
1
- import ExecutionPathOptions from "../ExecutionPathOptions";
2
- import Identifier from "./Identifier";
3
- import { StatementBase } from "./shared/Statement";
4
- import { NodeType } from "./index";
5
- export default class BreakStatement extends StatementBase {
6
- type: NodeType.BreakStatement;
7
- label: Identifier | null;
8
- hasEffects(options: ExecutionPathOptions): boolean;
9
- }
@@ -1,45 +0,0 @@
1
- import CallOptions from "../CallOptions";
2
- import ExecutionPathOptions from "../ExecutionPathOptions";
3
- import SpreadElement from "./SpreadElement";
4
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
5
- import {
6
- ForEachReturnExpressionCallback,
7
- SomeReturnExpressionCallback
8
- } from "./shared/Expression";
9
- import { NodeType } from "./index";
10
- import { ExpressionNode, NodeBase } from "./shared/Node";
11
- export default class CallExpression extends NodeBase {
12
- type: NodeType.CallExpression;
13
- callee: ExpressionNode;
14
- arguments: (ExpressionNode | SpreadElement)[];
15
- private _callOptions;
16
- reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
17
- bindNode(): void;
18
- forEachReturnExpressionWhenCalledAtPath(
19
- path: ObjectPath,
20
- callOptions: CallOptions,
21
- callback: ForEachReturnExpressionCallback,
22
- options: ExecutionPathOptions
23
- ): void;
24
- hasEffects(options: ExecutionPathOptions): boolean;
25
- hasEffectsWhenAccessedAtPath(
26
- path: ObjectPath,
27
- options: ExecutionPathOptions
28
- ): boolean;
29
- hasEffectsWhenAssignedAtPath(
30
- path: ObjectPath,
31
- options: ExecutionPathOptions
32
- ): boolean;
33
- hasEffectsWhenCalledAtPath(
34
- path: ObjectPath,
35
- callOptions: CallOptions,
36
- options: ExecutionPathOptions
37
- ): boolean;
38
- initialiseNode(): void;
39
- someReturnExpressionWhenCalledAtPath(
40
- path: ObjectPath,
41
- callOptions: CallOptions,
42
- predicateFunction: SomeReturnExpressionCallback,
43
- options: ExecutionPathOptions
44
- ): boolean;
45
- }
@@ -1,14 +0,0 @@
1
- import { NodeBase } from "./shared/Node";
2
- import CatchScope from "../scopes/CatchScope";
3
- import BlockStatement from "./BlockStatement";
4
- import Scope from "../scopes/Scope";
5
- import { PatternNode } from "./shared/Pattern";
6
- import { NodeType } from "./index";
7
- export default class CatchClause extends NodeBase {
8
- type: NodeType.CatchClause;
9
- param: PatternNode;
10
- body: BlockStatement;
11
- scope: CatchScope;
12
- initialiseChildren(): void;
13
- initialiseScope(parentScope: Scope): void;
14
- }
@@ -1,17 +0,0 @@
1
- import { NodeBase } from "./shared/Node";
2
- import ExecutionPathOptions from "../ExecutionPathOptions";
3
- import CallOptions from "../CallOptions";
4
- import MethodDefinition from "./MethodDefinition";
5
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
6
- import { NodeType } from "./index";
7
- export default class ClassBody extends NodeBase {
8
- type: NodeType.ClassBody;
9
- body: MethodDefinition[];
10
- classConstructor: MethodDefinition | null;
11
- hasEffectsWhenCalledAtPath(
12
- path: ObjectPath,
13
- callOptions: CallOptions,
14
- options: ExecutionPathOptions
15
- ): boolean;
16
- initialiseNode(): void;
17
- }
@@ -1,11 +0,0 @@
1
- import ClassNode from "./shared/ClassNode";
2
- import Scope from "../scopes/Scope";
3
- import Identifier from "./Identifier";
4
- import MagicString from "magic-string";
5
- import { NodeType } from "./index";
6
- export default class ClassDeclaration extends ClassNode {
7
- type: NodeType.ClassDeclaration;
8
- id: Identifier;
9
- initialiseChildren(parentScope: Scope): void;
10
- render(code: MagicString, es: boolean): void;
11
- }
@@ -1,10 +0,0 @@
1
- import ClassNode from "./shared/ClassNode";
2
- import Scope from "../scopes/Scope";
3
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
4
- import ExecutionPathOptions from "../ExecutionPathOptions";
5
- import { NodeType } from "./index";
6
- export default class ClassExpression extends ClassNode {
7
- type: NodeType.ClassExpression;
8
- initialiseChildren(parentScope: Scope): void;
9
- reassignPath(_path: ObjectPath, _options: ExecutionPathOptions): void;
10
- }
@@ -1,50 +0,0 @@
1
- import ExecutionPathOptions from "../ExecutionPathOptions";
2
- import CallOptions from "../CallOptions";
3
- import Scope from "../scopes/Scope";
4
- import MagicString from "magic-string";
5
- import { ObjectPath } from "../variables/VariableReassignmentTracker";
6
- import {
7
- ForEachReturnExpressionCallback,
8
- SomeReturnExpressionCallback
9
- } from "./shared/Expression";
10
- import { NodeType } from "./index";
11
- import { ExpressionNode, NodeBase } from "./shared/Node";
12
- export default class ConditionalExpression extends NodeBase {
13
- type: NodeType.ConditionalExpression;
14
- test: ExpressionNode;
15
- alternate: ExpressionNode;
16
- consequent: ExpressionNode;
17
- testValue: any;
18
- reassignPath(path: ObjectPath, options: ExecutionPathOptions): void;
19
- forEachReturnExpressionWhenCalledAtPath(
20
- path: ObjectPath,
21
- callOptions: CallOptions,
22
- callback: ForEachReturnExpressionCallback,
23
- options: ExecutionPathOptions
24
- ): void;
25
- getValue(): any;
26
- hasEffects(options: ExecutionPathOptions): boolean;
27
- hasEffectsWhenAccessedAtPath(
28
- path: ObjectPath,
29
- options: ExecutionPathOptions
30
- ): boolean;
31
- hasEffectsWhenAssignedAtPath(
32
- path: ObjectPath,
33
- options: ExecutionPathOptions
34
- ): boolean;
35
- hasEffectsWhenCalledAtPath(
36
- path: ObjectPath,
37
- callOptions: CallOptions,
38
- options: ExecutionPathOptions
39
- ): boolean;
40
- initialiseChildren(parentScope: Scope): void;
41
- render(code: MagicString, es: boolean): void;
42
- someReturnExpressionWhenCalledAtPath(
43
- path: ObjectPath,
44
- callOptions: CallOptions,
45
- predicateFunction: SomeReturnExpressionCallback,
46
- options: ExecutionPathOptions
47
- ): boolean;
48
- private forEachRelevantBranch(callback);
49
- private someRelevantBranch(predicateFunction);
50
- }