@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.
- package/README.md +48 -1
- 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 +603 -472
- 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 +53 -41
- 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 +83 -69
- 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 +40 -28
- 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 +81 -68
- 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 +54 -42
- 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 +52 -40
- 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 +70 -58
- 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 +216 -175
- 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 +60 -47
- 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 +147 -122
- 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 +85 -70
- 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 +44 -32
- 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 +500 -443
- 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 +104 -89
- 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 +243 -200
- 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 +56 -44
- 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 +228 -160
- 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 +63 -50
- 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 +343 -290
- 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 +318 -253
- 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 +88 -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 +54 -42
- 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 +78 -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 +56 -44
- 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 +53 -41
- 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 +51 -39
- 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 +51 -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 +95 -81
- 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 +69 -55
- 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 +97 -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 +78 -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 +53 -40
- 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 +65 -53
- 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 +43 -33
- 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 +79 -65
- 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 +180 -141
- 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 +117 -78
- 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 +72 -59
- 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 +148 -121
- 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 +337 -277
- 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 +152 -125
- 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 +5 -5
- package/scope/builder.d.ts +27 -0
- package/scope/builder.d.ts.map +1 -0
- package/scope/builder.js +73 -0
- package/scope/builder.js.map +1 -0
- 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 +22 -14
- 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 +11 -11
- 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 +17 -7
- 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 +363 -358
- 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/v8/nodes.d.ts +0 -0
- package/v8/nodes.js +0 -2
- package/v8/nodes.js.map +0 -1
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,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 =
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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());
|
|
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
|
-
|
|
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());
|
|
296
|
+
const importNamespaceSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportNamespaceSpecifier);
|
|
297
|
+
if (importNamespaceSpecifiers?.length) {
|
|
298
|
+
parts.push(importNamespaceSpecifiers[0].toString());
|
|
222
299
|
}
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
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);
|
|
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 =
|
|
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
|
-
|
|
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
|