@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/export.js
CHANGED
|
@@ -31,12 +31,10 @@
|
|
|
31
31
|
* export { import1 as name1, import2 as name2, …, nameN } from …;
|
|
32
32
|
* export { default, … } from …;
|
|
33
33
|
*/
|
|
34
|
-
|
|
35
|
-
import { __decorate, __metadata } from "tslib";
|
|
34
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
36
35
|
import { ReactiveScope } from '../../scope/scope.js';
|
|
37
36
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
38
37
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
39
|
-
import { Identifier, Literal } from '../definition/values.js';
|
|
40
38
|
import { ModuleSpecifier } from './common.js';
|
|
41
39
|
/**
|
|
42
40
|
* An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` in `export {bar as foo}`.
|
|
@@ -52,53 +50,65 @@ import { ModuleSpecifier } from './common.js';
|
|
|
52
50
|
* such as in `export {bar as foo}`, the `exported` field is an `Identifier` node representing `foo`,
|
|
53
51
|
* and the `local` field is an `Identifier` node representing `bar`.
|
|
54
52
|
*/
|
|
55
|
-
let ExportSpecifier =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
53
|
+
let ExportSpecifier = (() => {
|
|
54
|
+
let _classDecorators = [Deserializer('ExportSpecifier')];
|
|
55
|
+
let _classDescriptor;
|
|
56
|
+
let _classExtraInitializers = [];
|
|
57
|
+
let _classThis;
|
|
58
|
+
let _classSuper = ModuleSpecifier;
|
|
59
|
+
var ExportSpecifier = class extends _classSuper {
|
|
60
|
+
static { _classThis = this; }
|
|
61
|
+
static {
|
|
62
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
63
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
64
|
+
ExportSpecifier = _classThis = _classDescriptor.value;
|
|
65
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
66
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
67
|
+
}
|
|
68
|
+
exported;
|
|
69
|
+
static fromJSON(node, deserializer) {
|
|
70
|
+
return new ExportSpecifier(deserializer(node.local), deserializer(node.exported), node.range, node.loc);
|
|
71
|
+
}
|
|
72
|
+
static visit(node, visitNode) {
|
|
73
|
+
visitNode(node.local);
|
|
74
|
+
visitNode(node.exported);
|
|
75
|
+
}
|
|
76
|
+
constructor(local, exported, range, loc) {
|
|
77
|
+
super(local, range, loc);
|
|
78
|
+
this.exported = exported;
|
|
79
|
+
}
|
|
80
|
+
getExported() {
|
|
81
|
+
return this.exported;
|
|
82
|
+
}
|
|
83
|
+
set(stack, value) {
|
|
84
|
+
throw new Error('Method not implemented.');
|
|
85
|
+
}
|
|
86
|
+
get(stack, thisContext) {
|
|
87
|
+
throw new Error('Method not implemented.');
|
|
88
|
+
}
|
|
89
|
+
dependency(computed) {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
dependencyPath(computed) {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
toString() {
|
|
96
|
+
const local = this.local.toString();
|
|
97
|
+
const exported = this.exported.toString();
|
|
98
|
+
if (local == exported) {
|
|
99
|
+
return local;
|
|
100
|
+
}
|
|
101
|
+
return `${local} as ${exported}`;
|
|
102
|
+
}
|
|
103
|
+
toJson() {
|
|
104
|
+
return {
|
|
105
|
+
local: this.local.toJSON(),
|
|
106
|
+
exported: this.exported.toJSON()
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return ExportSpecifier = _classThis;
|
|
111
|
+
})();
|
|
102
112
|
export { ExportSpecifier };
|
|
103
113
|
/**
|
|
104
114
|
* An export named declaration, e.g.,
|
|
@@ -108,267 +118,310 @@ export { ExportSpecifier };
|
|
|
108
118
|
*
|
|
109
119
|
* Note: Having `declaration` populated with non-empty `specifiers` or non-null `source` results in an invalid state.
|
|
110
120
|
*/
|
|
111
|
-
let ExportNamedDeclaration =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
let importCallOptions;
|
|
171
|
-
if (this.assertions) {
|
|
172
|
-
const importAssertions = this.assertions
|
|
173
|
-
.map(assertion => assertion.get(stack))
|
|
174
|
-
.reduce((p, c) => Object.assign(p, c), {});
|
|
175
|
-
if (importAssertions) {
|
|
176
|
-
importCallOptions = { assert: importAssertions };
|
|
121
|
+
let ExportNamedDeclaration = (() => {
|
|
122
|
+
let _classDecorators = [Deserializer('ExportNamedDeclaration')];
|
|
123
|
+
let _classDescriptor;
|
|
124
|
+
let _classExtraInitializers = [];
|
|
125
|
+
let _classThis;
|
|
126
|
+
let _classSuper = AbstractExpressionNode;
|
|
127
|
+
var ExportNamedDeclaration = class extends _classSuper {
|
|
128
|
+
static { _classThis = this; }
|
|
129
|
+
static {
|
|
130
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
131
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
132
|
+
ExportNamedDeclaration = _classThis = _classDescriptor.value;
|
|
133
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
134
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
135
|
+
}
|
|
136
|
+
specifiers;
|
|
137
|
+
declaration;
|
|
138
|
+
source;
|
|
139
|
+
assertions;
|
|
140
|
+
static fromJSON(node, deserializer) {
|
|
141
|
+
return new ExportNamedDeclaration(node.specifiers.map(deserializer), node.declaration ? deserializer(node.declaration) : void 0, node.source ? deserializer(node.source) : void 0, node.assertions ? node.assertions.map(deserializer) : void 0, node.range, node.loc);
|
|
142
|
+
}
|
|
143
|
+
static visit(node, visitNode) {
|
|
144
|
+
node.specifiers.map(visitNode);
|
|
145
|
+
node.source && visitNode(node.source);
|
|
146
|
+
node.declaration && visitNode(node.declaration);
|
|
147
|
+
node.assertions?.forEach(visitNode);
|
|
148
|
+
}
|
|
149
|
+
constructor(specifiers, declaration, source, assertions, range, loc) {
|
|
150
|
+
super(range, loc);
|
|
151
|
+
this.specifiers = specifiers;
|
|
152
|
+
this.declaration = declaration;
|
|
153
|
+
this.source = source;
|
|
154
|
+
this.assertions = assertions;
|
|
155
|
+
}
|
|
156
|
+
getSource() {
|
|
157
|
+
return this.source;
|
|
158
|
+
}
|
|
159
|
+
getSpecifiers() {
|
|
160
|
+
return this.specifiers;
|
|
161
|
+
}
|
|
162
|
+
getDeclaration() {
|
|
163
|
+
return this.declaration;
|
|
164
|
+
}
|
|
165
|
+
getAssertions() {
|
|
166
|
+
return this.assertions;
|
|
167
|
+
}
|
|
168
|
+
set(stack) {
|
|
169
|
+
throw new Error(`ExportNamedDeclaration.#set() has no implementation.`);
|
|
170
|
+
}
|
|
171
|
+
get(stack) {
|
|
172
|
+
if (this.declaration) {
|
|
173
|
+
this.exportDeclaration(stack);
|
|
174
|
+
}
|
|
175
|
+
else if (this.source) {
|
|
176
|
+
this.exportFromSource(stack);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
this.exportLocal(stack);
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
exportDeclaration(stack) {
|
|
183
|
+
if (!this.declaration) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
this.declaration.get(stack);
|
|
187
|
+
const declaredName = this.declaration.getDeclarationName?.();
|
|
188
|
+
if (!declaredName) {
|
|
189
|
+
throw new Error(`Name is not defined for ${this.declaration.toString()}`);
|
|
190
|
+
}
|
|
191
|
+
const value = stack.get(declaredName);
|
|
192
|
+
stack.getModule().set(declaredName, value);
|
|
193
|
+
}
|
|
194
|
+
exportFromSource(stack) {
|
|
195
|
+
if (!this.source) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
let importCallOptions;
|
|
199
|
+
if (this.assertions) {
|
|
200
|
+
const importAssertions = this.assertions
|
|
201
|
+
.map(assertion => assertion.get(stack))
|
|
202
|
+
.reduce((p, c) => Object.assign(p, c), {});
|
|
203
|
+
if (importAssertions) {
|
|
204
|
+
importCallOptions = { assert: importAssertions };
|
|
189
205
|
}
|
|
190
|
-
}
|
|
191
|
-
stack.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const localValue = stack.get(localName);
|
|
200
|
-
localModule.set(exportedName, localValue);
|
|
201
|
-
const scope = stack.findScope(localName);
|
|
202
|
-
if (scope instanceof ReactiveScope) {
|
|
203
|
-
const scopeSubscription = scope.subscribe(localName, (newLocalValue, oldLocalValue) => {
|
|
206
|
+
}
|
|
207
|
+
const sourceModule = stack.importModule(this.source.get(), importCallOptions);
|
|
208
|
+
const localModule = stack.getModule();
|
|
209
|
+
this.specifiers.forEach(specifier => {
|
|
210
|
+
const localName = specifier.getLocal().get(stack);
|
|
211
|
+
const exportedName = specifier.getExported().get(stack);
|
|
212
|
+
const localValue = sourceModule.get(localName);
|
|
213
|
+
localModule.set(exportedName, localValue);
|
|
214
|
+
const scopeSubscription = sourceModule.subscribe(localName, (newLocalValue, oldLocalValue) => {
|
|
204
215
|
if (newLocalValue !== oldLocalValue) {
|
|
205
216
|
localModule.set(exportedName, newLocalValue);
|
|
206
217
|
}
|
|
207
218
|
});
|
|
208
219
|
stack.onDestroy(() => scopeSubscription.unsubscribe());
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
exportLocal(stack, importCallOptions) {
|
|
223
|
+
const localModule = stack.getModule();
|
|
224
|
+
this.specifiers.forEach(specifier => {
|
|
225
|
+
const localName = specifier.getLocal().get(stack);
|
|
226
|
+
const exportedName = specifier.getExported().get(stack);
|
|
227
|
+
const localValue = stack.get(localName);
|
|
228
|
+
localModule.set(exportedName, localValue);
|
|
229
|
+
const scope = stack.findScope(localName);
|
|
230
|
+
if (scope instanceof ReactiveScope) {
|
|
231
|
+
const scopeSubscription = scope.subscribe(localName, (newLocalValue, oldLocalValue) => {
|
|
232
|
+
if (newLocalValue !== oldLocalValue) {
|
|
233
|
+
localModule.set(exportedName, newLocalValue);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
stack.onDestroy(() => scopeSubscription.unsubscribe());
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
dependency(computed) {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
dependencyPath(computed) {
|
|
244
|
+
return [];
|
|
245
|
+
}
|
|
246
|
+
toString() {
|
|
247
|
+
if (this.declaration) {
|
|
248
|
+
const declaration = this.declaration.toString();
|
|
249
|
+
return `export ${declaration}`;
|
|
209
250
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return `${exportStr} from ${source}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
|
|
230
|
-
}
|
|
231
|
-
toJson() {
|
|
232
|
-
return {
|
|
233
|
-
specifiers: this.specifiers.map(specifier => specifier.toJSON()),
|
|
234
|
-
source: this.source?.toJSON(),
|
|
235
|
-
declaration: this.declaration?.toJSON(),
|
|
236
|
-
assertions: this.assertions?.map(assertion => assertion.toJSON()),
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
ExportNamedDeclaration = ExportNamedDeclaration_1 = __decorate([
|
|
241
|
-
Deserializer('ExportNamedDeclaration'),
|
|
242
|
-
__metadata("design:paramtypes", [Array, Object, Literal, Array, Array, Object])
|
|
243
|
-
], ExportNamedDeclaration);
|
|
251
|
+
const specifiers = this.specifiers.map(specifier => specifier.toString()).join(',');
|
|
252
|
+
let exportStr = `export {${specifiers}}`;
|
|
253
|
+
if (!this.source) {
|
|
254
|
+
return `${exportStr};`;
|
|
255
|
+
}
|
|
256
|
+
const source = this.source.toString();
|
|
257
|
+
return `${exportStr} from ${source}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
|
|
258
|
+
}
|
|
259
|
+
toJson() {
|
|
260
|
+
return {
|
|
261
|
+
specifiers: this.specifiers.map(specifier => specifier.toJSON()),
|
|
262
|
+
source: this.source?.toJSON(),
|
|
263
|
+
declaration: this.declaration?.toJSON(),
|
|
264
|
+
assertions: this.assertions?.map(assertion => assertion.toJSON()),
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
return ExportNamedDeclaration = _classThis;
|
|
269
|
+
})();
|
|
244
270
|
export { ExportNamedDeclaration };
|
|
245
271
|
/**
|
|
246
272
|
* An export default declaration, e.g.,
|
|
247
273
|
* `export default function () {};`
|
|
248
274
|
* or `export default 1;`.
|
|
249
275
|
*/
|
|
250
|
-
let ExportDefaultDeclaration =
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
declaration
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
]
|
|
276
|
+
let ExportDefaultDeclaration = (() => {
|
|
277
|
+
let _classDecorators = [Deserializer('ExportDefaultDeclaration')];
|
|
278
|
+
let _classDescriptor;
|
|
279
|
+
let _classExtraInitializers = [];
|
|
280
|
+
let _classThis;
|
|
281
|
+
let _classSuper = AbstractExpressionNode;
|
|
282
|
+
var ExportDefaultDeclaration = class extends _classSuper {
|
|
283
|
+
static { _classThis = this; }
|
|
284
|
+
static {
|
|
285
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
286
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
287
|
+
ExportDefaultDeclaration = _classThis = _classDescriptor.value;
|
|
288
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
289
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
290
|
+
}
|
|
291
|
+
declaration;
|
|
292
|
+
static fromJSON(node, deserializer) {
|
|
293
|
+
return new ExportDefaultDeclaration(deserializer(node.declaration), node.range, node.loc);
|
|
294
|
+
}
|
|
295
|
+
static visit(node, visitNode) {
|
|
296
|
+
visitNode(node.declaration);
|
|
297
|
+
}
|
|
298
|
+
constructor(declaration, range, loc) {
|
|
299
|
+
super(range, loc);
|
|
300
|
+
this.declaration = declaration;
|
|
301
|
+
}
|
|
302
|
+
getDeclaration() {
|
|
303
|
+
return this.declaration;
|
|
304
|
+
}
|
|
305
|
+
set(stack) {
|
|
306
|
+
throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
|
|
307
|
+
}
|
|
308
|
+
get(stack) {
|
|
309
|
+
const declaration = this.declaration.get(stack);
|
|
310
|
+
stack.getModule().set('default', declaration);
|
|
311
|
+
}
|
|
312
|
+
dependency(computed) {
|
|
313
|
+
return [];
|
|
314
|
+
}
|
|
315
|
+
dependencyPath(computed) {
|
|
316
|
+
return [];
|
|
317
|
+
}
|
|
318
|
+
toString() {
|
|
319
|
+
const declaration = this.declaration.toString();
|
|
320
|
+
return `export default ${declaration}`;
|
|
321
|
+
}
|
|
322
|
+
toJson() {
|
|
323
|
+
return {
|
|
324
|
+
declaration: this.declaration.toJSON(),
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
return ExportDefaultDeclaration = _classThis;
|
|
329
|
+
})();
|
|
291
330
|
export { ExportDefaultDeclaration };
|
|
292
331
|
/**
|
|
293
332
|
* An export batch declaration, e.g., `export * from "mod";`.
|
|
294
333
|
*/
|
|
295
|
-
let ExportAllDeclaration =
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
getAssertions() {
|
|
317
|
-
return this.assertions;
|
|
318
|
-
}
|
|
319
|
-
set(stack) {
|
|
320
|
-
throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
|
|
321
|
-
}
|
|
322
|
-
get(stack) {
|
|
323
|
-
let importCallOptions;
|
|
324
|
-
if (this.assertions) {
|
|
325
|
-
const importAssertions = this.assertions
|
|
326
|
-
.map(assertion => assertion.get(stack))
|
|
327
|
-
.reduce((p, c) => Object.assign(p, c), {});
|
|
328
|
-
if (importAssertions) {
|
|
329
|
-
importCallOptions = { assert: importAssertions };
|
|
330
|
-
}
|
|
334
|
+
let ExportAllDeclaration = (() => {
|
|
335
|
+
let _classDecorators = [Deserializer('ExportAllDeclaration')];
|
|
336
|
+
let _classDescriptor;
|
|
337
|
+
let _classExtraInitializers = [];
|
|
338
|
+
let _classThis;
|
|
339
|
+
let _classSuper = AbstractExpressionNode;
|
|
340
|
+
var ExportAllDeclaration = class extends _classSuper {
|
|
341
|
+
static { _classThis = this; }
|
|
342
|
+
static {
|
|
343
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
344
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
345
|
+
ExportAllDeclaration = _classThis = _classDescriptor.value;
|
|
346
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
347
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
348
|
+
}
|
|
349
|
+
source;
|
|
350
|
+
exported;
|
|
351
|
+
assertions;
|
|
352
|
+
static fromJSON(node, deserializer) {
|
|
353
|
+
return new ExportAllDeclaration(deserializer(node.source), node.exported ? deserializer(node.exported) : void 0, node.assertions?.map(deserializer), node.range, node.loc);
|
|
331
354
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
355
|
+
static visit(node, visitNode) {
|
|
356
|
+
visitNode(node.source);
|
|
357
|
+
node.exported && visitNode(node.exported);
|
|
358
|
+
node.assertions?.forEach(visitNode);
|
|
359
|
+
}
|
|
360
|
+
constructor(source, exported, assertions, range, loc) {
|
|
361
|
+
super(range, loc);
|
|
362
|
+
this.source = source;
|
|
363
|
+
this.exported = exported;
|
|
364
|
+
this.assertions = assertions;
|
|
365
|
+
}
|
|
366
|
+
getSource() {
|
|
367
|
+
return this.source;
|
|
368
|
+
}
|
|
369
|
+
getExported() {
|
|
370
|
+
return this.exported;
|
|
371
|
+
}
|
|
372
|
+
getAssertions() {
|
|
373
|
+
return this.assertions;
|
|
374
|
+
}
|
|
375
|
+
set(stack) {
|
|
376
|
+
throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
|
|
377
|
+
}
|
|
378
|
+
get(stack) {
|
|
379
|
+
let importCallOptions;
|
|
380
|
+
if (this.assertions) {
|
|
381
|
+
const importAssertions = this.assertions
|
|
382
|
+
.map(assertion => assertion.get(stack))
|
|
383
|
+
.reduce((p, c) => Object.assign(p, c), {});
|
|
384
|
+
if (importAssertions) {
|
|
385
|
+
importCallOptions = { assert: importAssertions };
|
|
346
386
|
}
|
|
387
|
+
}
|
|
388
|
+
let localModule = stack.getModule();
|
|
389
|
+
const sourceModule = stack.importModule(this.source.get(), importCallOptions);
|
|
390
|
+
if (this.exported) {
|
|
391
|
+
const exportedName = this.exported.get(stack);
|
|
392
|
+
localModule.set(exportedName, {});
|
|
393
|
+
localModule = localModule.getInnerScope(exportedName);
|
|
394
|
+
}
|
|
395
|
+
const properties = Object.keys(sourceModule.getContext());
|
|
396
|
+
properties.forEach(property => {
|
|
397
|
+
const localValue = sourceModule.get(property);
|
|
398
|
+
localModule.set(property, localValue);
|
|
399
|
+
const scopeSubscription = sourceModule.subscribe(property, (newLocalValue, oldLocalValue) => {
|
|
400
|
+
if (newLocalValue !== oldLocalValue) {
|
|
401
|
+
localModule.set(property, newLocalValue);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
stack.onDestroy(() => scopeSubscription.unsubscribe());
|
|
347
405
|
});
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
};
|
|
368
|
-
ExportAllDeclaration = ExportAllDeclaration_1 = __decorate([
|
|
369
|
-
Deserializer('ExportAllDeclaration'),
|
|
370
|
-
__metadata("design:paramtypes", [Literal,
|
|
371
|
-
Identifier, Array, Array, Object])
|
|
372
|
-
], ExportAllDeclaration);
|
|
406
|
+
}
|
|
407
|
+
dependency(computed) {
|
|
408
|
+
return [];
|
|
409
|
+
}
|
|
410
|
+
dependencyPath(computed) {
|
|
411
|
+
return [];
|
|
412
|
+
}
|
|
413
|
+
toString() {
|
|
414
|
+
return `export *${this.exported ? ` as ${this.exported.toString()}` : ''} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
|
|
415
|
+
}
|
|
416
|
+
toJson() {
|
|
417
|
+
return {
|
|
418
|
+
source: this.source.toJSON(),
|
|
419
|
+
exported: this.exported?.toJSON(),
|
|
420
|
+
assertions: this.assertions?.map(assertion => assertion.toJSON()),
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
return ExportAllDeclaration = _classThis;
|
|
425
|
+
})();
|
|
373
426
|
export { ExportAllDeclaration };
|
|
374
427
|
//# sourceMappingURL=export.js.map
|