@ibyar/expressions 0.8.5 → 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 +5 -5
  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 +6 -4
  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 +10 -6
  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
@@ -1,8 +1,6 @@
1
- var ImportSpecifier_1, ImportDefaultSpecifier_1, ImportNamespaceSpecifier_1, ImportDeclaration_1, ImportExpression_1;
2
- import { __decorate, __metadata } from "tslib";
1
+ import { __esDecorate, __runInitializers } from "tslib";
3
2
  import { AbstractExpressionNode } from '../abstract.js';
4
3
  import { Deserializer } from '../deserialize/deserialize.js';
5
- import { Identifier, Literal } from '../definition/values.js';
6
4
  import { ModuleSpecifier } from './common.js';
7
5
  /**
8
6
  * An imported variable binding,
@@ -21,117 +19,140 @@ import { ModuleSpecifier } from './common.js';
21
19
  * the imported field is an Identifier node representing foo,
22
20
  * and the local field is an Identifier node representing bar.
23
21
  */
24
- let ImportSpecifier = ImportSpecifier_1 = class ImportSpecifier extends ModuleSpecifier {
25
- static fromJSON(node, deserializer) {
26
- return new ImportSpecifier_1(deserializer(node.local), deserializer(node.imported), node.range, node.loc);
27
- }
28
- static visit(node, visitNode) {
29
- visitNode(node.local);
30
- visitNode(node.imported);
31
- }
32
- constructor(local, imported, range, loc) {
33
- super(local, range, loc);
34
- this.imported = imported;
35
- }
36
- getImported() {
37
- return this.imported;
38
- }
39
- getImportedName() {
40
- return this.imported.getName();
41
- }
42
- set(stack, value) {
43
- throw new Error('Method not implemented.');
44
- }
45
- get(stack, thisContext) {
46
- throw new Error('Method not implemented.');
47
- }
48
- dependency(computed) {
49
- return [];
50
- }
51
- dependencyPath(computed) {
52
- return [];
53
- }
54
- toString() {
55
- const local = this.local.toString();
56
- const imported = this.imported.toString();
57
- if (local == imported) {
58
- return local;
59
- }
60
- return `${imported} as ${local}`;
61
- }
62
- toJson() {
63
- return {
64
- local: this.local.toJSON(),
65
- imported: this.imported.toJSON()
66
- };
67
- }
68
- };
69
- ImportSpecifier = ImportSpecifier_1 = __decorate([
70
- Deserializer('ImportSpecifier'),
71
- __metadata("design:paramtypes", [Identifier,
72
- Identifier, Array, Object])
73
- ], ImportSpecifier);
74
- export { ImportSpecifier };
22
+ export let ImportSpecifier = (() => {
23
+ let _classDecorators = [Deserializer('ImportSpecifier')];
24
+ let _classDescriptor;
25
+ let _classExtraInitializers = [];
26
+ let _classThis;
27
+ var ImportSpecifier = class extends ModuleSpecifier {
28
+ static {
29
+ __esDecorate(null, _classDescriptor = { value: this }, _classDecorators, { kind: "class", name: this.name }, null, _classExtraInitializers);
30
+ ImportSpecifier = _classThis = _classDescriptor.value;
31
+ __runInitializers(_classThis, _classExtraInitializers);
32
+ }
33
+ imported;
34
+ static fromJSON(node, deserializer) {
35
+ return new ImportSpecifier(deserializer(node.local), deserializer(node.imported), node.range, node.loc);
36
+ }
37
+ static visit(node, visitNode) {
38
+ visitNode(node.local);
39
+ visitNode(node.imported);
40
+ }
41
+ constructor(local, imported, range, loc) {
42
+ super(local, range, loc);
43
+ this.imported = imported;
44
+ }
45
+ getImported() {
46
+ return this.imported;
47
+ }
48
+ getImportedName() {
49
+ return this.imported.getName();
50
+ }
51
+ set(stack, value) {
52
+ throw new Error('Method not implemented.');
53
+ }
54
+ get(stack, thisContext) {
55
+ throw new Error('Method not implemented.');
56
+ }
57
+ dependency(computed) {
58
+ return [];
59
+ }
60
+ dependencyPath(computed) {
61
+ return [];
62
+ }
63
+ toString() {
64
+ const local = this.local.toString();
65
+ const imported = this.imported.toString();
66
+ if (local == imported) {
67
+ return local;
68
+ }
69
+ return `${imported} as ${local}`;
70
+ }
71
+ toJson() {
72
+ return {
73
+ local: this.local.toJSON(),
74
+ imported: this.imported.toJSON()
75
+ };
76
+ }
77
+ };
78
+ return ImportSpecifier = _classThis;
79
+ })();
75
80
  /**
76
81
  * A default import specifier, e.g., `foo` in `import foo from "mod.js";`.
77
82
  */
78
- let ImportDefaultSpecifier = ImportDefaultSpecifier_1 = class ImportDefaultSpecifier extends ModuleSpecifier {
79
- static fromJSON(node, deserializer) {
80
- return new ImportDefaultSpecifier_1(deserializer(node.local), node.range, node.loc);
81
- }
82
- static visit(node, visitNode) {
83
- visitNode(node.local);
84
- }
85
- set(stack, value) {
86
- throw new Error('Method not implemented.');
87
- }
88
- get(stack, thisContext) {
89
- throw new Error('Method not implemented.');
90
- }
91
- dependency(computed) {
92
- return [];
93
- }
94
- dependencyPath(computed) {
95
- return [];
96
- }
97
- toString() {
98
- return this.local.toString();
99
- }
100
- };
101
- ImportDefaultSpecifier = ImportDefaultSpecifier_1 = __decorate([
102
- Deserializer('ImportDefaultSpecifier')
103
- ], ImportDefaultSpecifier);
104
- export { ImportDefaultSpecifier };
83
+ export let ImportDefaultSpecifier = (() => {
84
+ let _classDecorators_1 = [Deserializer('ImportDefaultSpecifier')];
85
+ let _classDescriptor_1;
86
+ let _classExtraInitializers_1 = [];
87
+ let _classThis_1;
88
+ var ImportDefaultSpecifier = class extends ModuleSpecifier {
89
+ static {
90
+ __esDecorate(null, _classDescriptor_1 = { value: this }, _classDecorators_1, { kind: "class", name: this.name }, null, _classExtraInitializers_1);
91
+ ImportDefaultSpecifier = _classThis_1 = _classDescriptor_1.value;
92
+ __runInitializers(_classThis_1, _classExtraInitializers_1);
93
+ }
94
+ static fromJSON(node, deserializer) {
95
+ return new ImportDefaultSpecifier(deserializer(node.local), node.range, node.loc);
96
+ }
97
+ static visit(node, visitNode) {
98
+ visitNode(node.local);
99
+ }
100
+ set(stack, value) {
101
+ throw new Error('Method not implemented.');
102
+ }
103
+ get(stack, thisContext) {
104
+ throw new Error('Method not implemented.');
105
+ }
106
+ dependency(computed) {
107
+ return [];
108
+ }
109
+ dependencyPath(computed) {
110
+ return [];
111
+ }
112
+ toString() {
113
+ return this.local.toString();
114
+ }
115
+ };
116
+ return ImportDefaultSpecifier = _classThis_1;
117
+ })();
105
118
  /**
106
119
  * A namespace import specifier, e.g., `* as foo` in `import * as foo from "mod.js";`.
107
120
  */
108
- let ImportNamespaceSpecifier = ImportNamespaceSpecifier_1 = class ImportNamespaceSpecifier extends ModuleSpecifier {
109
- static fromJSON(node, deserializer) {
110
- return new ImportNamespaceSpecifier_1(deserializer(node.local), node.range, node.loc);
111
- }
112
- static visit(node, visitNode) {
113
- visitNode(node.local);
114
- }
115
- set(stack, value) {
116
- throw new Error('Method not implemented.');
117
- }
118
- get(stack, thisContext) {
119
- throw new Error('Method not implemented.');
120
- }
121
- dependency(computed) {
122
- return [];
123
- }
124
- dependencyPath(computed) {
125
- return [];
126
- }
127
- toString() {
128
- return `* as ${this.local.toString()}`;
129
- }
130
- };
131
- ImportNamespaceSpecifier = ImportNamespaceSpecifier_1 = __decorate([
132
- Deserializer('ImportNamespaceSpecifier')
133
- ], ImportNamespaceSpecifier);
134
- export { ImportNamespaceSpecifier };
121
+ export let ImportNamespaceSpecifier = (() => {
122
+ let _classDecorators_2 = [Deserializer('ImportNamespaceSpecifier')];
123
+ let _classDescriptor_2;
124
+ let _classExtraInitializers_2 = [];
125
+ let _classThis_2;
126
+ var ImportNamespaceSpecifier = class extends ModuleSpecifier {
127
+ static {
128
+ __esDecorate(null, _classDescriptor_2 = { value: this }, _classDecorators_2, { kind: "class", name: this.name }, null, _classExtraInitializers_2);
129
+ ImportNamespaceSpecifier = _classThis_2 = _classDescriptor_2.value;
130
+ __runInitializers(_classThis_2, _classExtraInitializers_2);
131
+ }
132
+ static fromJSON(node, deserializer) {
133
+ return new ImportNamespaceSpecifier(deserializer(node.local), node.range, node.loc);
134
+ }
135
+ static visit(node, visitNode) {
136
+ visitNode(node.local);
137
+ }
138
+ set(stack, value) {
139
+ throw new Error('Method not implemented.');
140
+ }
141
+ get(stack, thisContext) {
142
+ throw new Error('Method not implemented.');
143
+ }
144
+ dependency(computed) {
145
+ return [];
146
+ }
147
+ dependencyPath(computed) {
148
+ return [];
149
+ }
150
+ toString() {
151
+ return `* as ${this.local.toString()}`;
152
+ }
153
+ };
154
+ return ImportNamespaceSpecifier = _classThis_2;
155
+ })();
135
156
  /**
136
157
  * An import declaration, e.g., import foo from "mod";.
137
158
  *
@@ -156,165 +177,184 @@ export { ImportNamespaceSpecifier };
156
177
  * import "module-name";
157
178
  *
158
179
  */
159
- let ImportDeclaration = ImportDeclaration_1 = class ImportDeclaration extends AbstractExpressionNode {
160
- static fromJSON(node, deserializer) {
161
- return new ImportDeclaration_1(deserializer(node.source), node.specifiers?.map(deserializer), node.assertions?.map(deserializer), node.range, node.loc);
162
- }
163
- static visit(node, visitNode) {
164
- visitNode(node.source);
165
- node.specifiers?.forEach(visitNode);
166
- node.assertions?.forEach(visitNode);
167
- }
168
- constructor(source, specifiers, assertions, range, loc) {
169
- super(range, loc);
170
- this.source = source;
171
- this.specifiers = specifiers;
172
- this.assertions = assertions;
173
- }
174
- getSource() {
175
- return this.source;
176
- }
177
- getSpecifiers() {
178
- return this.specifiers;
179
- }
180
- getAssertions() {
181
- return this.assertions;
182
- }
183
- set(stack) {
184
- throw new Error(`ImportDeclaration.#set() has no implementation.`);
185
- }
186
- get(stack) {
187
- let importCallOptions;
188
- if (this.assertions) {
189
- const importAssertions = this.assertions
190
- .map(assertion => assertion.get(stack))
191
- .reduce((p, c) => Object.assign(p, c), {});
192
- if (importAssertions) {
193
- importCallOptions = { assert: importAssertions };
180
+ export let ImportDeclaration = (() => {
181
+ let _classDecorators_3 = [Deserializer('ImportDeclaration')];
182
+ let _classDescriptor_3;
183
+ let _classExtraInitializers_3 = [];
184
+ let _classThis_3;
185
+ var ImportDeclaration = class extends AbstractExpressionNode {
186
+ static {
187
+ __esDecorate(null, _classDescriptor_3 = { value: this }, _classDecorators_3, { kind: "class", name: this.name }, null, _classExtraInitializers_3);
188
+ ImportDeclaration = _classThis_3 = _classDescriptor_3.value;
189
+ __runInitializers(_classThis_3, _classExtraInitializers_3);
190
+ }
191
+ source;
192
+ specifiers;
193
+ assertions;
194
+ static fromJSON(node, deserializer) {
195
+ return new ImportDeclaration(deserializer(node.source), node.specifiers?.map(deserializer), node.assertions?.map(deserializer), node.range, node.loc);
196
+ }
197
+ static visit(node, visitNode) {
198
+ visitNode(node.source);
199
+ node.specifiers?.forEach(visitNode);
200
+ node.assertions?.forEach(visitNode);
201
+ }
202
+ constructor(source, specifiers, assertions, range, loc) {
203
+ super(range, loc);
204
+ this.source = source;
205
+ this.specifiers = specifiers;
206
+ this.assertions = assertions;
207
+ }
208
+ getSource() {
209
+ return this.source;
210
+ }
211
+ getSpecifiers() {
212
+ return this.specifiers;
213
+ }
214
+ getAssertions() {
215
+ return this.assertions;
216
+ }
217
+ set(stack) {
218
+ throw new Error(`ImportDeclaration.#set() has no implementation.`);
219
+ }
220
+ get(stack) {
221
+ let importCallOptions;
222
+ if (this.assertions) {
223
+ const importAssertions = this.assertions
224
+ .map(assertion => assertion.get(stack))
225
+ .reduce((p, c) => Object.assign(p, c), {});
226
+ if (importAssertions) {
227
+ importCallOptions = { assert: importAssertions };
228
+ }
194
229
  }
230
+ const module = stack.importModule(this.source.get(), importCallOptions);
231
+ if (!this.specifiers) {
232
+ return;
233
+ }
234
+ this.specifiers.forEach(specifier => {
235
+ const local = specifier.getLocalName();
236
+ if (specifier instanceof ImportSpecifier) {
237
+ const imported = specifier.getImportedName();
238
+ const importedValue = module.get(imported);
239
+ stack.getModule()?.set(local, importedValue);
240
+ const scopeSubscription = module.subscribe(local, (newValue, oldValue) => {
241
+ if (newValue !== oldValue) {
242
+ stack.getModule()?.set(local, newValue);
243
+ }
244
+ });
245
+ stack.onDestroy(() => scopeSubscription.unsubscribe());
246
+ }
247
+ else if (specifier instanceof ImportDefaultSpecifier) {
248
+ const defaultValue = module.get('default');
249
+ stack.getModule()?.set(local, defaultValue);
250
+ const scopeSubscription = module.subscribe('default', (newValue, oldValue) => {
251
+ if (newValue !== oldValue) {
252
+ stack.getModule()?.set(local, newValue);
253
+ }
254
+ });
255
+ stack.onDestroy(() => scopeSubscription.unsubscribe());
256
+ }
257
+ else if (specifier instanceof ImportNamespaceSpecifier) {
258
+ stack.getModule()?.importModule(local, module);
259
+ }
260
+ });
261
+ }
262
+ dependency(computed) {
263
+ return [];
195
264
  }
196
- const module = stack.importModule(this.source.get(), importCallOptions);
197
- if (!this.specifiers) {
198
- return;
199
- }
200
- this.specifiers.forEach(specifier => {
201
- const local = specifier.getLocalName();
202
- if (specifier instanceof ImportSpecifier) {
203
- const imported = specifier.getImportedName();
204
- const importedValue = module.get(imported);
205
- stack.getModule()?.set(local, importedValue);
206
- const scopeSubscription = module.subscribe(local, (newValue, oldValue) => {
207
- if (newValue !== oldValue) {
208
- stack.getModule()?.set(local, newValue);
209
- }
210
- });
211
- stack.onDestroy(() => scopeSubscription.unsubscribe());
265
+ dependencyPath(computed) {
266
+ return [];
267
+ }
268
+ toString() {
269
+ if (!this.specifiers) {
270
+ return `import '${this.source.toString()}'`;
271
+ }
272
+ const parts = [];
273
+ const importDefaultSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportDefaultSpecifier);
274
+ if (importDefaultSpecifiers?.length) {
275
+ parts.push(importDefaultSpecifiers[0].toString());
212
276
  }
213
- else if (specifier instanceof ImportDefaultSpecifier) {
214
- const defaultValue = module.get('default');
215
- stack.getModule()?.set(local, defaultValue);
216
- const scopeSubscription = module.subscribe('default', (newValue, oldValue) => {
217
- if (newValue !== oldValue) {
218
- stack.getModule()?.set(local, newValue);
219
- }
220
- });
221
- stack.onDestroy(() => scopeSubscription.unsubscribe());
277
+ const importNamespaceSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportNamespaceSpecifier);
278
+ if (importNamespaceSpecifiers?.length) {
279
+ parts.push(importNamespaceSpecifiers[0].toString());
222
280
  }
223
- else if (specifier instanceof ImportNamespaceSpecifier) {
224
- stack.getModule()?.importModule(local, module);
281
+ const importSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportSpecifier);
282
+ if (importSpecifiers?.length) {
283
+ const importSpecifiersString = importSpecifiers.map(importSpecifier => importSpecifier.toString()).join(',');
284
+ parts.push(`{ ${importSpecifiersString} }`);
225
285
  }
226
- });
227
- }
228
- dependency(computed) {
229
- return [];
230
- }
231
- dependencyPath(computed) {
232
- return [];
233
- }
234
- toString() {
235
- if (!this.specifiers) {
236
- return `import '${this.source.toString()}'`;
237
- }
238
- const parts = [];
239
- const importDefaultSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportDefaultSpecifier);
240
- if (importDefaultSpecifiers?.length) {
241
- parts.push(importDefaultSpecifiers[0].toString());
242
- }
243
- const importNamespaceSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportNamespaceSpecifier);
244
- if (importNamespaceSpecifiers?.length) {
245
- parts.push(importNamespaceSpecifiers[0].toString());
246
- }
247
- const importSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportSpecifier);
248
- if (importSpecifiers?.length) {
249
- const importSpecifiersString = importSpecifiers.map(importSpecifier => importSpecifier.toString()).join(',');
250
- parts.push(`{ ${importSpecifiersString} }`);
251
- }
252
- return `import ${parts.join(', ')} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
253
- }
254
- toJson() {
255
- return {
256
- source: this.source.toJSON(),
257
- specifiers: this.specifiers?.map(specifier => specifier.toJSON()),
258
- assertions: this.assertions?.map(assertion => assertion.toJSON()),
259
- };
260
- }
261
- };
262
- ImportDeclaration = ImportDeclaration_1 = __decorate([
263
- Deserializer('ImportDeclaration'),
264
- __metadata("design:paramtypes", [Literal, Array, Array, Array, Object])
265
- ], ImportDeclaration);
266
- export { ImportDeclaration };
286
+ return `import ${parts.join(', ')} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
287
+ }
288
+ toJson() {
289
+ return {
290
+ source: this.source.toJSON(),
291
+ specifiers: this.specifiers?.map(specifier => specifier.toJSON()),
292
+ assertions: this.assertions?.map(assertion => assertion.toJSON()),
293
+ };
294
+ }
295
+ };
296
+ return ImportDeclaration = _classThis_3;
297
+ })();
267
298
  /**
268
299
  * `ImportExpression` node represents Dynamic Imports such as `import(source)`.
269
300
  * The `source` property is the importing source as similar to ImportDeclaration node,
270
301
  * but it can be an arbitrary expression node.
271
302
  * var promise = import("module-name");
272
303
  */
273
- let ImportExpression = ImportExpression_1 = class ImportExpression extends AbstractExpressionNode {
274
- static fromJSON(node, deserializer) {
275
- return new ImportExpression_1(deserializer(node.source), (node.attributes && deserializer(node.attributes)) || undefined, node.range, node.loc);
276
- }
277
- static visit(node, visitNode) {
278
- visitNode(node.source);
279
- node.attributes && visitNode(node.attributes);
280
- }
281
- constructor(source, attributes, range, loc) {
282
- super(range, loc);
283
- this.source = source;
284
- this.attributes = attributes;
285
- }
286
- getSource() {
287
- return this.source;
288
- }
289
- set(stack) {
290
- throw new Error(`ImportDeclaration.#set() has no implementation.`);
291
- }
292
- get(stack) {
293
- let importCallOptions;
294
- if (this.attributes) {
295
- importCallOptions = this.attributes.get(stack);
296
- }
297
- const module = stack.importModule(this.source.get(), importCallOptions);
298
- return Promise.resolve(module);
299
- }
300
- dependency(computed) {
301
- return [];
302
- }
303
- dependencyPath(computed) {
304
- return [];
305
- }
306
- toString() {
307
- return `import(${this.source.toString()}${this.attributes ? `, ${this.attributes.toString()}` : ''})`;
308
- }
309
- toJson() {
310
- return {
311
- source: this.source.toJSON(),
312
- };
313
- }
314
- };
315
- ImportExpression = ImportExpression_1 = __decorate([
316
- Deserializer('ImportExpression'),
317
- __metadata("design:paramtypes", [Literal, Object, Array, Object])
318
- ], ImportExpression);
319
- export { ImportExpression };
304
+ export let ImportExpression = (() => {
305
+ let _classDecorators_4 = [Deserializer('ImportExpression')];
306
+ let _classDescriptor_4;
307
+ let _classExtraInitializers_4 = [];
308
+ let _classThis_4;
309
+ var ImportExpression = class extends AbstractExpressionNode {
310
+ static {
311
+ __esDecorate(null, _classDescriptor_4 = { value: this }, _classDecorators_4, { kind: "class", name: this.name }, null, _classExtraInitializers_4);
312
+ ImportExpression = _classThis_4 = _classDescriptor_4.value;
313
+ __runInitializers(_classThis_4, _classExtraInitializers_4);
314
+ }
315
+ source;
316
+ attributes;
317
+ static fromJSON(node, deserializer) {
318
+ return new ImportExpression(deserializer(node.source), (node.attributes && deserializer(node.attributes)) || undefined, node.range, node.loc);
319
+ }
320
+ static visit(node, visitNode) {
321
+ visitNode(node.source);
322
+ node.attributes && visitNode(node.attributes);
323
+ }
324
+ constructor(source, attributes, range, loc) {
325
+ super(range, loc);
326
+ this.source = source;
327
+ this.attributes = attributes;
328
+ }
329
+ getSource() {
330
+ return this.source;
331
+ }
332
+ set(stack) {
333
+ throw new Error(`ImportDeclaration.#set() has no implementation.`);
334
+ }
335
+ get(stack) {
336
+ let importCallOptions;
337
+ if (this.attributes) {
338
+ importCallOptions = this.attributes.get(stack);
339
+ }
340
+ const module = stack.importModule(this.source.get(), importCallOptions);
341
+ return Promise.resolve(module);
342
+ }
343
+ dependency(computed) {
344
+ return [];
345
+ }
346
+ dependencyPath(computed) {
347
+ return [];
348
+ }
349
+ toString() {
350
+ return `import(${this.source.toString()}${this.attributes ? `, ${this.attributes.toString()}` : ''})`;
351
+ }
352
+ toJson() {
353
+ return {
354
+ source: this.source.toJSON(),
355
+ };
356
+ }
357
+ };
358
+ return ImportExpression = _classThis_4;
359
+ })();
320
360
  //# sourceMappingURL=import.js.map