@ibyar/expressions 0.8.6 → 1.1.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 (251) hide show
  1. package/README.md +48 -1
  2. package/api/abstract.d.ts +1 -0
  3. package/api/abstract.d.ts.map +1 -0
  4. package/api/abstract.js +12 -0
  5. package/api/abstract.js.map +1 -1
  6. package/api/class/class.d.ts +1 -0
  7. package/api/class/class.d.ts.map +1 -0
  8. package/api/class/class.js +603 -472
  9. package/api/class/class.js.map +1 -1
  10. package/api/class/decorator.d.ts +1 -0
  11. package/api/class/decorator.d.ts.map +1 -0
  12. package/api/class/decorator.js +53 -41
  13. package/api/class/decorator.js.map +1 -1
  14. package/api/computing/call.d.ts +1 -0
  15. package/api/computing/call.d.ts.map +1 -0
  16. package/api/computing/call.js +83 -69
  17. package/api/computing/call.js.map +1 -1
  18. package/api/computing/debugger.d.ts +1 -0
  19. package/api/computing/debugger.d.ts.map +1 -0
  20. package/api/computing/debugger.js +40 -28
  21. package/api/computing/debugger.js.map +1 -1
  22. package/api/computing/new.d.ts +1 -0
  23. package/api/computing/new.d.ts.map +1 -0
  24. package/api/computing/new.js +81 -68
  25. package/api/computing/new.js.map +1 -1
  26. package/api/computing/rest.d.ts +1 -0
  27. package/api/computing/rest.d.ts.map +1 -0
  28. package/api/computing/rest.js +54 -42
  29. package/api/computing/rest.js.map +1 -1
  30. package/api/computing/return.d.ts +1 -0
  31. package/api/computing/return.d.ts.map +1 -0
  32. package/api/computing/return.js +52 -40
  33. package/api/computing/return.js.map +1 -1
  34. package/api/computing/spread.d.ts +1 -0
  35. package/api/computing/spread.d.ts.map +1 -0
  36. package/api/computing/spread.js +70 -58
  37. package/api/computing/spread.js.map +1 -1
  38. package/api/computing/throw.d.ts +1 -0
  39. package/api/computing/throw.d.ts.map +1 -0
  40. package/api/computing/throw.js +216 -175
  41. package/api/computing/throw.js.map +1 -1
  42. package/api/computing/yield.d.ts +1 -0
  43. package/api/computing/yield.d.ts.map +1 -0
  44. package/api/computing/yield.js +60 -47
  45. package/api/computing/yield.js.map +1 -1
  46. package/api/definition/array.d.ts +1 -0
  47. package/api/definition/array.d.ts.map +1 -0
  48. package/api/definition/array.js +147 -122
  49. package/api/definition/array.js.map +1 -1
  50. package/api/definition/bind.d.ts +1 -0
  51. package/api/definition/bind.d.ts.map +1 -0
  52. package/api/definition/bind.js +85 -70
  53. package/api/definition/bind.js.map +1 -1
  54. package/api/definition/comment.d.ts +1 -0
  55. package/api/definition/comment.d.ts.map +1 -0
  56. package/api/definition/comment.js +44 -32
  57. package/api/definition/comment.js.map +1 -1
  58. package/api/definition/function.d.ts +1 -0
  59. package/api/definition/function.d.ts.map +1 -0
  60. package/api/definition/function.js +500 -443
  61. package/api/definition/function.js.map +1 -1
  62. package/api/definition/member.d.ts +1 -0
  63. package/api/definition/member.d.ts.map +1 -0
  64. package/api/definition/member.js +104 -89
  65. package/api/definition/member.js.map +1 -1
  66. package/api/definition/object.d.ts +1 -0
  67. package/api/definition/object.d.ts.map +1 -0
  68. package/api/definition/object.js +243 -200
  69. package/api/definition/object.js.map +1 -1
  70. package/api/definition/statement.d.ts +1 -0
  71. package/api/definition/statement.d.ts.map +1 -0
  72. package/api/definition/statement.js +56 -44
  73. package/api/definition/statement.js.map +1 -1
  74. package/api/definition/values.d.ts +1 -0
  75. package/api/definition/values.d.ts.map +1 -0
  76. package/api/definition/values.js +228 -160
  77. package/api/definition/values.js.map +1 -1
  78. package/api/deserialize/deserialize.d.ts +2 -1
  79. package/api/deserialize/deserialize.d.ts.map +1 -0
  80. package/api/deserialize/deserialize.js +5 -7
  81. package/api/deserialize/deserialize.js.map +1 -1
  82. package/api/deserialize/type-store.d.ts +1 -0
  83. package/api/deserialize/type-store.d.ts.map +1 -0
  84. package/api/expression.d.ts +1 -0
  85. package/api/expression.d.ts.map +1 -0
  86. package/api/index.d.ts +1 -0
  87. package/api/index.d.ts.map +1 -0
  88. package/api/module/common.d.ts +1 -0
  89. package/api/module/common.d.ts.map +1 -0
  90. package/api/module/common.js +63 -50
  91. package/api/module/common.js.map +1 -1
  92. package/api/module/export.d.ts +1 -0
  93. package/api/module/export.d.ts.map +1 -0
  94. package/api/module/export.js +343 -290
  95. package/api/module/export.js.map +1 -1
  96. package/api/module/import.d.ts +1 -0
  97. package/api/module/import.d.ts.map +1 -0
  98. package/api/module/import.js +318 -253
  99. package/api/module/import.js.map +1 -1
  100. package/api/operators/assignment.d.ts +1 -0
  101. package/api/operators/assignment.d.ts.map +1 -0
  102. package/api/operators/assignment.js +88 -75
  103. package/api/operators/assignment.js.map +1 -1
  104. package/api/operators/await.d.ts +1 -0
  105. package/api/operators/await.d.ts.map +1 -0
  106. package/api/operators/await.js +54 -42
  107. package/api/operators/await.js.map +1 -1
  108. package/api/operators/binary.d.ts +1 -0
  109. package/api/operators/binary.d.ts.map +1 -0
  110. package/api/operators/binary.js +78 -64
  111. package/api/operators/binary.js.map +1 -1
  112. package/api/operators/chaining.d.ts +1 -0
  113. package/api/operators/chaining.d.ts.map +1 -0
  114. package/api/operators/chaining.js +56 -44
  115. package/api/operators/chaining.js.map +1 -1
  116. package/api/operators/comma.d.ts +1 -0
  117. package/api/operators/comma.d.ts.map +1 -0
  118. package/api/operators/comma.js +53 -41
  119. package/api/operators/comma.js.map +1 -1
  120. package/api/operators/grouping.d.ts +1 -0
  121. package/api/operators/grouping.d.ts.map +1 -0
  122. package/api/operators/grouping.js +51 -39
  123. package/api/operators/grouping.js.map +1 -1
  124. package/api/operators/logical.d.ts +1 -0
  125. package/api/operators/logical.d.ts.map +1 -0
  126. package/api/operators/logical.js +51 -37
  127. package/api/operators/logical.js.map +1 -1
  128. package/api/operators/pipeline.d.ts +1 -0
  129. package/api/operators/pipeline.d.ts.map +1 -0
  130. package/api/operators/pipeline.js +95 -81
  131. package/api/operators/pipeline.js.map +1 -1
  132. package/api/operators/ternary.d.ts +1 -0
  133. package/api/operators/ternary.d.ts.map +1 -0
  134. package/api/operators/ternary.js +69 -55
  135. package/api/operators/ternary.js.map +1 -1
  136. package/api/operators/types.d.ts +1 -0
  137. package/api/operators/types.d.ts.map +1 -0
  138. package/api/operators/unary.d.ts +1 -0
  139. package/api/operators/unary.d.ts.map +1 -0
  140. package/api/operators/unary.js +97 -82
  141. package/api/operators/unary.js.map +1 -1
  142. package/api/operators/update.d.ts +1 -0
  143. package/api/operators/update.d.ts.map +1 -0
  144. package/api/operators/update.js +78 -62
  145. package/api/operators/update.js.map +1 -1
  146. package/api/program.d.ts +1 -0
  147. package/api/program.d.ts.map +1 -0
  148. package/api/program.js +53 -40
  149. package/api/program.js.map +1 -1
  150. package/api/statement/control/block.d.ts +1 -0
  151. package/api/statement/control/block.d.ts.map +1 -0
  152. package/api/statement/control/block.js +65 -53
  153. package/api/statement/control/block.js.map +1 -1
  154. package/api/statement/control/empty.d.ts +1 -1
  155. package/api/statement/control/empty.d.ts.map +1 -0
  156. package/api/statement/control/empty.js +43 -33
  157. package/api/statement/control/empty.js.map +1 -1
  158. package/api/statement/control/if.d.ts +1 -0
  159. package/api/statement/control/if.d.ts.map +1 -0
  160. package/api/statement/control/if.js +79 -65
  161. package/api/statement/control/if.js.map +1 -1
  162. package/api/statement/control/switch.d.ts +1 -0
  163. package/api/statement/control/switch.d.ts.map +1 -0
  164. package/api/statement/control/switch.js +180 -141
  165. package/api/statement/control/switch.js.map +1 -1
  166. package/api/statement/control/terminate.d.ts +1 -2
  167. package/api/statement/control/terminate.d.ts.map +1 -0
  168. package/api/statement/control/terminate.js +117 -78
  169. package/api/statement/control/terminate.js.map +1 -1
  170. package/api/statement/control/with.d.ts +1 -0
  171. package/api/statement/control/with.d.ts.map +1 -0
  172. package/api/statement/control/with.js +72 -59
  173. package/api/statement/control/with.js.map +1 -1
  174. package/api/statement/declarations/declares.d.ts +1 -0
  175. package/api/statement/declarations/declares.d.ts.map +1 -0
  176. package/api/statement/declarations/declares.js +148 -121
  177. package/api/statement/declarations/declares.js.map +1 -1
  178. package/api/statement/iterations/for.d.ts +1 -0
  179. package/api/statement/iterations/for.d.ts.map +1 -0
  180. package/api/statement/iterations/for.js +337 -277
  181. package/api/statement/iterations/for.js.map +1 -1
  182. package/api/statement/iterations/while.d.ts +1 -0
  183. package/api/statement/iterations/while.d.ts.map +1 -0
  184. package/api/statement/iterations/while.js +152 -125
  185. package/api/statement/iterations/while.js.map +1 -1
  186. package/api/utils.d.ts +1 -0
  187. package/api/utils.d.ts.map +1 -0
  188. package/index.d.ts +1 -0
  189. package/index.d.ts.map +1 -0
  190. package/package.json +5 -5
  191. package/scope/builder.d.ts +27 -0
  192. package/scope/builder.d.ts.map +1 -0
  193. package/scope/builder.js +73 -0
  194. package/scope/builder.js.map +1 -0
  195. package/scope/event.d.ts +1 -0
  196. package/scope/event.d.ts.map +1 -0
  197. package/scope/finalizer.d.ts +1 -0
  198. package/scope/finalizer.d.ts.map +1 -0
  199. package/scope/index.d.ts +1 -0
  200. package/scope/index.d.ts.map +1 -0
  201. package/scope/pool.d.ts +1 -0
  202. package/scope/pool.d.ts.map +1 -0
  203. package/scope/proxy.d.ts +1 -0
  204. package/scope/proxy.d.ts.map +1 -0
  205. package/scope/proxy.js +1 -0
  206. package/scope/proxy.js.map +1 -1
  207. package/scope/scope.d.ts +1 -0
  208. package/scope/scope.d.ts.map +1 -0
  209. package/scope/scope.js +17 -11
  210. package/scope/scope.js.map +1 -1
  211. package/scope/stack.d.ts +1 -0
  212. package/scope/stack.d.ts.map +1 -0
  213. package/scope/stack.js +22 -14
  214. package/scope/stack.js.map +1 -1
  215. package/v8/enums.d.ts +1 -0
  216. package/v8/enums.d.ts.map +1 -0
  217. package/v8/enums.js +11 -11
  218. package/v8/enums.js.map +1 -1
  219. package/v8/factory.d.ts +1 -0
  220. package/v8/factory.d.ts.map +1 -0
  221. package/v8/factory.js +3 -1
  222. package/v8/factory.js.map +1 -1
  223. package/v8/index.d.ts +1 -0
  224. package/v8/index.d.ts.map +1 -0
  225. package/v8/inline.d.ts +1 -0
  226. package/v8/inline.d.ts.map +1 -0
  227. package/v8/inline.js +9 -5
  228. package/v8/inline.js.map +1 -1
  229. package/v8/language.d.ts +1 -0
  230. package/v8/language.d.ts.map +1 -0
  231. package/v8/node.d.ts +1 -0
  232. package/v8/node.d.ts.map +1 -0
  233. package/v8/parser.d.ts +1 -0
  234. package/v8/parser.d.ts.map +1 -0
  235. package/v8/parser.js +5 -5
  236. package/v8/parser.js.map +1 -1
  237. package/v8/stream.d.ts +1 -0
  238. package/v8/stream.d.ts.map +1 -0
  239. package/v8/stream.js +17 -7
  240. package/v8/stream.js.map +1 -1
  241. package/v8/token.d.ts +1 -0
  242. package/v8/token.d.ts.map +1 -0
  243. package/v8/token.js +363 -358
  244. package/v8/token.js.map +1 -1
  245. package/visit/index.d.ts +1 -0
  246. package/visit/index.d.ts.map +1 -0
  247. package/visit/visitor.d.ts +1 -0
  248. package/visit/visitor.d.ts.map +1 -0
  249. package/v8/nodes.d.ts +0 -0
  250. package/v8/nodes.js +0 -2
  251. package/v8/nodes.js.map +0 -1
@@ -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,116 +19,154 @@ 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);
22
+ let ImportSpecifier = (() => {
23
+ let _classDecorators = [Deserializer('ImportSpecifier')];
24
+ let _classDescriptor;
25
+ let _classExtraInitializers = [];
26
+ let _classThis;
27
+ let _classSuper = ModuleSpecifier;
28
+ var ImportSpecifier = class extends _classSuper {
29
+ static { _classThis = this; }
30
+ static {
31
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
32
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
33
+ ImportSpecifier = _classThis = _classDescriptor.value;
34
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
35
+ __runInitializers(_classThis, _classExtraInitializers);
36
+ }
37
+ imported;
38
+ static fromJSON(node, deserializer) {
39
+ return new ImportSpecifier(deserializer(node.local), deserializer(node.imported), node.range, node.loc);
40
+ }
41
+ static visit(node, visitNode) {
42
+ visitNode(node.local);
43
+ visitNode(node.imported);
44
+ }
45
+ constructor(local, imported, range, loc) {
46
+ super(local, range, loc);
47
+ this.imported = imported;
48
+ }
49
+ getImported() {
50
+ return this.imported;
51
+ }
52
+ getImportedName() {
53
+ return this.imported.getName();
54
+ }
55
+ set(stack, value) {
56
+ throw new Error('Method not implemented.');
57
+ }
58
+ get(stack, thisContext) {
59
+ throw new Error('Method not implemented.');
60
+ }
61
+ dependency(computed) {
62
+ return [];
63
+ }
64
+ dependencyPath(computed) {
65
+ return [];
66
+ }
67
+ toString() {
68
+ const local = this.local.toString();
69
+ const imported = this.imported.toString();
70
+ if (local == imported) {
71
+ return local;
72
+ }
73
+ return `${imported} as ${local}`;
74
+ }
75
+ toJson() {
76
+ return {
77
+ local: this.local.toJSON(),
78
+ imported: this.imported.toJSON()
79
+ };
80
+ }
81
+ };
82
+ return ImportSpecifier = _classThis;
83
+ })();
74
84
  export { ImportSpecifier };
75
85
  /**
76
86
  * A default import specifier, e.g., `foo` in `import foo from "mod.js";`.
77
87
  */
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);
88
+ let ImportDefaultSpecifier = (() => {
89
+ let _classDecorators = [Deserializer('ImportDefaultSpecifier')];
90
+ let _classDescriptor;
91
+ let _classExtraInitializers = [];
92
+ let _classThis;
93
+ let _classSuper = ModuleSpecifier;
94
+ var ImportDefaultSpecifier = class extends _classSuper {
95
+ static { _classThis = this; }
96
+ static {
97
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
98
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
99
+ ImportDefaultSpecifier = _classThis = _classDescriptor.value;
100
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
101
+ __runInitializers(_classThis, _classExtraInitializers);
102
+ }
103
+ static fromJSON(node, deserializer) {
104
+ return new ImportDefaultSpecifier(deserializer(node.local), node.range, node.loc);
105
+ }
106
+ static visit(node, visitNode) {
107
+ visitNode(node.local);
108
+ }
109
+ set(stack, value) {
110
+ throw new Error('Method not implemented.');
111
+ }
112
+ get(stack, thisContext) {
113
+ throw new Error('Method not implemented.');
114
+ }
115
+ dependency(computed) {
116
+ return [];
117
+ }
118
+ dependencyPath(computed) {
119
+ return [];
120
+ }
121
+ toString() {
122
+ return this.local.toString();
123
+ }
124
+ };
125
+ return ImportDefaultSpecifier = _classThis;
126
+ })();
104
127
  export { ImportDefaultSpecifier };
105
128
  /**
106
129
  * A namespace import specifier, e.g., `* as foo` in `import * as foo from "mod.js";`.
107
130
  */
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);
131
+ let ImportNamespaceSpecifier = (() => {
132
+ let _classDecorators = [Deserializer('ImportNamespaceSpecifier')];
133
+ let _classDescriptor;
134
+ let _classExtraInitializers = [];
135
+ let _classThis;
136
+ let _classSuper = ModuleSpecifier;
137
+ var ImportNamespaceSpecifier = class extends _classSuper {
138
+ static { _classThis = this; }
139
+ static {
140
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
141
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
142
+ ImportNamespaceSpecifier = _classThis = _classDescriptor.value;
143
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
144
+ __runInitializers(_classThis, _classExtraInitializers);
145
+ }
146
+ static fromJSON(node, deserializer) {
147
+ return new ImportNamespaceSpecifier(deserializer(node.local), node.range, node.loc);
148
+ }
149
+ static visit(node, visitNode) {
150
+ visitNode(node.local);
151
+ }
152
+ set(stack, value) {
153
+ throw new Error('Method not implemented.');
154
+ }
155
+ get(stack, thisContext) {
156
+ throw new Error('Method not implemented.');
157
+ }
158
+ dependency(computed) {
159
+ return [];
160
+ }
161
+ dependencyPath(computed) {
162
+ return [];
163
+ }
164
+ toString() {
165
+ return `* as ${this.local.toString()}`;
166
+ }
167
+ };
168
+ return ImportNamespaceSpecifier = _classThis;
169
+ })();
134
170
  export { ImportNamespaceSpecifier };
135
171
  /**
136
172
  * An import declaration, e.g., import foo from "mod";.
@@ -156,113 +192,128 @@ export { ImportNamespaceSpecifier };
156
192
  * import "module-name";
157
193
  *
158
194
  */
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 };
195
+ let ImportDeclaration = (() => {
196
+ let _classDecorators = [Deserializer('ImportDeclaration')];
197
+ let _classDescriptor;
198
+ let _classExtraInitializers = [];
199
+ let _classThis;
200
+ let _classSuper = AbstractExpressionNode;
201
+ var ImportDeclaration = class extends _classSuper {
202
+ static { _classThis = this; }
203
+ static {
204
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
205
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
206
+ ImportDeclaration = _classThis = _classDescriptor.value;
207
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
208
+ __runInitializers(_classThis, _classExtraInitializers);
209
+ }
210
+ source;
211
+ specifiers;
212
+ assertions;
213
+ static fromJSON(node, deserializer) {
214
+ return new ImportDeclaration(deserializer(node.source), node.specifiers?.map(deserializer), node.assertions?.map(deserializer), node.range, node.loc);
215
+ }
216
+ static visit(node, visitNode) {
217
+ visitNode(node.source);
218
+ node.specifiers?.forEach(visitNode);
219
+ node.assertions?.forEach(visitNode);
220
+ }
221
+ constructor(source, specifiers, assertions, range, loc) {
222
+ super(range, loc);
223
+ this.source = source;
224
+ this.specifiers = specifiers;
225
+ this.assertions = assertions;
226
+ }
227
+ getSource() {
228
+ return this.source;
229
+ }
230
+ getSpecifiers() {
231
+ return this.specifiers;
232
+ }
233
+ getAssertions() {
234
+ return this.assertions;
235
+ }
236
+ set(stack) {
237
+ throw new Error(`ImportDeclaration.#set() has no implementation.`);
238
+ }
239
+ get(stack) {
240
+ let importCallOptions;
241
+ if (this.assertions) {
242
+ const importAssertions = this.assertions
243
+ .map(assertion => assertion.get(stack))
244
+ .reduce((p, c) => Object.assign(p, c), {});
245
+ if (importAssertions) {
246
+ importCallOptions = { assert: importAssertions };
247
+ }
194
248
  }
249
+ const module = stack.importModule(this.source.get(), importCallOptions);
250
+ if (!this.specifiers) {
251
+ return;
252
+ }
253
+ this.specifiers.forEach(specifier => {
254
+ const local = specifier.getLocalName();
255
+ if (specifier instanceof ImportSpecifier) {
256
+ const imported = specifier.getImportedName();
257
+ const importedValue = module.get(imported);
258
+ stack.getModule()?.set(local, importedValue);
259
+ const scopeSubscription = module.subscribe(local, (newValue, oldValue) => {
260
+ if (newValue !== oldValue) {
261
+ stack.getModule()?.set(local, newValue);
262
+ }
263
+ });
264
+ stack.onDestroy(() => scopeSubscription.unsubscribe());
265
+ }
266
+ else if (specifier instanceof ImportDefaultSpecifier) {
267
+ const defaultValue = module.get('default');
268
+ stack.getModule()?.set(local, defaultValue);
269
+ const scopeSubscription = module.subscribe('default', (newValue, oldValue) => {
270
+ if (newValue !== oldValue) {
271
+ stack.getModule()?.set(local, newValue);
272
+ }
273
+ });
274
+ stack.onDestroy(() => scopeSubscription.unsubscribe());
275
+ }
276
+ else if (specifier instanceof ImportNamespaceSpecifier) {
277
+ stack.getModule()?.importModule(local, module);
278
+ }
279
+ });
280
+ }
281
+ dependency(computed) {
282
+ return [];
195
283
  }
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());
284
+ dependencyPath(computed) {
285
+ return [];
286
+ }
287
+ toString() {
288
+ if (!this.specifiers) {
289
+ return `import '${this.source.toString()}'`;
290
+ }
291
+ const parts = [];
292
+ const importDefaultSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportDefaultSpecifier);
293
+ if (importDefaultSpecifiers?.length) {
294
+ parts.push(importDefaultSpecifiers[0].toString());
212
295
  }
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());
296
+ const importNamespaceSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportNamespaceSpecifier);
297
+ if (importNamespaceSpecifiers?.length) {
298
+ parts.push(importNamespaceSpecifiers[0].toString());
222
299
  }
223
- else if (specifier instanceof ImportNamespaceSpecifier) {
224
- stack.getModule()?.importModule(local, module);
300
+ const importSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportSpecifier);
301
+ if (importSpecifiers?.length) {
302
+ const importSpecifiersString = importSpecifiers.map(importSpecifier => importSpecifier.toString()).join(',');
303
+ parts.push(`{ ${importSpecifiersString} }`);
225
304
  }
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);
305
+ return `import ${parts.join(', ')} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
306
+ }
307
+ toJson() {
308
+ return {
309
+ source: this.source.toJSON(),
310
+ specifiers: this.specifiers?.map(specifier => specifier.toJSON()),
311
+ assertions: this.assertions?.map(assertion => assertion.toJSON()),
312
+ };
313
+ }
314
+ };
315
+ return ImportDeclaration = _classThis;
316
+ })();
266
317
  export { ImportDeclaration };
267
318
  /**
268
319
  * `ImportExpression` node represents Dynamic Imports such as `import(source)`.
@@ -270,51 +321,65 @@ export { ImportDeclaration };
270
321
  * but it can be an arbitrary expression node.
271
322
  * var promise = import("module-name");
272
323
  */
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);
324
+ let ImportExpression = (() => {
325
+ let _classDecorators = [Deserializer('ImportExpression')];
326
+ let _classDescriptor;
327
+ let _classExtraInitializers = [];
328
+ let _classThis;
329
+ let _classSuper = AbstractExpressionNode;
330
+ var ImportExpression = class extends _classSuper {
331
+ static { _classThis = this; }
332
+ static {
333
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
334
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
335
+ ImportExpression = _classThis = _classDescriptor.value;
336
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
337
+ __runInitializers(_classThis, _classExtraInitializers);
338
+ }
339
+ source;
340
+ attributes;
341
+ static fromJSON(node, deserializer) {
342
+ return new ImportExpression(deserializer(node.source), (node.attributes && deserializer(node.attributes)) || undefined, node.range, node.loc);
343
+ }
344
+ static visit(node, visitNode) {
345
+ visitNode(node.source);
346
+ node.attributes && visitNode(node.attributes);
347
+ }
348
+ constructor(source, attributes, range, loc) {
349
+ super(range, loc);
350
+ this.source = source;
351
+ this.attributes = attributes;
352
+ }
353
+ getSource() {
354
+ return this.source;
355
+ }
356
+ set(stack) {
357
+ throw new Error(`ImportDeclaration.#set() has no implementation.`);
358
+ }
359
+ get(stack) {
360
+ let importCallOptions;
361
+ if (this.attributes) {
362
+ importCallOptions = this.attributes.get(stack);
363
+ }
364
+ const module = stack.importModule(this.source.get(), importCallOptions);
365
+ return Promise.resolve(module);
366
+ }
367
+ dependency(computed) {
368
+ return [];
369
+ }
370
+ dependencyPath(computed) {
371
+ return [];
372
+ }
373
+ toString() {
374
+ return `import(${this.source.toString()}${this.attributes ? `, ${this.attributes.toString()}` : ''})`;
375
+ }
376
+ toJson() {
377
+ return {
378
+ source: this.source.toJSON(),
379
+ };
380
+ }
381
+ };
382
+ return ImportExpression = _classThis;
383
+ })();
319
384
  export { ImportExpression };
320
385
  //# sourceMappingURL=import.js.map