@ibyar/expressions 0.8.6 → 1.0.0

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 (243) hide show
  1. package/api/abstract.d.ts +1 -0
  2. package/api/abstract.d.ts.map +1 -0
  3. package/api/abstract.js +12 -0
  4. package/api/abstract.js.map +1 -1
  5. package/api/class/class.d.ts +1 -0
  6. package/api/class/class.d.ts.map +1 -0
  7. package/api/class/class.js +563 -482
  8. package/api/class/class.js.map +1 -1
  9. package/api/class/decorator.d.ts +1 -0
  10. package/api/class/decorator.d.ts.map +1 -0
  11. package/api/class/decorator.js +49 -42
  12. package/api/class/decorator.js.map +1 -1
  13. package/api/computing/call.d.ts +1 -0
  14. package/api/computing/call.d.ts.map +1 -0
  15. package/api/computing/call.js +79 -70
  16. package/api/computing/call.js.map +1 -1
  17. package/api/computing/debugger.d.ts +1 -0
  18. package/api/computing/debugger.d.ts.map +1 -0
  19. package/api/computing/debugger.js +36 -29
  20. package/api/computing/debugger.js.map +1 -1
  21. package/api/computing/new.d.ts +1 -0
  22. package/api/computing/new.d.ts.map +1 -0
  23. package/api/computing/new.js +77 -69
  24. package/api/computing/new.js.map +1 -1
  25. package/api/computing/rest.d.ts +1 -0
  26. package/api/computing/rest.d.ts.map +1 -0
  27. package/api/computing/rest.js +50 -43
  28. package/api/computing/rest.js.map +1 -1
  29. package/api/computing/return.d.ts +1 -0
  30. package/api/computing/return.d.ts.map +1 -0
  31. package/api/computing/return.js +48 -41
  32. package/api/computing/return.js.map +1 -1
  33. package/api/computing/spread.d.ts +1 -0
  34. package/api/computing/spread.d.ts.map +1 -0
  35. package/api/computing/spread.js +66 -59
  36. package/api/computing/spread.js.map +1 -1
  37. package/api/computing/throw.d.ts +1 -0
  38. package/api/computing/throw.d.ts.map +1 -0
  39. package/api/computing/throw.js +204 -178
  40. package/api/computing/throw.js.map +1 -1
  41. package/api/computing/yield.d.ts +1 -0
  42. package/api/computing/yield.d.ts.map +1 -0
  43. package/api/computing/yield.js +56 -48
  44. package/api/computing/yield.js.map +1 -1
  45. package/api/definition/array.d.ts +1 -0
  46. package/api/definition/array.d.ts.map +1 -0
  47. package/api/definition/array.js +139 -124
  48. package/api/definition/array.js.map +1 -1
  49. package/api/definition/bind.d.ts +1 -0
  50. package/api/definition/bind.d.ts.map +1 -0
  51. package/api/definition/bind.js +81 -71
  52. package/api/definition/bind.js.map +1 -1
  53. package/api/definition/comment.d.ts +1 -0
  54. package/api/definition/comment.d.ts.map +1 -0
  55. package/api/definition/comment.js +40 -33
  56. package/api/definition/comment.js.map +1 -1
  57. package/api/definition/function.d.ts +1 -0
  58. package/api/definition/function.d.ts.map +1 -0
  59. package/api/definition/function.js +484 -447
  60. package/api/definition/function.js.map +1 -1
  61. package/api/definition/member.d.ts +1 -0
  62. package/api/definition/member.d.ts.map +1 -0
  63. package/api/definition/member.js +100 -90
  64. package/api/definition/member.js.map +1 -1
  65. package/api/definition/object.d.ts +1 -0
  66. package/api/definition/object.d.ts.map +1 -0
  67. package/api/definition/object.js +230 -202
  68. package/api/definition/object.js.map +1 -1
  69. package/api/definition/statement.d.ts +1 -0
  70. package/api/definition/statement.d.ts.map +1 -0
  71. package/api/definition/statement.js +52 -45
  72. package/api/definition/statement.js.map +1 -1
  73. package/api/definition/values.d.ts +1 -0
  74. package/api/definition/values.d.ts.map +1 -0
  75. package/api/definition/values.js +210 -167
  76. package/api/definition/values.js.map +1 -1
  77. package/api/deserialize/deserialize.d.ts +2 -1
  78. package/api/deserialize/deserialize.d.ts.map +1 -0
  79. package/api/deserialize/deserialize.js +5 -7
  80. package/api/deserialize/deserialize.js.map +1 -1
  81. package/api/deserialize/type-store.d.ts +1 -0
  82. package/api/deserialize/type-store.d.ts.map +1 -0
  83. package/api/expression.d.ts +1 -0
  84. package/api/expression.d.ts.map +1 -0
  85. package/api/index.d.ts +1 -0
  86. package/api/index.d.ts.map +1 -0
  87. package/api/module/common.d.ts +1 -0
  88. package/api/module/common.d.ts.map +1 -0
  89. package/api/module/common.js +59 -51
  90. package/api/module/common.js.map +1 -1
  91. package/api/module/export.d.ts +1 -0
  92. package/api/module/export.d.ts.map +1 -0
  93. package/api/module/export.js +327 -294
  94. package/api/module/export.js.map +1 -1
  95. package/api/module/import.d.ts +1 -0
  96. package/api/module/import.d.ts.map +1 -0
  97. package/api/module/import.js +298 -258
  98. package/api/module/import.js.map +1 -1
  99. package/api/operators/assignment.d.ts +1 -0
  100. package/api/operators/assignment.d.ts.map +1 -0
  101. package/api/operators/assignment.js +84 -75
  102. package/api/operators/assignment.js.map +1 -1
  103. package/api/operators/await.d.ts +1 -0
  104. package/api/operators/await.d.ts.map +1 -0
  105. package/api/operators/await.js +50 -43
  106. package/api/operators/await.js.map +1 -1
  107. package/api/operators/binary.d.ts +1 -0
  108. package/api/operators/binary.d.ts.map +1 -0
  109. package/api/operators/binary.js +74 -64
  110. package/api/operators/binary.js.map +1 -1
  111. package/api/operators/chaining.d.ts +1 -0
  112. package/api/operators/chaining.d.ts.map +1 -0
  113. package/api/operators/chaining.js +52 -45
  114. package/api/operators/chaining.js.map +1 -1
  115. package/api/operators/comma.d.ts +1 -0
  116. package/api/operators/comma.d.ts.map +1 -0
  117. package/api/operators/comma.js +49 -42
  118. package/api/operators/comma.js.map +1 -1
  119. package/api/operators/grouping.d.ts +1 -0
  120. package/api/operators/grouping.d.ts.map +1 -0
  121. package/api/operators/grouping.js +47 -40
  122. package/api/operators/grouping.js.map +1 -1
  123. package/api/operators/logical.d.ts +1 -0
  124. package/api/operators/logical.d.ts.map +1 -0
  125. package/api/operators/logical.js +47 -37
  126. package/api/operators/logical.js.map +1 -1
  127. package/api/operators/pipeline.d.ts +1 -0
  128. package/api/operators/pipeline.d.ts.map +1 -0
  129. package/api/operators/pipeline.js +91 -82
  130. package/api/operators/pipeline.js.map +1 -1
  131. package/api/operators/ternary.d.ts +1 -0
  132. package/api/operators/ternary.d.ts.map +1 -0
  133. package/api/operators/ternary.js +65 -56
  134. package/api/operators/ternary.js.map +1 -1
  135. package/api/operators/types.d.ts +1 -0
  136. package/api/operators/types.d.ts.map +1 -0
  137. package/api/operators/unary.d.ts +1 -0
  138. package/api/operators/unary.d.ts.map +1 -0
  139. package/api/operators/unary.js +93 -82
  140. package/api/operators/unary.js.map +1 -1
  141. package/api/operators/update.d.ts +1 -0
  142. package/api/operators/update.d.ts.map +1 -0
  143. package/api/operators/update.js +74 -62
  144. package/api/operators/update.js.map +1 -1
  145. package/api/program.d.ts +1 -0
  146. package/api/program.d.ts.map +1 -0
  147. package/api/program.js +49 -41
  148. package/api/program.js.map +1 -1
  149. package/api/statement/control/block.d.ts +1 -0
  150. package/api/statement/control/block.d.ts.map +1 -0
  151. package/api/statement/control/block.js +61 -54
  152. package/api/statement/control/block.js.map +1 -1
  153. package/api/statement/control/empty.d.ts +1 -1
  154. package/api/statement/control/empty.d.ts.map +1 -0
  155. package/api/statement/control/empty.js +39 -34
  156. package/api/statement/control/empty.js.map +1 -1
  157. package/api/statement/control/if.d.ts +1 -0
  158. package/api/statement/control/if.d.ts.map +1 -0
  159. package/api/statement/control/if.js +75 -66
  160. package/api/statement/control/if.js.map +1 -1
  161. package/api/statement/control/switch.d.ts +1 -0
  162. package/api/statement/control/switch.d.ts.map +1 -0
  163. package/api/statement/control/switch.js +168 -144
  164. package/api/statement/control/switch.js.map +1 -1
  165. package/api/statement/control/terminate.d.ts +1 -2
  166. package/api/statement/control/terminate.d.ts.map +1 -0
  167. package/api/statement/control/terminate.js +105 -81
  168. package/api/statement/control/terminate.js.map +1 -1
  169. package/api/statement/control/with.d.ts +1 -0
  170. package/api/statement/control/with.d.ts.map +1 -0
  171. package/api/statement/control/with.js +68 -60
  172. package/api/statement/control/with.js.map +1 -1
  173. package/api/statement/declarations/declares.d.ts +1 -0
  174. package/api/statement/declarations/declares.d.ts.map +1 -0
  175. package/api/statement/declarations/declares.js +140 -123
  176. package/api/statement/declarations/declares.js.map +1 -1
  177. package/api/statement/iterations/for.d.ts +1 -0
  178. package/api/statement/iterations/for.d.ts.map +1 -0
  179. package/api/statement/iterations/for.js +320 -280
  180. package/api/statement/iterations/for.js.map +1 -1
  181. package/api/statement/iterations/while.d.ts +1 -0
  182. package/api/statement/iterations/while.d.ts.map +1 -0
  183. package/api/statement/iterations/while.js +144 -127
  184. package/api/statement/iterations/while.js.map +1 -1
  185. package/api/utils.d.ts +1 -0
  186. package/api/utils.d.ts.map +1 -0
  187. package/index.d.ts +1 -0
  188. package/index.d.ts.map +1 -0
  189. package/package.json +4 -4
  190. package/scope/event.d.ts +1 -0
  191. package/scope/event.d.ts.map +1 -0
  192. package/scope/finalizer.d.ts +1 -0
  193. package/scope/finalizer.d.ts.map +1 -0
  194. package/scope/index.d.ts +1 -0
  195. package/scope/index.d.ts.map +1 -0
  196. package/scope/pool.d.ts +1 -0
  197. package/scope/pool.d.ts.map +1 -0
  198. package/scope/proxy.d.ts +1 -0
  199. package/scope/proxy.d.ts.map +1 -0
  200. package/scope/proxy.js +1 -0
  201. package/scope/proxy.js.map +1 -1
  202. package/scope/scope.d.ts +1 -0
  203. package/scope/scope.d.ts.map +1 -0
  204. package/scope/scope.js +17 -11
  205. package/scope/scope.js.map +1 -1
  206. package/scope/stack.d.ts +1 -0
  207. package/scope/stack.d.ts.map +1 -0
  208. package/scope/stack.js +21 -13
  209. package/scope/stack.js.map +1 -1
  210. package/v8/enums.d.ts +1 -0
  211. package/v8/enums.d.ts.map +1 -0
  212. package/v8/enums.js +15 -13
  213. package/v8/enums.js.map +1 -1
  214. package/v8/factory.d.ts +1 -0
  215. package/v8/factory.d.ts.map +1 -0
  216. package/v8/factory.js +3 -1
  217. package/v8/factory.js.map +1 -1
  218. package/v8/index.d.ts +1 -0
  219. package/v8/index.d.ts.map +1 -0
  220. package/v8/inline.d.ts +1 -0
  221. package/v8/inline.d.ts.map +1 -0
  222. package/v8/inline.js +9 -5
  223. package/v8/inline.js.map +1 -1
  224. package/v8/language.d.ts +1 -0
  225. package/v8/language.d.ts.map +1 -0
  226. package/v8/node.d.ts +1 -0
  227. package/v8/node.d.ts.map +1 -0
  228. package/v8/parser.d.ts +1 -0
  229. package/v8/parser.d.ts.map +1 -0
  230. package/v8/parser.js +5 -5
  231. package/v8/parser.js.map +1 -1
  232. package/v8/stream.d.ts +1 -0
  233. package/v8/stream.d.ts.map +1 -0
  234. package/v8/stream.js +19 -8
  235. package/v8/stream.js.map +1 -1
  236. package/v8/token.d.ts +1 -0
  237. package/v8/token.d.ts.map +1 -0
  238. package/v8/token.js +365 -359
  239. package/v8/token.js.map +1 -1
  240. package/visit/index.d.ts +1 -0
  241. package/visit/index.d.ts.map +1 -0
  242. package/visit/visitor.d.ts +1 -0
  243. package/visit/visitor.d.ts.map +1 -0
@@ -31,12 +31,10 @@
31
31
  * export { import1 as name1, import2 as name2, …, nameN } from …;
32
32
  * export { default, … } from …;
33
33
  */
34
- var ExportSpecifier_1, ExportNamedDeclaration_1, ExportDefaultDeclaration_1, ExportAllDeclaration_1;
35
- import { __decorate, __metadata } from "tslib";
34
+ import { __esDecorate, __runInitializers } from "tslib";
36
35
  import { ReactiveScope } from '../../scope/scope.js';
37
36
  import { AbstractExpressionNode } from '../abstract.js';
38
37
  import { Deserializer } from '../deserialize/deserialize.js';
39
- import { Identifier, Literal } from '../definition/values.js';
40
38
  import { ModuleSpecifier } from './common.js';
41
39
  /**
42
40
  * An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` in `export {bar as foo}`.
@@ -52,54 +50,61 @@ import { ModuleSpecifier } from './common.js';
52
50
  * such as in `export {bar as foo}`, the `exported` field is an `Identifier` node representing `foo`,
53
51
  * and the `local` field is an `Identifier` node representing `bar`.
54
52
  */
55
- let ExportSpecifier = ExportSpecifier_1 = class ExportSpecifier extends ModuleSpecifier {
56
- static fromJSON(node, deserializer) {
57
- return new ExportSpecifier_1(deserializer(node.local), deserializer(node.exported), node.range, node.loc);
58
- }
59
- static visit(node, visitNode) {
60
- visitNode(node.local);
61
- visitNode(node.exported);
62
- }
63
- constructor(local, exported, range, loc) {
64
- super(local, range, loc);
65
- this.exported = exported;
66
- }
67
- getExported() {
68
- return this.exported;
69
- }
70
- set(stack, value) {
71
- throw new Error('Method not implemented.');
72
- }
73
- get(stack, thisContext) {
74
- throw new Error('Method not implemented.');
75
- }
76
- dependency(computed) {
77
- return [];
78
- }
79
- dependencyPath(computed) {
80
- return [];
81
- }
82
- toString() {
83
- const local = this.local.toString();
84
- const exported = this.exported.toString();
85
- if (local == exported) {
86
- return local;
87
- }
88
- return `${local} as ${exported}`;
89
- }
90
- toJson() {
91
- return {
92
- local: this.local.toJSON(),
93
- exported: this.exported.toJSON()
94
- };
95
- }
96
- };
97
- ExportSpecifier = ExportSpecifier_1 = __decorate([
98
- Deserializer('ExportSpecifier'),
99
- __metadata("design:paramtypes", [Identifier,
100
- Identifier, Array, Object])
101
- ], ExportSpecifier);
102
- export { ExportSpecifier };
53
+ export let ExportSpecifier = (() => {
54
+ let _classDecorators = [Deserializer('ExportSpecifier')];
55
+ let _classDescriptor;
56
+ let _classExtraInitializers = [];
57
+ let _classThis;
58
+ var ExportSpecifier = class extends ModuleSpecifier {
59
+ static {
60
+ __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers);
61
+ ExportSpecifier = _classThis = _classDescriptor.value;
62
+ __runInitializers(_classThis, _classExtraInitializers);
63
+ }
64
+ exported;
65
+ static fromJSON(node, deserializer) {
66
+ return new ExportSpecifier(deserializer(node.local), deserializer(node.exported), node.range, node.loc);
67
+ }
68
+ static visit(node, visitNode) {
69
+ visitNode(node.local);
70
+ visitNode(node.exported);
71
+ }
72
+ constructor(local, exported, range, loc) {
73
+ super(local, range, loc);
74
+ this.exported = exported;
75
+ }
76
+ getExported() {
77
+ return this.exported;
78
+ }
79
+ set(stack, value) {
80
+ throw new Error('Method not implemented.');
81
+ }
82
+ get(stack, thisContext) {
83
+ throw new Error('Method not implemented.');
84
+ }
85
+ dependency(computed) {
86
+ return [];
87
+ }
88
+ dependencyPath(computed) {
89
+ return [];
90
+ }
91
+ toString() {
92
+ const local = this.local.toString();
93
+ const exported = this.exported.toString();
94
+ if (local == exported) {
95
+ return local;
96
+ }
97
+ return `${local} as ${exported}`;
98
+ }
99
+ toJson() {
100
+ return {
101
+ local: this.local.toJSON(),
102
+ exported: this.exported.toJSON()
103
+ };
104
+ }
105
+ };
106
+ return ExportSpecifier = _classThis;
107
+ })();
103
108
  /**
104
109
  * An export named declaration, e.g.,
105
110
  * `export {foo, bar};`,
@@ -108,267 +113,295 @@ export { ExportSpecifier };
108
113
  *
109
114
  * Note: Having `declaration` populated with non-empty `specifiers` or non-null `source` results in an invalid state.
110
115
  */
111
- let ExportNamedDeclaration = ExportNamedDeclaration_1 = class ExportNamedDeclaration extends AbstractExpressionNode {
112
- static fromJSON(node, deserializer) {
113
- 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, node.range, node.loc);
114
- }
115
- static visit(node, visitNode) {
116
- node.specifiers.map(visitNode);
117
- node.source && visitNode(node.source);
118
- node.declaration && visitNode(node.declaration);
119
- node.assertions?.forEach(visitNode);
120
- }
121
- constructor(specifiers, declaration, source, assertions, range, loc) {
122
- super(range, loc);
123
- this.specifiers = specifiers;
124
- this.declaration = declaration;
125
- this.source = source;
126
- this.assertions = assertions;
127
- }
128
- getSource() {
129
- return this.source;
130
- }
131
- getSpecifiers() {
132
- return this.specifiers;
133
- }
134
- getDeclaration() {
135
- return this.declaration;
136
- }
137
- getAssertions() {
138
- return this.assertions;
139
- }
140
- set(stack) {
141
- throw new Error(`ExportNamedDeclaration.#set() has no implementation.`);
142
- }
143
- get(stack) {
144
- if (this.declaration) {
145
- this.exportDeclaration(stack);
146
- }
147
- else if (this.source) {
148
- this.exportFromSource(stack);
149
- }
150
- else {
151
- this.exportLocal(stack);
152
- }
153
- }
154
- exportDeclaration(stack) {
155
- if (!this.declaration) {
156
- return;
157
- }
158
- this.declaration.get(stack);
159
- const declaredName = this.declaration.getDeclarationName?.();
160
- if (!declaredName) {
161
- throw new Error(`Name is not defined for ${this.declaration.toString()}`);
162
- }
163
- const value = stack.get(declaredName);
164
- stack.getModule().set(declaredName, value);
165
- }
166
- exportFromSource(stack) {
167
- if (!this.source) {
168
- return;
169
- }
170
- let importCallOptions;
171
- if (this.assertions) {
172
- const importAssertions = this.assertions
173
- .map(assertion => assertion.get(stack))
174
- .reduce((p, c) => Object.assign(p, c), {});
175
- if (importAssertions) {
176
- importCallOptions = { assert: importAssertions };
116
+ export let ExportNamedDeclaration = (() => {
117
+ let _classDecorators_1 = [Deserializer('ExportNamedDeclaration')];
118
+ let _classDescriptor_1;
119
+ let _classExtraInitializers_1 = [];
120
+ let _classThis_1;
121
+ var ExportNamedDeclaration = class extends AbstractExpressionNode {
122
+ static {
123
+ __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1);
124
+ ExportNamedDeclaration = _classThis_1 = _classDescriptor_1.value;
125
+ __runInitializers(_classThis_1, _classExtraInitializers_1);
126
+ }
127
+ specifiers;
128
+ declaration;
129
+ source;
130
+ assertions;
131
+ static fromJSON(node, deserializer) {
132
+ return new ExportNamedDeclaration(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, node.range, node.loc);
133
+ }
134
+ static visit(node, visitNode) {
135
+ node.specifiers.map(visitNode);
136
+ node.source && visitNode(node.source);
137
+ node.declaration && visitNode(node.declaration);
138
+ node.assertions?.forEach(visitNode);
139
+ }
140
+ constructor(specifiers, declaration, source, assertions, range, loc) {
141
+ super(range, loc);
142
+ this.specifiers = specifiers;
143
+ this.declaration = declaration;
144
+ this.source = source;
145
+ this.assertions = assertions;
146
+ }
147
+ getSource() {
148
+ return this.source;
149
+ }
150
+ getSpecifiers() {
151
+ return this.specifiers;
152
+ }
153
+ getDeclaration() {
154
+ return this.declaration;
155
+ }
156
+ getAssertions() {
157
+ return this.assertions;
158
+ }
159
+ set(stack) {
160
+ throw new Error(`ExportNamedDeclaration.#set() has no implementation.`);
161
+ }
162
+ get(stack) {
163
+ if (this.declaration) {
164
+ this.exportDeclaration(stack);
165
+ }
166
+ else if (this.source) {
167
+ this.exportFromSource(stack);
168
+ }
169
+ else {
170
+ this.exportLocal(stack);
177
171
  }
178
172
  }
179
- const sourceModule = stack.importModule(this.source.get(), importCallOptions);
180
- const localModule = stack.getModule();
181
- this.specifiers.forEach(specifier => {
182
- const localName = specifier.getLocal().get(stack);
183
- const exportedName = specifier.getExported().get(stack);
184
- const localValue = sourceModule.get(localName);
185
- localModule.set(exportedName, localValue);
186
- const scopeSubscription = sourceModule.subscribe(localName, (newLocalValue, oldLocalValue) => {
187
- if (newLocalValue !== oldLocalValue) {
188
- localModule.set(exportedName, newLocalValue);
173
+ exportDeclaration(stack) {
174
+ if (!this.declaration) {
175
+ return;
176
+ }
177
+ this.declaration.get(stack);
178
+ const declaredName = this.declaration.getDeclarationName?.();
179
+ if (!declaredName) {
180
+ throw new Error(`Name is not defined for ${this.declaration.toString()}`);
181
+ }
182
+ const value = stack.get(declaredName);
183
+ stack.getModule().set(declaredName, value);
184
+ }
185
+ exportFromSource(stack) {
186
+ if (!this.source) {
187
+ return;
188
+ }
189
+ let importCallOptions;
190
+ if (this.assertions) {
191
+ const importAssertions = this.assertions
192
+ .map(assertion => assertion.get(stack))
193
+ .reduce((p, c) => Object.assign(p, c), {});
194
+ if (importAssertions) {
195
+ importCallOptions = { assert: importAssertions };
189
196
  }
190
- });
191
- stack.onDestroy(() => scopeSubscription.unsubscribe());
192
- });
193
- }
194
- exportLocal(stack, importCallOptions) {
195
- const localModule = stack.getModule();
196
- this.specifiers.forEach(specifier => {
197
- const localName = specifier.getLocal().get(stack);
198
- const exportedName = specifier.getExported().get(stack);
199
- const localValue = stack.get(localName);
200
- localModule.set(exportedName, localValue);
201
- const scope = stack.findScope(localName);
202
- if (scope instanceof ReactiveScope) {
203
- const scopeSubscription = scope.subscribe(localName, (newLocalValue, oldLocalValue) => {
197
+ }
198
+ const sourceModule = stack.importModule(this.source.get(), importCallOptions);
199
+ const localModule = stack.getModule();
200
+ this.specifiers.forEach(specifier => {
201
+ const localName = specifier.getLocal().get(stack);
202
+ const exportedName = specifier.getExported().get(stack);
203
+ const localValue = sourceModule.get(localName);
204
+ localModule.set(exportedName, localValue);
205
+ const scopeSubscription = sourceModule.subscribe(localName, (newLocalValue, oldLocalValue) => {
204
206
  if (newLocalValue !== oldLocalValue) {
205
207
  localModule.set(exportedName, newLocalValue);
206
208
  }
207
209
  });
208
210
  stack.onDestroy(() => scopeSubscription.unsubscribe());
211
+ });
212
+ }
213
+ exportLocal(stack, importCallOptions) {
214
+ const localModule = stack.getModule();
215
+ this.specifiers.forEach(specifier => {
216
+ const localName = specifier.getLocal().get(stack);
217
+ const exportedName = specifier.getExported().get(stack);
218
+ const localValue = stack.get(localName);
219
+ localModule.set(exportedName, localValue);
220
+ const scope = stack.findScope(localName);
221
+ if (scope instanceof ReactiveScope) {
222
+ const scopeSubscription = scope.subscribe(localName, (newLocalValue, oldLocalValue) => {
223
+ if (newLocalValue !== oldLocalValue) {
224
+ localModule.set(exportedName, newLocalValue);
225
+ }
226
+ });
227
+ stack.onDestroy(() => scopeSubscription.unsubscribe());
228
+ }
229
+ });
230
+ }
231
+ dependency(computed) {
232
+ return [];
233
+ }
234
+ dependencyPath(computed) {
235
+ return [];
236
+ }
237
+ toString() {
238
+ if (this.declaration) {
239
+ const declaration = this.declaration.toString();
240
+ return `export ${declaration}`;
209
241
  }
210
- });
211
- }
212
- dependency(computed) {
213
- return [];
214
- }
215
- dependencyPath(computed) {
216
- return [];
217
- }
218
- toString() {
219
- if (this.declaration) {
220
- const declaration = this.declaration.toString();
221
- return `export ${declaration}`;
222
- }
223
- const specifiers = this.specifiers.map(specifier => specifier.toString()).join(',');
224
- let exportStr = `export {${specifiers}}`;
225
- if (!this.source) {
226
- return `${exportStr};`;
227
- }
228
- const source = this.source.toString();
229
- return `${exportStr} from ${source}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
230
- }
231
- toJson() {
232
- return {
233
- specifiers: this.specifiers.map(specifier => specifier.toJSON()),
234
- source: this.source?.toJSON(),
235
- declaration: this.declaration?.toJSON(),
236
- assertions: this.assertions?.map(assertion => assertion.toJSON()),
237
- };
238
- }
239
- };
240
- ExportNamedDeclaration = ExportNamedDeclaration_1 = __decorate([
241
- Deserializer('ExportNamedDeclaration'),
242
- __metadata("design:paramtypes", [Array, Object, Literal, Array, Array, Object])
243
- ], ExportNamedDeclaration);
244
- export { ExportNamedDeclaration };
242
+ const specifiers = this.specifiers.map(specifier => specifier.toString()).join(',');
243
+ let exportStr = `export {${specifiers}}`;
244
+ if (!this.source) {
245
+ return `${exportStr};`;
246
+ }
247
+ const source = this.source.toString();
248
+ return `${exportStr} from ${source}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
249
+ }
250
+ toJson() {
251
+ return {
252
+ specifiers: this.specifiers.map(specifier => specifier.toJSON()),
253
+ source: this.source?.toJSON(),
254
+ declaration: this.declaration?.toJSON(),
255
+ assertions: this.assertions?.map(assertion => assertion.toJSON()),
256
+ };
257
+ }
258
+ };
259
+ return ExportNamedDeclaration = _classThis_1;
260
+ })();
245
261
  /**
246
262
  * An export default declaration, e.g.,
247
263
  * `export default function () {};`
248
264
  * or `export default 1;`.
249
265
  */
250
- let ExportDefaultDeclaration = ExportDefaultDeclaration_1 = class ExportDefaultDeclaration extends AbstractExpressionNode {
251
- static fromJSON(node, deserializer) {
252
- return new ExportDefaultDeclaration_1(deserializer(node.declaration), node.range, node.loc);
253
- }
254
- static visit(node, visitNode) {
255
- visitNode(node.declaration);
256
- }
257
- constructor(declaration, range, loc) {
258
- super(range, loc);
259
- this.declaration = declaration;
260
- }
261
- getDeclaration() {
262
- return this.declaration;
263
- }
264
- set(stack) {
265
- throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
266
- }
267
- get(stack) {
268
- const declaration = this.declaration.get(stack);
269
- stack.getModule().set('default', declaration);
270
- }
271
- dependency(computed) {
272
- return [];
273
- }
274
- dependencyPath(computed) {
275
- return [];
276
- }
277
- toString() {
278
- const declaration = this.declaration.toString();
279
- return `export default ${declaration}`;
280
- }
281
- toJson() {
282
- return {
283
- declaration: this.declaration.toJSON(),
284
- };
285
- }
286
- };
287
- ExportDefaultDeclaration = ExportDefaultDeclaration_1 = __decorate([
288
- Deserializer('ExportDefaultDeclaration'),
289
- __metadata("design:paramtypes", [Object, Array, Object])
290
- ], ExportDefaultDeclaration);
291
- export { ExportDefaultDeclaration };
266
+ export let ExportDefaultDeclaration = (() => {
267
+ let _classDecorators_2 = [Deserializer('ExportDefaultDeclaration')];
268
+ let _classDescriptor_2;
269
+ let _classExtraInitializers_2 = [];
270
+ let _classThis_2;
271
+ var ExportDefaultDeclaration = class extends AbstractExpressionNode {
272
+ static {
273
+ __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2);
274
+ ExportDefaultDeclaration = _classThis_2 = _classDescriptor_2.value;
275
+ __runInitializers(_classThis_2, _classExtraInitializers_2);
276
+ }
277
+ declaration;
278
+ static fromJSON(node, deserializer) {
279
+ return new ExportDefaultDeclaration(deserializer(node.declaration), node.range, node.loc);
280
+ }
281
+ static visit(node, visitNode) {
282
+ visitNode(node.declaration);
283
+ }
284
+ constructor(declaration, range, loc) {
285
+ super(range, loc);
286
+ this.declaration = declaration;
287
+ }
288
+ getDeclaration() {
289
+ return this.declaration;
290
+ }
291
+ set(stack) {
292
+ throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
293
+ }
294
+ get(stack) {
295
+ const declaration = this.declaration.get(stack);
296
+ stack.getModule().set('default', declaration);
297
+ }
298
+ dependency(computed) {
299
+ return [];
300
+ }
301
+ dependencyPath(computed) {
302
+ return [];
303
+ }
304
+ toString() {
305
+ const declaration = this.declaration.toString();
306
+ return `export default ${declaration}`;
307
+ }
308
+ toJson() {
309
+ return {
310
+ declaration: this.declaration.toJSON(),
311
+ };
312
+ }
313
+ };
314
+ return ExportDefaultDeclaration = _classThis_2;
315
+ })();
292
316
  /**
293
317
  * An export batch declaration, e.g., `export * from "mod";`.
294
318
  */
295
- let ExportAllDeclaration = ExportAllDeclaration_1 = class ExportAllDeclaration extends AbstractExpressionNode {
296
- static fromJSON(node, deserializer) {
297
- return new ExportAllDeclaration_1(deserializer(node.source), node.exported ? deserializer(node.exported) : void 0, node.assertions?.map(deserializer), node.range, node.loc);
298
- }
299
- static visit(node, visitNode) {
300
- visitNode(node.source);
301
- node.exported && visitNode(node.exported);
302
- node.assertions?.forEach(visitNode);
303
- }
304
- constructor(source, exported, assertions, range, loc) {
305
- super(range, loc);
306
- this.source = source;
307
- this.exported = exported;
308
- this.assertions = assertions;
309
- }
310
- getSource() {
311
- return this.source;
312
- }
313
- getExported() {
314
- return this.exported;
315
- }
316
- getAssertions() {
317
- return this.assertions;
318
- }
319
- set(stack) {
320
- throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
321
- }
322
- get(stack) {
323
- let importCallOptions;
324
- if (this.assertions) {
325
- const importAssertions = this.assertions
326
- .map(assertion => assertion.get(stack))
327
- .reduce((p, c) => Object.assign(p, c), {});
328
- if (importAssertions) {
329
- importCallOptions = { assert: importAssertions };
330
- }
319
+ export let ExportAllDeclaration = (() => {
320
+ let _classDecorators_3 = [Deserializer('ExportAllDeclaration')];
321
+ let _classDescriptor_3;
322
+ let _classExtraInitializers_3 = [];
323
+ let _classThis_3;
324
+ var ExportAllDeclaration = class extends AbstractExpressionNode {
325
+ static {
326
+ __esDecorate(null, _classDescriptor_3 = { value: this }, _classDecorators_3, { kind: "class", name: this.name }, null, _classExtraInitializers_3);
327
+ ExportAllDeclaration = _classThis_3 = _classDescriptor_3.value;
328
+ __runInitializers(_classThis_3, _classExtraInitializers_3);
329
+ }
330
+ source;
331
+ exported;
332
+ assertions;
333
+ static fromJSON(node, deserializer) {
334
+ return new ExportAllDeclaration(deserializer(node.source), node.exported ? deserializer(node.exported) : void 0, node.assertions?.map(deserializer), node.range, node.loc);
331
335
  }
332
- let localModule = stack.getModule();
333
- const sourceModule = stack.importModule(this.source.get(), importCallOptions);
334
- if (this.exported) {
335
- const exportedName = this.exported.get(stack);
336
- localModule.set(exportedName, {});
337
- localModule = localModule.getInnerScope(exportedName);
338
- }
339
- const properties = Object.keys(sourceModule.getContext());
340
- properties.forEach(property => {
341
- const localValue = sourceModule.get(property);
342
- localModule.set(property, localValue);
343
- const scopeSubscription = sourceModule.subscribe(property, (newLocalValue, oldLocalValue) => {
344
- if (newLocalValue !== oldLocalValue) {
345
- localModule.set(property, newLocalValue);
336
+ static visit(node, visitNode) {
337
+ visitNode(node.source);
338
+ node.exported && visitNode(node.exported);
339
+ node.assertions?.forEach(visitNode);
340
+ }
341
+ constructor(source, exported, assertions, range, loc) {
342
+ super(range, loc);
343
+ this.source = source;
344
+ this.exported = exported;
345
+ this.assertions = assertions;
346
+ }
347
+ getSource() {
348
+ return this.source;
349
+ }
350
+ getExported() {
351
+ return this.exported;
352
+ }
353
+ getAssertions() {
354
+ return this.assertions;
355
+ }
356
+ set(stack) {
357
+ throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
358
+ }
359
+ get(stack) {
360
+ let importCallOptions;
361
+ if (this.assertions) {
362
+ const importAssertions = this.assertions
363
+ .map(assertion => assertion.get(stack))
364
+ .reduce((p, c) => Object.assign(p, c), {});
365
+ if (importAssertions) {
366
+ importCallOptions = { assert: importAssertions };
346
367
  }
368
+ }
369
+ let localModule = stack.getModule();
370
+ const sourceModule = stack.importModule(this.source.get(), importCallOptions);
371
+ if (this.exported) {
372
+ const exportedName = this.exported.get(stack);
373
+ localModule.set(exportedName, {});
374
+ localModule = localModule.getInnerScope(exportedName);
375
+ }
376
+ const properties = Object.keys(sourceModule.getContext());
377
+ properties.forEach(property => {
378
+ const localValue = sourceModule.get(property);
379
+ localModule.set(property, localValue);
380
+ const scopeSubscription = sourceModule.subscribe(property, (newLocalValue, oldLocalValue) => {
381
+ if (newLocalValue !== oldLocalValue) {
382
+ localModule.set(property, newLocalValue);
383
+ }
384
+ });
385
+ stack.onDestroy(() => scopeSubscription.unsubscribe());
347
386
  });
348
- stack.onDestroy(() => scopeSubscription.unsubscribe());
349
- });
350
- }
351
- dependency(computed) {
352
- return [];
353
- }
354
- dependencyPath(computed) {
355
- return [];
356
- }
357
- toString() {
358
- return `export *${this.exported ? ` as ${this.exported.toString()}` : ''} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
359
- }
360
- toJson() {
361
- return {
362
- source: this.source.toJSON(),
363
- exported: this.exported?.toJSON(),
364
- assertions: this.assertions?.map(assertion => assertion.toJSON()),
365
- };
366
- }
367
- };
368
- ExportAllDeclaration = ExportAllDeclaration_1 = __decorate([
369
- Deserializer('ExportAllDeclaration'),
370
- __metadata("design:paramtypes", [Literal,
371
- Identifier, Array, Array, Object])
372
- ], ExportAllDeclaration);
373
- export { ExportAllDeclaration };
387
+ }
388
+ dependency(computed) {
389
+ return [];
390
+ }
391
+ dependencyPath(computed) {
392
+ return [];
393
+ }
394
+ toString() {
395
+ return `export *${this.exported ? ` as ${this.exported.toString()}` : ''} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
396
+ }
397
+ toJson() {
398
+ return {
399
+ source: this.source.toJSON(),
400
+ exported: this.exported?.toJSON(),
401
+ assertions: this.assertions?.map(assertion => assertion.toJSON()),
402
+ };
403
+ }
404
+ };
405
+ return ExportAllDeclaration = _classThis_3;
406
+ })();
374
407
  //# sourceMappingURL=export.js.map