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