@ibyar/expressions 0.5.2 → 0.5.62

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 (186) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +4 -3
  3. package/api/abstract.d.ts +5 -6
  4. package/api/abstract.js +8 -3
  5. package/api/abstract.js.map +1 -1
  6. package/api/class/class.d.ts +227 -0
  7. package/api/class/class.js +662 -0
  8. package/api/class/class.js.map +1 -0
  9. package/api/class/decorator.d.ts +20 -0
  10. package/api/class/decorator.js +48 -0
  11. package/api/class/decorator.js.map +1 -0
  12. package/api/computing/call.d.ts +3 -1
  13. package/api/computing/call.js +16 -4
  14. package/api/computing/call.js.map +1 -1
  15. package/api/computing/debugger.d.ts +15 -0
  16. package/api/computing/debugger.js +35 -0
  17. package/api/computing/debugger.js.map +1 -0
  18. package/api/computing/new.d.ts +2 -1
  19. package/api/computing/new.js +4 -0
  20. package/api/computing/new.js.map +1 -1
  21. package/api/computing/rest.d.ts +6 -6
  22. package/api/computing/rest.js +5 -2
  23. package/api/computing/rest.js.map +1 -1
  24. package/api/computing/return.d.ts +6 -1
  25. package/api/computing/return.js +8 -0
  26. package/api/computing/return.js.map +1 -1
  27. package/api/computing/spread.d.ts +2 -1
  28. package/api/computing/spread.js +5 -2
  29. package/api/computing/spread.js.map +1 -1
  30. package/api/computing/throw.d.ts +6 -1
  31. package/api/computing/throw.js +7 -0
  32. package/api/computing/throw.js.map +1 -1
  33. package/api/computing/yield.d.ts +2 -1
  34. package/api/computing/yield.js +3 -0
  35. package/api/computing/yield.js.map +1 -1
  36. package/api/definition/array.d.ts +12 -12
  37. package/api/definition/array.js +31 -25
  38. package/api/definition/array.js.map +1 -1
  39. package/api/definition/bind.d.ts +8 -2
  40. package/api/definition/bind.js +7 -1
  41. package/api/definition/bind.js.map +1 -1
  42. package/api/definition/function.d.ts +40 -51
  43. package/api/definition/function.js +292 -309
  44. package/api/definition/function.js.map +1 -1
  45. package/api/definition/member.d.ts +2 -2
  46. package/api/definition/member.js +1 -1
  47. package/api/definition/member.js.map +1 -1
  48. package/api/definition/object.d.ts +15 -12
  49. package/api/definition/object.js +43 -13
  50. package/api/definition/object.js.map +1 -1
  51. package/api/definition/statement.d.ts +2 -2
  52. package/api/definition/statement.js +7 -3
  53. package/api/definition/statement.js.map +1 -1
  54. package/api/definition/values.d.ts +44 -50
  55. package/api/definition/values.js +87 -149
  56. package/api/definition/values.js.map +1 -1
  57. package/api/deserialize/deserialize.d.ts +7 -1
  58. package/api/deserialize/deserialize.js +9 -1
  59. package/api/deserialize/deserialize.js.map +1 -1
  60. package/api/deserialize/type-store.d.ts +2 -2
  61. package/api/deserialize/type-store.js.map +1 -1
  62. package/api/expression.d.ts +159 -18
  63. package/api/expression.js.map +1 -1
  64. package/api/index.d.ts +2 -0
  65. package/api/index.js +2 -0
  66. package/api/index.js.map +1 -1
  67. package/api/module/common.d.ts +29 -0
  68. package/api/module/common.js +71 -0
  69. package/api/module/common.js.map +1 -0
  70. package/api/module/export.d.ts +129 -25
  71. package/api/module/export.js +333 -58
  72. package/api/module/export.js.map +1 -1
  73. package/api/module/import.d.ts +114 -25
  74. package/api/module/import.js +279 -68
  75. package/api/module/import.js.map +1 -1
  76. package/api/operators/assignment.d.ts +2 -2
  77. package/api/operators/assignment.js +1 -1
  78. package/api/operators/assignment.js.map +1 -1
  79. package/api/operators/await.d.ts +2 -2
  80. package/api/operators/await.js +1 -1
  81. package/api/operators/await.js.map +1 -1
  82. package/api/operators/binary.d.ts +2 -2
  83. package/api/operators/binary.js +1 -1
  84. package/api/operators/binary.js.map +1 -1
  85. package/api/operators/chaining.d.ts +2 -2
  86. package/api/operators/chaining.js +1 -1
  87. package/api/operators/chaining.js.map +1 -1
  88. package/api/operators/comma.d.ts +2 -2
  89. package/api/operators/comma.js +2 -2
  90. package/api/operators/comma.js.map +1 -1
  91. package/api/operators/grouping.d.ts +9 -2
  92. package/api/operators/grouping.js +8 -1
  93. package/api/operators/grouping.js.map +1 -1
  94. package/api/operators/logical.d.ts +2 -2
  95. package/api/operators/logical.js +1 -1
  96. package/api/operators/logical.js.map +1 -1
  97. package/api/operators/pipeline.d.ts +14 -2
  98. package/api/operators/pipeline.js +13 -1
  99. package/api/operators/pipeline.js.map +1 -1
  100. package/api/operators/ternary.d.ts +2 -2
  101. package/api/operators/ternary.js +1 -1
  102. package/api/operators/ternary.js.map +1 -1
  103. package/api/operators/unary.d.ts +3 -3
  104. package/api/operators/unary.js +7 -3
  105. package/api/operators/unary.js.map +1 -1
  106. package/api/operators/update.d.ts +2 -2
  107. package/api/operators/update.js +1 -1
  108. package/api/operators/update.js.map +1 -1
  109. package/api/{app/program.d.ts → program.d.ts} +8 -9
  110. package/api/program.js +45 -0
  111. package/api/program.js.map +1 -0
  112. package/api/statement/control/block.d.ts +8 -5
  113. package/api/statement/control/block.js +26 -23
  114. package/api/statement/control/block.js.map +1 -1
  115. package/api/statement/control/empty.d.ts +8 -1
  116. package/api/statement/control/empty.js +7 -0
  117. package/api/statement/control/empty.js.map +1 -1
  118. package/api/statement/control/if.d.ts +7 -2
  119. package/api/statement/control/if.js +6 -1
  120. package/api/statement/control/if.js.map +1 -1
  121. package/api/statement/control/switch.d.ts +10 -5
  122. package/api/statement/control/switch.js +22 -9
  123. package/api/statement/control/switch.js.map +1 -1
  124. package/api/statement/control/terminate.d.ts +46 -13
  125. package/api/statement/control/terminate.js +89 -20
  126. package/api/statement/control/terminate.js.map +1 -1
  127. package/api/statement/declarations/declares.d.ts +17 -16
  128. package/api/statement/declarations/declares.js +24 -19
  129. package/api/statement/declarations/declares.js.map +1 -1
  130. package/api/statement/iterations/for.d.ts +10 -5
  131. package/api/statement/iterations/for.js +42 -23
  132. package/api/statement/iterations/for.js.map +1 -1
  133. package/api/statement/iterations/while.d.ts +9 -3
  134. package/api/statement/iterations/while.js +27 -13
  135. package/api/statement/iterations/while.js.map +1 -1
  136. package/api/utils.d.ts +5 -0
  137. package/api/utils.js +4 -0
  138. package/api/utils.js.map +1 -0
  139. package/package.json +5 -5
  140. package/scope/finalizer.d.ts +4 -0
  141. package/scope/finalizer.js +11 -0
  142. package/scope/finalizer.js.map +1 -0
  143. package/scope/proxy.d.ts +5 -3
  144. package/scope/proxy.js +26 -26
  145. package/scope/proxy.js.map +1 -1
  146. package/scope/scope.d.ts +108 -51
  147. package/scope/scope.js +72 -134
  148. package/scope/scope.js.map +1 -1
  149. package/scope/stack.d.ts +117 -26
  150. package/scope/stack.js +154 -102
  151. package/scope/stack.js.map +1 -1
  152. package/v8/enums.d.ts +204 -0
  153. package/v8/enums.js +406 -0
  154. package/v8/enums.js.map +1 -0
  155. package/v8/index.d.ts +2 -1
  156. package/v8/index.js +2 -1
  157. package/v8/index.js.map +1 -1
  158. package/v8/inline.d.ts +213 -0
  159. package/v8/inline.js +2375 -0
  160. package/v8/inline.js.map +1 -0
  161. package/v8/nodes.d.ts +8 -7
  162. package/v8/nodes.js +39 -64
  163. package/v8/nodes.js.map +1 -1
  164. package/v8/parser.d.ts +49 -151
  165. package/v8/parser.js +839 -1607
  166. package/v8/parser.js.map +1 -1
  167. package/v8/stream.d.ts +39 -3
  168. package/v8/stream.js +685 -171
  169. package/v8/stream.js.map +1 -1
  170. package/v8/token.d.ts +244 -9
  171. package/v8/token.js +315 -47
  172. package/v8/token.js.map +1 -1
  173. package/visit/visitor.d.ts +3 -0
  174. package/visit/visitor.js +4 -7
  175. package/visit/visitor.js.map +1 -1
  176. package/api/app/class.d.ts +0 -117
  177. package/api/app/class.js +0 -292
  178. package/api/app/class.js.map +0 -1
  179. package/api/app/program.js +0 -39
  180. package/api/app/program.js.map +0 -1
  181. package/api/module/module.d.ts +0 -26
  182. package/api/module/module.js +0 -63
  183. package/api/module/module.js.map +0 -1
  184. package/v8/app.d.ts +0 -0
  185. package/v8/app.js +0 -2
  186. package/v8/app.js.map +0 -1
@@ -1,67 +1,214 @@
1
- var ExportNode_1;
1
+ /**
2
+ * There are two types of exports:
3
+ * 1- Named Exports (Zero or more exports per module)
4
+ * 2- Default Exports (One per module)
5
+ *
6
+ * // Exporting individual features
7
+ * export let name1, name2, …, nameN; // also var, const
8
+ * export let name1 = …, name2 = …, …, nameN; // also var, const
9
+ * export function functionName(){...}
10
+ * export class ClassName {...}
11
+ *
12
+ * // Export list
13
+ * export { name1, name2, …, nameN };
14
+ *
15
+ * // Renaming exports
16
+ * export { variable1 as name1, variable2 as name2, …, nameN };
17
+ *
18
+ * // Exporting destructed assignments with renaming
19
+ * export const { name1, name2: bar } = o;
20
+ *
21
+ * // Default exports
22
+ * export default expression;
23
+ * export default function (…) { … } // also class, function*
24
+ * export default function name1(…) { … } // also class, function*
25
+ * export { name1 as default, … };
26
+ *
27
+ * // Aggregating modules
28
+ * export * from …; // does not set the default export
29
+ * export * as name1 from …; // Draft ECMAScript® 2O21
30
+ * export { name1, name2, …, nameN } from …;
31
+ * export { import1 as name1, import2 as name2, …, nameN } from …;
32
+ * export { default, … } from …;
33
+ */
34
+ var ExportSpecifier_1, ExportNamedDeclaration_1, ExportDefaultDeclaration_1, ExportAllDeclaration_1;
2
35
  import { __decorate, __metadata } from "tslib";
36
+ import { ReactiveScope } from '../../scope/scope.js';
3
37
  import { AbstractExpressionNode } from '../abstract.js';
4
38
  import { Deserializer } from '../deserialize/deserialize.js';
5
- export class ExportAliasName {
6
- constructor(exportName, _aliasName) {
7
- this.exportName = exportName;
8
- this._aliasName = _aliasName;
39
+ import { Identifier, Literal } from '../definition/values.js';
40
+ import { ModuleSpecifier } from './common.js';
41
+ /**
42
+ * An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` in `export {bar as foo}`.
43
+ *
44
+ * The `exported` field refers to the name exported in the module.
45
+ *
46
+ * The `local` field refers to the binding into the local module scope.
47
+ *
48
+ * If it is a basic named export, such as in `export {foo}`, both `exported` and `local` are equivalent `Identifier` nodes;
49
+ * in this case an Identifier node representing `foo`.
50
+ *
51
+ * If it is an aliased export,
52
+ * such as in `export {bar as foo}`, the `exported` field is an `Identifier` node representing `foo`,
53
+ * and the `local` field is an `Identifier` node representing `bar`.
54
+ */
55
+ let ExportSpecifier = ExportSpecifier_1 = class ExportSpecifier extends ModuleSpecifier {
56
+ constructor(local, exported) {
57
+ super(local);
58
+ this.exported = exported;
9
59
  }
10
- static visit(node, visitNode, visitNodeList) {
11
- visitNode(node.exportName);
12
- node.aliasName && visitNode(node.aliasName);
60
+ static fromJSON(node, deserializer) {
61
+ return new ExportSpecifier_1(deserializer(node.local), deserializer(node.exported));
62
+ }
63
+ static visit(node, visitNode) {
64
+ visitNode(node.local);
65
+ visitNode(node.exported);
66
+ }
67
+ getExported() {
68
+ return this.exported;
69
+ }
70
+ shareVariables(scopeList) {
71
+ }
72
+ set(stack, value) {
73
+ throw new Error('Method not implemented.');
13
74
  }
14
- get aliasName() {
15
- return this._aliasName || this.exportName;
75
+ get(stack, thisContext) {
76
+ throw new Error('Method not implemented.');
16
77
  }
17
- set aliasName(_aliasName) {
18
- this._aliasName = _aliasName;
78
+ dependency(computed) {
79
+ return [];
80
+ }
81
+ dependencyPath(computed) {
82
+ return [];
19
83
  }
20
84
  toString() {
21
- if (this._aliasName) {
22
- return `${this.exportName.toString()} as ${this._aliasName.toString()}`;
85
+ const local = this.local.toString();
86
+ const exported = this.exported.toString();
87
+ if (local == exported) {
88
+ return local;
23
89
  }
24
- return this.exportName.toString();
90
+ return `${local} as ${exported}`;
25
91
  }
26
- toJSON() {
92
+ toJson() {
27
93
  return {
28
- exportName: this.exportName.toJSON(),
29
- aliasName: this._aliasName?.toJSON()
94
+ local: this.local.toJSON(),
95
+ exported: this.exported.toJSON()
30
96
  };
31
97
  }
32
- }
33
- let ExportNode = ExportNode_1 = class ExportNode extends AbstractExpressionNode {
34
- constructor(exportList, starExport, exportExpression, moduleName) {
98
+ };
99
+ ExportSpecifier = ExportSpecifier_1 = __decorate([
100
+ Deserializer('ExportSpecifier'),
101
+ __metadata("design:paramtypes", [Identifier, Identifier])
102
+ ], ExportSpecifier);
103
+ export { ExportSpecifier };
104
+ /**
105
+ * An export named declaration, e.g.,
106
+ * `export {foo, bar};`,
107
+ * `export {foo} from "mod";`
108
+ * or `export var foo = 1;`.
109
+ *
110
+ * Note: Having `declaration` populated with non-empty `specifiers` or non-null `source` results in an invalid state.
111
+ */
112
+ let ExportNamedDeclaration = ExportNamedDeclaration_1 = class ExportNamedDeclaration extends AbstractExpressionNode {
113
+ constructor(specifiers, declaration, source, assertions) {
35
114
  super();
36
- this.exportList = exportList;
37
- this.starExport = starExport;
38
- this.exportExpression = exportExpression;
39
- this.moduleName = moduleName;
115
+ this.specifiers = specifiers;
116
+ this.declaration = declaration;
117
+ this.source = source;
118
+ this.assertions = assertions;
40
119
  }
41
120
  static fromJSON(node, deserializer) {
42
- return new ExportNode_1(node.exportList?.map(expo => new ExportAliasName(deserializer(expo.exportName), deserializer(expo.aliasName))), node.starExport ? new ExportAliasName(deserializer(node.starExport.exportName), deserializer(node.starExport.aliasName)) : void 0, node.exportExpression ? new ExportAliasName(deserializer(node.exportExpression.exportName), deserializer(node.exportExpression.aliasName)) : void 0, node.moduleName ? deserializer(node.moduleName) : void 0);
121
+ return new ExportNamedDeclaration_1(node.specifiers.map(deserializer), node.declaration ? deserializer(node.declaration) : void 0, node.source ? deserializer(node.source) : void 0, node.assertions ? node.assertions.map(deserializer) : void 0);
122
+ }
123
+ static visit(node, visitNode) {
124
+ node.specifiers.map(visitNode);
125
+ node.source && visitNode(node.source);
126
+ node.declaration && visitNode(node.declaration);
127
+ node.assertions?.forEach(visitNode);
43
128
  }
44
- static visit(node, visitNode, visitNodeList) {
45
- node.exportList?.map(expo => ExportAliasName.visit(expo, visitNode, visitNodeList));
46
- node.starExport && ExportAliasName.visit(node.starExport, visitNode, visitNodeList);
47
- node.exportExpression && ExportAliasName.visit(node.exportExpression, visitNode, visitNodeList);
48
- node.moduleName && visitNode(node.moduleName);
129
+ getSource() {
130
+ return this.source;
49
131
  }
50
- getModuleName() {
51
- return this.moduleName;
132
+ getSpecifiers() {
133
+ return this.specifiers;
52
134
  }
53
- getExportExpression() {
54
- return this.exportExpression;
135
+ getDeclaration() {
136
+ return this.declaration;
55
137
  }
56
- getExportList() {
57
- return this.exportList;
138
+ getAssertions() {
139
+ return this.assertions;
58
140
  }
59
141
  shareVariables(scopeList) { }
60
142
  set(stack) {
61
- throw new Error(`ExportNode.#set() has no implementation.`);
143
+ throw new Error(`ExportNamedDeclaration.#set() has no implementation.`);
62
144
  }
63
145
  get(stack) {
64
- throw new Error(`ExportNode.#get() has no implementation.`);
146
+ if (this.declaration) {
147
+ this.exportDeclaration(stack);
148
+ }
149
+ else if (this.source) {
150
+ this.exportFromSource(stack);
151
+ }
152
+ else {
153
+ this.exportLocal(stack);
154
+ }
155
+ }
156
+ exportDeclaration(stack) {
157
+ if (!this.declaration) {
158
+ return;
159
+ }
160
+ const declaration = this.declaration.get(stack);
161
+ const declaredName = this.declaration.getDeclarationName();
162
+ if (!declaredName) {
163
+ throw new Error(`Name is not defined for ${declaration.toString()}`);
164
+ }
165
+ stack.getModule().set(declaredName, declaration);
166
+ }
167
+ exportFromSource(stack) {
168
+ if (!this.source) {
169
+ return;
170
+ }
171
+ let importCallOptions;
172
+ if (this.assertions) {
173
+ const importAssertions = this.assertions
174
+ .map(assertion => assertion.get(stack))
175
+ .reduce((p, c) => Object.assign(p, c), {});
176
+ if (importAssertions) {
177
+ importCallOptions = { assert: importAssertions };
178
+ }
179
+ }
180
+ const sourceModule = stack.importModule(this.source.get(), importCallOptions);
181
+ const localModule = stack.getModule();
182
+ this.specifiers.forEach(specifier => {
183
+ const localName = specifier.getLocal().get(stack);
184
+ const exportedName = specifier.getExported().get(stack);
185
+ const localValue = sourceModule.get(localName);
186
+ localModule.set(exportedName, localValue);
187
+ const scopeSubscription = sourceModule.subscribe(localName, (newLocalValue, oldLocalValue) => {
188
+ if (newLocalValue !== oldLocalValue) {
189
+ localModule.set(exportedName, newLocalValue);
190
+ }
191
+ });
192
+ stack.onDestroy(() => scopeSubscription.unsubscribe());
193
+ });
194
+ }
195
+ exportLocal(stack, importCallOptions) {
196
+ const localModule = stack.getModule();
197
+ this.specifiers.forEach(specifier => {
198
+ const localName = specifier.getLocal().get(stack);
199
+ const exportedName = specifier.getExported().get(stack);
200
+ const localValue = stack.get(localName);
201
+ localModule.set(exportedName, localValue);
202
+ const scope = stack.findScope(localName);
203
+ if (scope instanceof ReactiveScope) {
204
+ const scopeSubscription = scope.subscribe(localName, (newLocalValue, oldLocalValue) => {
205
+ if (newLocalValue !== oldLocalValue) {
206
+ localModule.set(exportedName, newLocalValue);
207
+ }
208
+ });
209
+ stack.onDestroy(() => scopeSubscription.unsubscribe());
210
+ }
211
+ });
65
212
  }
66
213
  dependency(computed) {
67
214
  return [];
@@ -70,33 +217,161 @@ let ExportNode = ExportNode_1 = class ExportNode extends AbstractExpressionNode
70
217
  return [];
71
218
  }
72
219
  toString() {
73
- if (this.exportList && this.moduleName) {
74
- return `export { ${this.exportList.map(expo => expo.toString()).join(', ')} } from '${this.moduleName.toString()}';`;
220
+ if (this.declaration) {
221
+ const declaration = this.declaration.toString();
222
+ return `export ${declaration}`;
75
223
  }
76
- if (this.starExport && this.moduleName) {
77
- return `export ${this.starExport.toString()} from '${this.moduleName.toString()}';`;
224
+ const specifiers = this.specifiers.map(specifier => specifier.toString()).join(',');
225
+ let exportStr = `export {${specifiers}}`;
226
+ if (!this.source) {
227
+ return `${exportStr};`;
78
228
  }
79
- if (this.exportList) {
80
- return `export { ${this.exportList.map(expo => expo.toString()).join(', ')} };`;
229
+ const source = this.source.toString();
230
+ return `${exportStr} from ${source}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
231
+ }
232
+ toJson() {
233
+ return {
234
+ specifiers: this.specifiers.map(specifier => specifier.toJSON()),
235
+ source: this.source?.toJSON(),
236
+ declaration: this.declaration?.toJSON(),
237
+ assertions: this.assertions?.map(assertion => assertion.toJSON()),
238
+ };
239
+ }
240
+ };
241
+ ExportNamedDeclaration = ExportNamedDeclaration_1 = __decorate([
242
+ Deserializer('ExportNamedDeclaration'),
243
+ __metadata("design:paramtypes", [Array, Object, Literal, Array])
244
+ ], ExportNamedDeclaration);
245
+ export { ExportNamedDeclaration };
246
+ /**
247
+ * An export default declaration, e.g.,
248
+ * `export default function () {};`
249
+ * or `export default 1;`.
250
+ */
251
+ let ExportDefaultDeclaration = ExportDefaultDeclaration_1 = class ExportDefaultDeclaration extends AbstractExpressionNode {
252
+ constructor(declaration) {
253
+ super();
254
+ this.declaration = declaration;
255
+ }
256
+ static fromJSON(node, deserializer) {
257
+ return new ExportDefaultDeclaration_1(deserializer(node.declaration));
258
+ }
259
+ static visit(node, visitNode) {
260
+ visitNode(node.declaration);
261
+ }
262
+ getDeclaration() {
263
+ return this.declaration;
264
+ }
265
+ shareVariables(scopeList) { }
266
+ set(stack) {
267
+ throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
268
+ }
269
+ get(stack) {
270
+ const declaration = this.declaration.get(stack);
271
+ stack.getModule().set('default', declaration);
272
+ }
273
+ dependency(computed) {
274
+ return [];
275
+ }
276
+ dependencyPath(computed) {
277
+ return [];
278
+ }
279
+ toString() {
280
+ const declaration = this.declaration.toString();
281
+ return `export default ${declaration}`;
282
+ }
283
+ toJson() {
284
+ return {
285
+ declaration: this.declaration.toJSON(),
286
+ };
287
+ }
288
+ };
289
+ ExportDefaultDeclaration = ExportDefaultDeclaration_1 = __decorate([
290
+ Deserializer('ExportDefaultDeclaration'),
291
+ __metadata("design:paramtypes", [Object])
292
+ ], ExportDefaultDeclaration);
293
+ export { ExportDefaultDeclaration };
294
+ /**
295
+ * An export batch declaration, e.g., `export * from "mod";`.
296
+ */
297
+ let ExportAllDeclaration = ExportAllDeclaration_1 = class ExportAllDeclaration extends AbstractExpressionNode {
298
+ constructor(source, exported, assertions) {
299
+ super();
300
+ this.source = source;
301
+ this.exported = exported;
302
+ this.assertions = assertions;
303
+ }
304
+ static fromJSON(node, deserializer) {
305
+ return new ExportAllDeclaration_1(deserializer(node.source), node.exported ? deserializer(node.exported) : void 0, node.assertions?.map(deserializer));
306
+ }
307
+ static visit(node, visitNode) {
308
+ visitNode(node.source);
309
+ node.exported && visitNode(node.exported);
310
+ node.assertions?.forEach(visitNode);
311
+ }
312
+ getSource() {
313
+ return this.source;
314
+ }
315
+ getExported() {
316
+ return this.exported;
317
+ }
318
+ getAssertions() {
319
+ return this.assertions;
320
+ }
321
+ shareVariables(scopeList) { }
322
+ set(stack) {
323
+ throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
324
+ }
325
+ get(stack) {
326
+ let importCallOptions;
327
+ if (this.assertions) {
328
+ const importAssertions = this.assertions
329
+ .map(assertion => assertion.get(stack))
330
+ .reduce((p, c) => Object.assign(p, c), {});
331
+ if (importAssertions) {
332
+ importCallOptions = { assert: importAssertions };
333
+ }
81
334
  }
82
- if (this.exportExpression) {
83
- return `export ${this.exportExpression.toString()};`;
335
+ let localModule = stack.getModule();
336
+ const sourceModule = stack.importModule(this.source.get(), importCallOptions);
337
+ if (this.exported) {
338
+ const exportedName = this.exported.get(stack);
339
+ localModule.set(exportedName, {});
340
+ localModule = localModule.getScope(exportedName);
84
341
  }
85
- throw new Error(`not enough params found,at least 'exportExpression' should be initialized.`);
342
+ const properties = Object.keys(sourceModule.getContext());
343
+ properties.forEach(property => {
344
+ const localValue = sourceModule.get(property);
345
+ localModule.set(property, localValue);
346
+ const scopeSubscription = sourceModule.subscribe(property, (newLocalValue, oldLocalValue) => {
347
+ if (newLocalValue !== oldLocalValue) {
348
+ localModule.set(property, newLocalValue);
349
+ }
350
+ });
351
+ stack.onDestroy(() => scopeSubscription.unsubscribe());
352
+ });
353
+ }
354
+ dependency(computed) {
355
+ return [];
356
+ }
357
+ dependencyPath(computed) {
358
+ return [];
359
+ }
360
+ toString() {
361
+ return `export *${this.exported ? ` as ${this.exported.toString()}` : ''} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
86
362
  }
87
363
  toJson() {
88
364
  return {
89
- exportList: this.exportList?.map(expression => expression.toJSON()),
90
- starExport: this.starExport?.toJSON(),
91
- exportExpression: this.exportExpression?.toJSON(),
92
- moduleName: this.moduleName?.toJSON(),
365
+ source: this.source.toJSON(),
366
+ exported: this.exported?.toJSON(),
367
+ assertions: this.assertions?.map(assertion => assertion.toJSON()),
93
368
  };
94
369
  }
95
370
  };
96
- ExportNode = ExportNode_1 = __decorate([
97
- Deserializer('export'),
98
- __metadata("design:paramtypes", [Array, ExportAliasName,
99
- ExportAliasName, Object])
100
- ], ExportNode);
101
- export { ExportNode };
371
+ ExportAllDeclaration = ExportAllDeclaration_1 = __decorate([
372
+ Deserializer('ExportAllDeclaration'),
373
+ __metadata("design:paramtypes", [Literal,
374
+ Identifier, Array])
375
+ ], ExportAllDeclaration);
376
+ export { ExportAllDeclaration };
102
377
  //# sourceMappingURL=export.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../src/expressions/api/module/export.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,MAAM,OAAO,eAAe;IAK3B,YAAmB,UAA0B,EAAY,UAA2B;QAAjE,eAAU,GAAV,UAAU,CAAgB;QAAY,eAAU,GAAV,UAAU,CAAiB;IAAI,CAAC;IAJzF,MAAM,CAAC,KAAK,CAAC,IAAqB,EAAE,SAAwB,EAAE,aAAgC;QAC7F,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3B,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC;IAGD,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC;IAC3C,CAAC;IAED,IAAW,SAAS,CAAC,U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UAAU;IADtB,YAAY,CAAC,QAAQ,CAAC;4CAkBA,eAAe;QACT,eAAe;GAlB/B,UAAU,CAqEtB;SArEY,UAAU","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode, ExpressionEventPath,\n\tVisitNodeType, VisitNodeListType\n} from '../expression.js';\nimport type { Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\n\nexport class ExportAliasName {\n\tstatic visit(node: ExportAliasName, visitNode: VisitNodeType, visitNodeList: VisitNodeListType): void {\n\t\tvisitNode(node.exportName);\n\t\tnode.aliasName && visitNode(node.aliasName);\n\t}\n\tconstructor(public exportName: ExpressionNode, protected _aliasName?: ExpressionNode) { }\n\n\tpublic get aliasName(): ExpressionNode {\n\t\treturn this._aliasName || this.exportName;\n\t}\n\n\tpublic set aliasName(_aliasName: ExpressionNode) {\n\t\tthis._aliasName = _aliasName;\n\t}\n\n\ttoString() {\n\t\tif (this._aliasName) {\n\t\t\treturn `${this.exportName.toString()} as ${this._aliasName.toString()}`;\n\t\t}\n\t\treturn this.exportName.toString();\n\t}\n\n\ttoJSON() {\n\t\treturn {\n\t\t\texportName: this.exportName.toJSON(),\n\t\t\taliasName: this._aliasName?.toJSON()\n\t\t};\n\t}\n}\n\n/**\n * There are two types of exports:\n * 1- Named Exports (Zero or more exports per module)\n * 2- Default Exports (One per module)\n * \n * // Exporting individual features\n * export let name1, name2, …, nameN; // also var, const\n * export let name1 = …, name2 = …, …, nameN; // also var, const\n * export function functionName(){...}\n * export class ClassName {...}\n * \n * // Export list\n * export { name1, name2, …, nameN };\n * \n * // Renaming exports\n * export { variable1 as name1, variable2 as name2, …, nameN };\n * \n * // Exporting destructed assignments with renaming\n * export const { name1, name2: bar } = o;\n * \n * // Default exports\n * export default expression;\n * export default function (…) { … } // also class, function*\n * export default function name1(…) { … } // also class, function*\n * export { name1 as default, … };\n * \n * // Aggregating modules\n * export * from …; // does not set the default export\n * export * as name1 from …; // Draft ECMAScript® 2O21\n * export { name1, name2, …, nameN } from …;\n * export { import1 as name1, import2 as name2, …, nameN } from …;\n * export { default, … } from …;\n */\n@Deserializer('export')\nexport class ExportNode extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportNode, deserializer: NodeDeserializer): ExportNode {\n\t\treturn new ExportNode(\n\t\t\tnode.exportList?.map(expo => new ExportAliasName(deserializer(expo.exportName), deserializer(expo.aliasName))),\n\t\t\tnode.starExport ? new ExportAliasName(deserializer(node.starExport.exportName), deserializer(node.starExport.aliasName)) : void 0,\n\t\t\tnode.exportExpression ? new ExportAliasName(deserializer(node.exportExpression.exportName), deserializer(node.exportExpression.aliasName)) : void 0,\n\t\t\tnode.moduleName ? deserializer(node.moduleName) : void 0\n\t\t);\n\t}\n\tstatic visit(node: ExportNode, visitNode: VisitNodeType, visitNodeList: VisitNodeListType): void {\n\t\tnode.exportList?.map(expo => ExportAliasName.visit(expo, visitNode, visitNodeList));\n\t\tnode.starExport && ExportAliasName.visit(node.starExport, visitNode, visitNodeList);\n\t\tnode.exportExpression && ExportAliasName.visit(node.exportExpression, visitNode, visitNodeList);\n\t\tnode.moduleName && visitNode(node.moduleName);\n\t}\n\tconstructor(\n\t\tprivate exportList?: ExportAliasName[],\n\t\tprivate starExport?: ExportAliasName,\n\t\tprivate exportExpression?: ExportAliasName,\n\t\tprivate moduleName?: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetModuleName() {\n\t\treturn this.moduleName;\n\t}\n\tgetExportExpression() {\n\t\treturn this.exportExpression;\n\t}\n\tgetExportList() {\n\t\treturn this.exportList;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportNode.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tthrow new Error(`ExportNode.#get() has no implementation.`);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\t// Aggregating modules\n\t\tif (this.exportList && this.moduleName) {\n\t\t\treturn `export { ${this.exportList.map(expo => expo.toString()).join(', ')} } from '${this.moduleName.toString()}';`;\n\t\t}\n\t\tif (this.starExport && this.moduleName) {\n\t\t\treturn `export ${this.starExport.toString()} from '${this.moduleName.toString()}';`;\n\t\t}\n\n\t\tif (this.exportList) {\n\t\t\treturn `export { ${this.exportList.map(expo => expo.toString()).join(', ')} };`;\n\t\t}\n\t\tif (this.exportExpression) {\n\t\t\treturn `export ${this.exportExpression.toString()};`;\n\t\t}\n\t\tthrow new Error(`not enough params found,at least 'exportExpression' should be initialized.`);\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\texportList: this.exportList?.map(expression => expression.toJSON()),\n\t\t\tstarExport: this.starExport?.toJSON(),\n\t\t\texportExpression: this.exportExpression?.toJSON(),\n\t\t\tmoduleName: this.moduleName?.toJSON(),\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../src/expressions/api/module/export.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;AAMH,OAAO,EAAiB,aAAa,EAAS,MAAM,sBAAsB,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAmB,eAAe,EAAE,MAAM,aAAa,CAAC;AAK/D;;;;;;;;;;;;;GAaG;AAEH,IAAa,eAAe,uBAA5B,MAAa,eAAgB,SAAQ,eAAe;IAWnD,YAAY,KAAiB,EAAU,QAAoB;QAC1D,KAAK,CAAC,KAAK,CAAC,CAAC;QADyB,aAAQ,GAAR,QAAQ,CAAY;IAE3D,CAA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,EAAE,CAAC;IACX,CAAC;IACD,QAAQ;QACP,OAAO,WAAW,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;IACxN,CAAC;IACD,MAAM;QACL,OAAO;YACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE;YACjC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;SACjE,CAAC;IACH,CAAC;CACD,CAAA;AAhFY,oBAAoB;IADhC,YAAY,CAAC,sBAAsB,CAAC;qCAenB,OAAO;QACJ,UAAU;GAflB,oBAAoB,CAgFhC;SAhFY,oBAAoB","sourcesContent":["\n/**\n * There are two types of exports:\n * 1- Named Exports (Zero or more exports per module)\n * 2- Default Exports (One per module)\n * \n * // Exporting individual features\n * export let name1, name2, …, nameN; // also var, const\n * export let name1 = …, name2 = …, …, nameN; // also var, const\n * export function functionName(){...}\n * export class ClassName {...}\n * \n * // Export list\n * export { name1, name2, …, nameN };\n * \n * // Renaming exports\n * export { variable1 as name1, variable2 as name2, …, nameN };\n * \n * // Exporting destructed assignments with renaming\n * export const { name1, name2: bar } = o;\n * \n * // Default exports\n * export default expression;\n * export default function (…) { … } // also class, function*\n * export default function name1(…) { … } // also class, function*\n * export { name1 as default, … };\n * \n * // Aggregating modules\n * export * from …; // does not set the default export\n * export * as name1 from …; // Draft ECMAScript® 2O21\n * export { name1, name2, …, nameN } from …;\n * export { import1 as name1, import2 as name2, …, nameN } from …;\n * export { default, … } from …;\n */\n\nimport type {\n\tNodeDeserializer, ExpressionNode,\n\tExpressionEventPath, VisitNodeType, DeclarationExpression\n} from '../expression.js';\nimport { ModuleContext, ReactiveScope, Scope } from '../../scope/scope.js';\nimport { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { Identifier, Literal } from '../definition/values.js';\nimport { ImportAttribute, ModuleSpecifier } from './common.js';\nimport { FunctionDeclaration } from '../definition/function.js';\nimport { ClassDeclaration } from '../class/class.js';\n\n\n/**\n * An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` in `export {bar as foo}`.\n * \n * The `exported` field refers to the name exported in the module.\n * \n * The `local` field refers to the binding into the local module scope.\n * \n * If it is a basic named export, such as in `export {foo}`, both `exported` and `local` are equivalent `Identifier` nodes;\n * in this case an Identifier node representing `foo`.\n * \n * If it is an aliased export,\n * such as in `export {bar as foo}`, the `exported` field is an `Identifier` node representing `foo`,\n * and the `local` field is an `Identifier` node representing `bar`.\n */\n@Deserializer('ExportSpecifier')\nexport class ExportSpecifier extends ModuleSpecifier {\n\tstatic fromJSON(node: ExportSpecifier, deserializer: NodeDeserializer): ExportSpecifier {\n\t\treturn new ExportSpecifier(\n\t\t\tdeserializer(node.local) as Identifier,\n\t\t\tdeserializer(node.exported) as Identifier\n\t\t);\n\t}\n\tstatic visit(node: ExportSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\n\t\tvisitNode(node.exported);\n\t}\n\tconstructor(local: Identifier, private exported: Identifier) {\n\t\tsuper(local);\n\t}\n\tgetExported() {\n\t\treturn this.exported;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\tconst local = this.local.toString();\n\t\tconst exported = this.exported.toString();\n\t\tif (local == exported) {\n\t\t\treturn local;\n\t\t}\n\t\treturn `${local} as ${exported}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tlocal: this.local.toJSON(),\n\t\t\texported: this.exported.toJSON()\n\t\t};\n\t}\n}\n\n\n/**\n * An export named declaration, e.g.,\n * `export {foo, bar};`,\n * `export {foo} from \"mod\";`\n * or `export var foo = 1;`.\n * \n * Note: Having `declaration` populated with non-empty `specifiers` or non-null `source` results in an invalid state.\n */\n@Deserializer('ExportNamedDeclaration')\nexport class ExportNamedDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportNamedDeclaration, deserializer: NodeDeserializer): ExportNamedDeclaration {\n\t\treturn new ExportNamedDeclaration(\n\t\t\tnode.specifiers.map(deserializer) as ExportSpecifier[],\n\t\t\tnode.declaration ? deserializer(node.declaration) as DeclarationExpression : void 0,\n\t\t\tnode.source ? deserializer(node.source) as Literal<string> : void 0,\n\t\t\tnode.assertions ? node.assertions.map(deserializer) as ImportAttribute[] : void 0,\n\t\t);\n\t}\n\tstatic visit(node: ExportNamedDeclaration, visitNode: VisitNodeType): void {\n\t\tnode.specifiers.map(visitNode);\n\t\tnode.source && visitNode(node.source);\n\t\tnode.declaration && visitNode(node.declaration);\n\t\tnode.assertions?.forEach(visitNode);\n\t}\n\tconstructor(\n\t\tprivate specifiers: ExportSpecifier[],\n\t\tprivate declaration?: DeclarationExpression,\n\t\tprivate source?: Literal<string>,\n\t\tprivate assertions?: ImportAttribute[],) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tgetSpecifiers() {\n\t\treturn this.specifiers;\n\t}\n\tgetDeclaration() {\n\t\treturn this.declaration;\n\t}\n\tgetAssertions() {\n\t\treturn this.assertions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportNamedDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tif (this.declaration) {\n\t\t\tthis.exportDeclaration(stack);\n\t\t}\n\t\telse if (this.source) {\n\t\t\tthis.exportFromSource(stack);\n\t\t} else {\n\t\t\tthis.exportLocal(stack);\n\t\t}\n\t}\n\n\tprivate exportDeclaration(stack: Stack) {\n\t\tif (!this.declaration) {\n\t\t\treturn\n\t\t}\n\t\tconst declaration = this.declaration.get(stack);\n\t\tconst declaredName = this.declaration.getDeclarationName!();\n\t\tif (!declaredName) {\n\t\t\tthrow new Error(`Name is not defined for ${declaration.toString()}`);\n\t\t}\n\t\tstack.getModule()!.set(declaredName, declaration);\n\t}\n\tprivate exportFromSource(stack: Stack) {\n\t\tif (!this.source) {\n\t\t\treturn;\n\t\t}\n\t\tlet importCallOptions: ImportCallOptions | undefined;\n\t\tif (this.assertions) {\n\t\t\tconst importAssertions: ImportAssertions = this.assertions\n\t\t\t\t.map(assertion => assertion.get(stack))\n\t\t\t\t.reduce((p, c) => Object.assign(p, c), {});\n\t\t\tif (importAssertions) {\n\t\t\t\timportCallOptions = { assert: importAssertions };\n\t\t\t}\n\t\t}\n\t\tconst sourceModule = stack.importModule(this.source.get(), importCallOptions);\n\t\tconst localModule = stack.getModule()!;\n\t\tthis.specifiers.forEach(specifier => {\n\t\t\tconst localName = specifier.getLocal().get(stack);\n\t\t\tconst exportedName = specifier.getExported().get(stack);\n\t\t\tconst localValue = sourceModule.get(localName);\n\t\t\tlocalModule.set(exportedName, localValue);\n\t\t\tconst scopeSubscription = sourceModule.subscribe(localName, (newLocalValue, oldLocalValue) => {\n\t\t\t\tif (newLocalValue !== oldLocalValue) {\n\t\t\t\t\tlocalModule.set(exportedName, newLocalValue);\n\t\t\t\t}\n\t\t\t});\n\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t});\n\t}\n\tprivate exportLocal(stack: Stack, importCallOptions?: ImportCallOptions) {\n\t\tconst localModule = stack.getModule()!;\n\t\tthis.specifiers.forEach(specifier => {\n\t\t\tconst localName = specifier.getLocal().get(stack);\n\t\t\tconst exportedName = specifier.getExported().get(stack);\n\t\t\tconst localValue = stack.get(localName);\n\t\t\tlocalModule.set(exportedName, localValue);\n\t\t\tconst scope = stack.findScope(localName);\n\t\t\tif (scope instanceof ReactiveScope) {\n\t\t\t\tconst scopeSubscription = scope.subscribe(localName, (newLocalValue, oldLocalValue) => {\n\t\t\t\t\tif (newLocalValue !== oldLocalValue) {\n\t\t\t\t\t\tlocalModule.set(exportedName, newLocalValue);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t\t}\n\t\t});\n\t}\n\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\tif (this.declaration) {\n\t\t\tconst declaration = this.declaration.toString();\n\t\t\treturn `export ${declaration}`;\n\t\t}\n\t\tconst specifiers = this.specifiers.map(specifier => specifier.toString()).join(',');\n\t\tlet exportStr = `export {${specifiers}}`;\n\t\tif (!this.source) {\n\t\t\treturn `${exportStr};`;\n\t\t}\n\t\tconst source = this.source.toString();\n\t\treturn `${exportStr} from ${source}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tspecifiers: this.specifiers.map(specifier => specifier.toJSON()),\n\t\t\tsource: this.source?.toJSON(),\n\t\t\tdeclaration: this.declaration?.toJSON(),\n\t\t\tassertions: this.assertions?.map(assertion => assertion.toJSON()),\n\t\t};\n\t}\n}\n\n\n/**\n * An export default declaration, e.g., \n * `export default function () {};`\n * or `export default 1;`.\n */\n@Deserializer('ExportDefaultDeclaration')\nexport class ExportDefaultDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportDefaultDeclaration, deserializer: NodeDeserializer): ExportDefaultDeclaration {\n\t\treturn new ExportDefaultDeclaration(deserializer(node.declaration));\n\t}\n\tstatic visit(node: ExportDefaultDeclaration, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.declaration);\n\t}\n\tconstructor(\n\t\tprivate declaration: FunctionDeclaration | ClassDeclaration | ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetDeclaration() {\n\t\treturn this.declaration;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportDefaultDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst declaration = this.declaration.get(stack);\n\t\tstack.getModule()!.set('default', declaration);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\tconst declaration = this.declaration.toString();\n\t\treturn `export default ${declaration}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tdeclaration: this.declaration.toJSON(),\n\t\t};\n\t}\n}\n\n/**\n * An export batch declaration, e.g., `export * from \"mod\";`.\n */\n@Deserializer('ExportAllDeclaration')\nexport class ExportAllDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportAllDeclaration, deserializer: NodeDeserializer): ExportAllDeclaration {\n\t\treturn new ExportAllDeclaration(\n\t\t\tdeserializer(node.source) as Literal<string>,\n\t\t\tnode.exported ? deserializer(node.exported) as Identifier : void 0,\n\t\t\tnode.assertions?.map(deserializer) as ImportAttribute[],\n\t\t);\n\t}\n\tstatic visit(node: ExportAllDeclaration, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.source);\n\t\tnode.exported && visitNode(node.exported);\n\t\tnode.assertions?.forEach(visitNode);\n\t}\n\tconstructor(\n\t\tprivate source: Literal<string>,\n\t\tprivate exported?: Identifier,\n\t\tprivate assertions?: ImportAttribute[],) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tgetExported() {\n\t\treturn this.exported;\n\t}\n\tgetAssertions() {\n\t\treturn this.assertions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportDefaultDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tlet importCallOptions: ImportCallOptions | undefined;\n\t\tif (this.assertions) {\n\t\t\tconst importAssertions: ImportAssertions = this.assertions\n\t\t\t\t.map(assertion => assertion.get(stack))\n\t\t\t\t.reduce((p, c) => Object.assign(p, c), {});\n\t\t\tif (importAssertions) {\n\t\t\t\timportCallOptions = { assert: importAssertions };\n\t\t\t}\n\t\t}\n\t\tlet localModule: ReactiveScope<ModuleContext> = stack.getModule()!;\n\t\tconst sourceModule = stack.importModule(this.source.get(), importCallOptions);\n\n\t\tif (this.exported) {\n\t\t\tconst exportedName = this.exported.get(stack);\n\t\t\tlocalModule.set(exportedName, {});\n\t\t\tlocalModule = localModule.getScope(exportedName)!;\n\t\t}\n\n\t\tconst properties = Object.keys(sourceModule.getContext()) as (keyof ModuleContext)[];\n\t\tproperties.forEach(property => {\n\n\t\t\tconst localValue = sourceModule.get(property);\n\t\t\tlocalModule.set(property, localValue);\n\t\t\tconst scopeSubscription = sourceModule.subscribe(property, (newLocalValue, oldLocalValue) => {\n\t\t\t\tif (newLocalValue !== oldLocalValue) {\n\t\t\t\t\tlocalModule.set(property, newLocalValue);\n\t\t\t\t}\n\t\t\t});\n\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t});\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\treturn `export *${this.exported ? ` as ${this.exported.toString()}` : ''} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tsource: this.source.toJSON(),\n\t\t\texported: this.exported?.toJSON(),\n\t\t\tassertions: this.assertions?.map(assertion => assertion.toJSON()),\n\t\t};\n\t}\n}\n"]}