@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.
- package/api/abstract.d.ts +1 -0
- package/api/abstract.d.ts.map +1 -0
- package/api/abstract.js +12 -0
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +1 -0
- package/api/class/class.d.ts.map +1 -0
- package/api/class/class.js +563 -482
- package/api/class/class.js.map +1 -1
- package/api/class/decorator.d.ts +1 -0
- package/api/class/decorator.d.ts.map +1 -0
- package/api/class/decorator.js +49 -42
- package/api/class/decorator.js.map +1 -1
- package/api/computing/call.d.ts +1 -0
- package/api/computing/call.d.ts.map +1 -0
- package/api/computing/call.js +79 -70
- package/api/computing/call.js.map +1 -1
- package/api/computing/debugger.d.ts +1 -0
- package/api/computing/debugger.d.ts.map +1 -0
- package/api/computing/debugger.js +36 -29
- package/api/computing/debugger.js.map +1 -1
- package/api/computing/new.d.ts +1 -0
- package/api/computing/new.d.ts.map +1 -0
- package/api/computing/new.js +77 -69
- package/api/computing/new.js.map +1 -1
- package/api/computing/rest.d.ts +1 -0
- package/api/computing/rest.d.ts.map +1 -0
- package/api/computing/rest.js +50 -43
- package/api/computing/rest.js.map +1 -1
- package/api/computing/return.d.ts +1 -0
- package/api/computing/return.d.ts.map +1 -0
- package/api/computing/return.js +48 -41
- package/api/computing/return.js.map +1 -1
- package/api/computing/spread.d.ts +1 -0
- package/api/computing/spread.d.ts.map +1 -0
- package/api/computing/spread.js +66 -59
- package/api/computing/spread.js.map +1 -1
- package/api/computing/throw.d.ts +1 -0
- package/api/computing/throw.d.ts.map +1 -0
- package/api/computing/throw.js +204 -178
- package/api/computing/throw.js.map +1 -1
- package/api/computing/yield.d.ts +1 -0
- package/api/computing/yield.d.ts.map +1 -0
- package/api/computing/yield.js +56 -48
- package/api/computing/yield.js.map +1 -1
- package/api/definition/array.d.ts +1 -0
- package/api/definition/array.d.ts.map +1 -0
- package/api/definition/array.js +139 -124
- package/api/definition/array.js.map +1 -1
- package/api/definition/bind.d.ts +1 -0
- package/api/definition/bind.d.ts.map +1 -0
- package/api/definition/bind.js +81 -71
- package/api/definition/bind.js.map +1 -1
- package/api/definition/comment.d.ts +1 -0
- package/api/definition/comment.d.ts.map +1 -0
- package/api/definition/comment.js +40 -33
- package/api/definition/comment.js.map +1 -1
- package/api/definition/function.d.ts +1 -0
- package/api/definition/function.d.ts.map +1 -0
- package/api/definition/function.js +484 -447
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.d.ts +1 -0
- package/api/definition/member.d.ts.map +1 -0
- package/api/definition/member.js +100 -90
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.d.ts +1 -0
- package/api/definition/object.d.ts.map +1 -0
- package/api/definition/object.js +230 -202
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.d.ts +1 -0
- package/api/definition/statement.d.ts.map +1 -0
- package/api/definition/statement.js +52 -45
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +1 -0
- package/api/definition/values.d.ts.map +1 -0
- package/api/definition/values.js +210 -167
- package/api/definition/values.js.map +1 -1
- package/api/deserialize/deserialize.d.ts +2 -1
- package/api/deserialize/deserialize.d.ts.map +1 -0
- package/api/deserialize/deserialize.js +5 -7
- package/api/deserialize/deserialize.js.map +1 -1
- package/api/deserialize/type-store.d.ts +1 -0
- package/api/deserialize/type-store.d.ts.map +1 -0
- package/api/expression.d.ts +1 -0
- package/api/expression.d.ts.map +1 -0
- package/api/index.d.ts +1 -0
- package/api/index.d.ts.map +1 -0
- package/api/module/common.d.ts +1 -0
- package/api/module/common.d.ts.map +1 -0
- package/api/module/common.js +59 -51
- package/api/module/common.js.map +1 -1
- package/api/module/export.d.ts +1 -0
- package/api/module/export.d.ts.map +1 -0
- package/api/module/export.js +327 -294
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +1 -0
- package/api/module/import.d.ts.map +1 -0
- package/api/module/import.js +298 -258
- package/api/module/import.js.map +1 -1
- package/api/operators/assignment.d.ts +1 -0
- package/api/operators/assignment.d.ts.map +1 -0
- package/api/operators/assignment.js +84 -75
- package/api/operators/assignment.js.map +1 -1
- package/api/operators/await.d.ts +1 -0
- package/api/operators/await.d.ts.map +1 -0
- package/api/operators/await.js +50 -43
- package/api/operators/await.js.map +1 -1
- package/api/operators/binary.d.ts +1 -0
- package/api/operators/binary.d.ts.map +1 -0
- package/api/operators/binary.js +74 -64
- package/api/operators/binary.js.map +1 -1
- package/api/operators/chaining.d.ts +1 -0
- package/api/operators/chaining.d.ts.map +1 -0
- package/api/operators/chaining.js +52 -45
- package/api/operators/chaining.js.map +1 -1
- package/api/operators/comma.d.ts +1 -0
- package/api/operators/comma.d.ts.map +1 -0
- package/api/operators/comma.js +49 -42
- package/api/operators/comma.js.map +1 -1
- package/api/operators/grouping.d.ts +1 -0
- package/api/operators/grouping.d.ts.map +1 -0
- package/api/operators/grouping.js +47 -40
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/logical.d.ts +1 -0
- package/api/operators/logical.d.ts.map +1 -0
- package/api/operators/logical.js +47 -37
- package/api/operators/logical.js.map +1 -1
- package/api/operators/pipeline.d.ts +1 -0
- package/api/operators/pipeline.d.ts.map +1 -0
- package/api/operators/pipeline.js +91 -82
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/ternary.d.ts +1 -0
- package/api/operators/ternary.d.ts.map +1 -0
- package/api/operators/ternary.js +65 -56
- package/api/operators/ternary.js.map +1 -1
- package/api/operators/types.d.ts +1 -0
- package/api/operators/types.d.ts.map +1 -0
- package/api/operators/unary.d.ts +1 -0
- package/api/operators/unary.d.ts.map +1 -0
- package/api/operators/unary.js +93 -82
- package/api/operators/unary.js.map +1 -1
- package/api/operators/update.d.ts +1 -0
- package/api/operators/update.d.ts.map +1 -0
- package/api/operators/update.js +74 -62
- package/api/operators/update.js.map +1 -1
- package/api/program.d.ts +1 -0
- package/api/program.d.ts.map +1 -0
- package/api/program.js +49 -41
- package/api/program.js.map +1 -1
- package/api/statement/control/block.d.ts +1 -0
- package/api/statement/control/block.d.ts.map +1 -0
- package/api/statement/control/block.js +61 -54
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +1 -1
- package/api/statement/control/empty.d.ts.map +1 -0
- package/api/statement/control/empty.js +39 -34
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +1 -0
- package/api/statement/control/if.d.ts.map +1 -0
- package/api/statement/control/if.js +75 -66
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +1 -0
- package/api/statement/control/switch.d.ts.map +1 -0
- package/api/statement/control/switch.js +168 -144
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +1 -2
- package/api/statement/control/terminate.d.ts.map +1 -0
- package/api/statement/control/terminate.js +105 -81
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/control/with.d.ts +1 -0
- package/api/statement/control/with.d.ts.map +1 -0
- package/api/statement/control/with.js +68 -60
- package/api/statement/control/with.js.map +1 -1
- package/api/statement/declarations/declares.d.ts +1 -0
- package/api/statement/declarations/declares.d.ts.map +1 -0
- package/api/statement/declarations/declares.js +140 -123
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.d.ts +1 -0
- package/api/statement/iterations/for.d.ts.map +1 -0
- package/api/statement/iterations/for.js +320 -280
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +1 -0
- package/api/statement/iterations/while.d.ts.map +1 -0
- package/api/statement/iterations/while.js +144 -127
- package/api/statement/iterations/while.js.map +1 -1
- package/api/utils.d.ts +1 -0
- package/api/utils.d.ts.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -0
- package/package.json +4 -4
- package/scope/event.d.ts +1 -0
- package/scope/event.d.ts.map +1 -0
- package/scope/finalizer.d.ts +1 -0
- package/scope/finalizer.d.ts.map +1 -0
- package/scope/index.d.ts +1 -0
- package/scope/index.d.ts.map +1 -0
- package/scope/pool.d.ts +1 -0
- package/scope/pool.d.ts.map +1 -0
- package/scope/proxy.d.ts +1 -0
- package/scope/proxy.d.ts.map +1 -0
- package/scope/proxy.js +1 -0
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +1 -0
- package/scope/scope.d.ts.map +1 -0
- package/scope/scope.js +17 -11
- package/scope/scope.js.map +1 -1
- package/scope/stack.d.ts +1 -0
- package/scope/stack.d.ts.map +1 -0
- package/scope/stack.js +21 -13
- package/scope/stack.js.map +1 -1
- package/v8/enums.d.ts +1 -0
- package/v8/enums.d.ts.map +1 -0
- package/v8/enums.js +15 -13
- package/v8/enums.js.map +1 -1
- package/v8/factory.d.ts +1 -0
- package/v8/factory.d.ts.map +1 -0
- package/v8/factory.js +3 -1
- package/v8/factory.js.map +1 -1
- package/v8/index.d.ts +1 -0
- package/v8/index.d.ts.map +1 -0
- package/v8/inline.d.ts +1 -0
- package/v8/inline.d.ts.map +1 -0
- package/v8/inline.js +9 -5
- package/v8/inline.js.map +1 -1
- package/v8/language.d.ts +1 -0
- package/v8/language.d.ts.map +1 -0
- package/v8/node.d.ts +1 -0
- package/v8/node.d.ts.map +1 -0
- package/v8/parser.d.ts +1 -0
- package/v8/parser.d.ts.map +1 -0
- package/v8/parser.js +5 -5
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +1 -0
- package/v8/stream.d.ts.map +1 -0
- package/v8/stream.js +19 -8
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +1 -0
- package/v8/token.d.ts.map +1 -0
- package/v8/token.js +365 -359
- package/v8/token.js.map +1 -1
- package/visit/index.d.ts +1 -0
- package/visit/index.d.ts.map +1 -0
- package/visit/visitor.d.ts +1 -0
- package/visit/visitor.d.ts.map +1 -0
package/api/module/import.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
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 =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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 =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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 =
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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 =
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
|
-
|
|
224
|
-
|
|
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
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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 =
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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
|