@ibyar/expressions 0.5.4 → 0.5.6
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/LICENSE +1 -1
- package/README.md +1 -0
- package/api/abstract.d.ts +3 -3
- package/api/abstract.js +2 -2
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +18 -12
- package/api/class/class.js +122 -81
- package/api/class/class.js.map +1 -1
- package/api/computing/debugger.d.ts +15 -0
- package/api/computing/debugger.js +35 -0
- package/api/computing/debugger.js.map +1 -0
- package/api/computing/rest.d.ts +4 -4
- package/api/computing/rest.js.map +1 -1
- package/api/definition/array.d.ts +7 -6
- package/api/definition/array.js +20 -14
- package/api/definition/array.js.map +1 -1
- package/api/definition/function.d.ts +35 -46
- package/api/definition/function.js +281 -299
- package/api/definition/function.js.map +1 -1
- package/api/definition/object.d.ts +9 -6
- package/api/definition/object.js +34 -4
- package/api/definition/object.js.map +1 -1
- package/api/definition/statement.js +5 -1
- package/api/definition/statement.js.map +1 -1
- package/api/definition/values.d.ts +31 -47
- package/api/definition/values.js +59 -145
- package/api/definition/values.js.map +1 -1
- package/api/deserialize/deserialize.d.ts +2 -1
- package/api/deserialize/deserialize.js +4 -1
- package/api/deserialize/deserialize.js.map +1 -1
- package/api/deserialize/type-store.d.ts +2 -2
- package/api/deserialize/type-store.js.map +1 -1
- package/api/expression.d.ts +5 -7
- package/api/expression.js.map +1 -1
- package/api/index.d.ts +2 -0
- package/api/index.js +2 -0
- package/api/index.js.map +1 -1
- package/api/module/common.d.ts +29 -0
- package/api/module/common.js +71 -0
- package/api/module/common.js.map +1 -0
- package/api/module/export.d.ts +15 -9
- package/api/module/export.js +57 -15
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +3 -8
- package/api/module/import.js +9 -19
- package/api/module/import.js.map +1 -1
- package/api/{module/app/program.d.ts → program.d.ts} +4 -4
- package/api/{module/app/program.js → program.js} +3 -3
- package/api/program.js.map +1 -0
- package/api/statement/control/block.d.ts +1 -2
- package/api/statement/control/block.js +20 -21
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/switch.js +8 -3
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +36 -11
- package/api/statement/control/terminate.js +79 -18
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/declarations/declares.d.ts +7 -7
- package/api/statement/declarations/declares.js +1 -1
- package/api/statement/declarations/declares.js.map +1 -1
- package/api/statement/iterations/for.js +22 -16
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.js +15 -11
- package/api/statement/iterations/while.js.map +1 -1
- package/api/utils.d.ts +2 -0
- package/api/utils.js +3 -1
- package/api/utils.js.map +1 -1
- package/package.json +4 -4
- package/scope/proxy.d.ts +0 -2
- package/scope/proxy.js +4 -24
- package/scope/proxy.js.map +1 -1
- package/scope/stack.d.ts +2 -2
- package/scope/stack.js.map +1 -1
- package/v8/enums.d.ts +204 -0
- package/v8/enums.js +375 -0
- package/v8/enums.js.map +1 -0
- package/v8/index.d.ts +2 -1
- package/v8/index.js +2 -1
- package/v8/index.js.map +1 -1
- package/v8/inline.d.ts +177 -0
- package/v8/inline.js +1973 -0
- package/v8/inline.js.map +1 -0
- package/v8/nodes.d.ts +8 -7
- package/v8/nodes.js +37 -63
- package/v8/nodes.js.map +1 -1
- package/v8/parser.d.ts +41 -151
- package/v8/parser.js +507 -1579
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +35 -3
- package/v8/stream.js +616 -164
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +15 -9
- package/v8/token.js +79 -46
- package/v8/token.js.map +1 -1
- package/visit/visitor.js.map +1 -1
- package/api/module/app/program.js.map +0 -1
- package/v8/app.d.ts +0 -0
- package/v8/app.js +0 -2
- package/v8/app.js.map +0 -1
package/api/module/export.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { NodeDeserializer, ExpressionNode, ExpressionEventPath, VisitNodeType,
|
|
1
|
+
import type { NodeDeserializer, ExpressionNode, ExpressionEventPath, VisitNodeType, DeclarationExpression } from '../expression.js';
|
|
2
2
|
import { Scope } from '../../scope/scope.js';
|
|
3
3
|
import { Stack } from '../../scope/stack.js';
|
|
4
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
5
|
-
import { Identifier,
|
|
6
|
-
import { ModuleSpecifier } from './
|
|
5
|
+
import { Identifier, Literal } from '../definition/values.js';
|
|
6
|
+
import { ImportAttribute, ModuleSpecifier } from './common.js';
|
|
7
7
|
import { FunctionDeclaration } from '../definition/function.js';
|
|
8
8
|
import { ClassDeclaration } from '../class/class.js';
|
|
9
9
|
export declare class ExportSpecifier extends ModuleSpecifier {
|
|
@@ -22,14 +22,16 @@ export declare class ExportSpecifier extends ModuleSpecifier {
|
|
|
22
22
|
}
|
|
23
23
|
export declare class ExportNamedDeclaration extends AbstractExpressionNode {
|
|
24
24
|
private specifiers;
|
|
25
|
-
private source?;
|
|
26
25
|
private declaration?;
|
|
26
|
+
private source?;
|
|
27
|
+
private assertions?;
|
|
27
28
|
static fromJSON(node: ExportNamedDeclaration, deserializer: NodeDeserializer): ExportNamedDeclaration;
|
|
28
29
|
static visit(node: ExportNamedDeclaration, visitNode: VisitNodeType): void;
|
|
29
|
-
constructor(specifiers: ExportSpecifier[], source?:
|
|
30
|
-
getSource():
|
|
30
|
+
constructor(specifiers: ExportSpecifier[], declaration?: DeclarationExpression | undefined, source?: Literal<string> | undefined, assertions?: ImportAttribute[] | undefined);
|
|
31
|
+
getSource(): Literal<string> | undefined;
|
|
31
32
|
getSpecifiers(): ExportSpecifier[];
|
|
32
|
-
getDeclaration():
|
|
33
|
+
getDeclaration(): DeclarationExpression | undefined;
|
|
34
|
+
getAssertions(): ImportAttribute[] | undefined;
|
|
33
35
|
shareVariables(scopeList: Scope<any>[]): void;
|
|
34
36
|
set(stack: Stack): void;
|
|
35
37
|
get(stack: Stack): void;
|
|
@@ -57,10 +59,14 @@ export declare class ExportDefaultDeclaration extends AbstractExpressionNode {
|
|
|
57
59
|
}
|
|
58
60
|
export declare class ExportAllDeclaration extends AbstractExpressionNode {
|
|
59
61
|
private source;
|
|
62
|
+
private exported?;
|
|
63
|
+
private assertions?;
|
|
60
64
|
static fromJSON(node: ExportAllDeclaration, deserializer: NodeDeserializer): ExportAllDeclaration;
|
|
61
65
|
static visit(node: ExportAllDeclaration, visitNode: VisitNodeType): void;
|
|
62
|
-
constructor(source:
|
|
63
|
-
getSource():
|
|
66
|
+
constructor(source: Literal<string>, exported?: Identifier | undefined, assertions?: ImportAttribute[] | undefined);
|
|
67
|
+
getSource(): Literal<string>;
|
|
68
|
+
getExported(): Identifier | undefined;
|
|
69
|
+
getAssertions(): ImportAttribute[] | undefined;
|
|
64
70
|
shareVariables(scopeList: Scope<any>[]): void;
|
|
65
71
|
set(stack: Stack): void;
|
|
66
72
|
get(stack: Stack): void;
|
package/api/module/export.js
CHANGED
|
@@ -3,8 +3,8 @@ import { __decorate, __metadata } from "tslib";
|
|
|
3
3
|
import { ReactiveScope } from '../../scope/scope.js';
|
|
4
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
5
5
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
6
|
-
import { Identifier,
|
|
7
|
-
import { ModuleSpecifier } from './
|
|
6
|
+
import { Identifier, Literal } from '../definition/values.js';
|
|
7
|
+
import { ModuleSpecifier } from './common.js';
|
|
8
8
|
let ExportSpecifier = ExportSpecifier_1 = class ExportSpecifier extends ModuleSpecifier {
|
|
9
9
|
constructor(local, exported) {
|
|
10
10
|
super(local);
|
|
@@ -55,19 +55,21 @@ ExportSpecifier = ExportSpecifier_1 = __decorate([
|
|
|
55
55
|
], ExportSpecifier);
|
|
56
56
|
export { ExportSpecifier };
|
|
57
57
|
let ExportNamedDeclaration = ExportNamedDeclaration_1 = class ExportNamedDeclaration extends AbstractExpressionNode {
|
|
58
|
-
constructor(specifiers, source,
|
|
58
|
+
constructor(specifiers, declaration, source, assertions) {
|
|
59
59
|
super();
|
|
60
60
|
this.specifiers = specifiers;
|
|
61
|
-
this.source = source;
|
|
62
61
|
this.declaration = declaration;
|
|
62
|
+
this.source = source;
|
|
63
|
+
this.assertions = assertions;
|
|
63
64
|
}
|
|
64
65
|
static fromJSON(node, deserializer) {
|
|
65
|
-
return new ExportNamedDeclaration_1(node.specifiers.map(deserializer), node.
|
|
66
|
+
return new ExportNamedDeclaration_1(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);
|
|
66
67
|
}
|
|
67
68
|
static visit(node, visitNode) {
|
|
68
69
|
node.specifiers.map(visitNode);
|
|
69
70
|
node.source && visitNode(node.source);
|
|
70
71
|
node.declaration && visitNode(node.declaration);
|
|
72
|
+
node.assertions?.forEach(visitNode);
|
|
71
73
|
}
|
|
72
74
|
getSource() {
|
|
73
75
|
return this.source;
|
|
@@ -78,6 +80,9 @@ let ExportNamedDeclaration = ExportNamedDeclaration_1 = class ExportNamedDeclara
|
|
|
78
80
|
getDeclaration() {
|
|
79
81
|
return this.declaration;
|
|
80
82
|
}
|
|
83
|
+
getAssertions() {
|
|
84
|
+
return this.assertions;
|
|
85
|
+
}
|
|
81
86
|
shareVariables(scopeList) { }
|
|
82
87
|
set(stack) {
|
|
83
88
|
throw new Error(`ExportNamedDeclaration.#set() has no implementation.`);
|
|
@@ -108,7 +113,16 @@ let ExportNamedDeclaration = ExportNamedDeclaration_1 = class ExportNamedDeclara
|
|
|
108
113
|
if (!this.source) {
|
|
109
114
|
return;
|
|
110
115
|
}
|
|
111
|
-
|
|
116
|
+
let importCallOptions;
|
|
117
|
+
if (this.assertions) {
|
|
118
|
+
const importAssertions = this.assertions
|
|
119
|
+
.map(assertion => assertion.get(stack))
|
|
120
|
+
.reduce((p, c) => Object.assign(p, c), {});
|
|
121
|
+
if (importAssertions) {
|
|
122
|
+
importCallOptions = { assert: importAssertions };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const sourceModule = stack.importModule(this.source.get(), importCallOptions);
|
|
112
126
|
const localModule = stack.getModule();
|
|
113
127
|
this.specifiers.forEach(specifier => {
|
|
114
128
|
const localName = specifier.getLocal().get(stack);
|
|
@@ -123,7 +137,7 @@ let ExportNamedDeclaration = ExportNamedDeclaration_1 = class ExportNamedDeclara
|
|
|
123
137
|
stack.onDestroy(() => scopeSubscription.unsubscribe());
|
|
124
138
|
});
|
|
125
139
|
}
|
|
126
|
-
exportLocal(stack) {
|
|
140
|
+
exportLocal(stack, importCallOptions) {
|
|
127
141
|
const localModule = stack.getModule();
|
|
128
142
|
this.specifiers.forEach(specifier => {
|
|
129
143
|
const localName = specifier.getLocal().get(stack);
|
|
@@ -158,19 +172,20 @@ let ExportNamedDeclaration = ExportNamedDeclaration_1 = class ExportNamedDeclara
|
|
|
158
172
|
return `${exportStr};`;
|
|
159
173
|
}
|
|
160
174
|
const source = this.source.toString();
|
|
161
|
-
return `${exportStr} from ${source};`;
|
|
175
|
+
return `${exportStr} from ${source}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
|
|
162
176
|
}
|
|
163
177
|
toJson() {
|
|
164
178
|
return {
|
|
165
179
|
specifiers: this.specifiers.map(specifier => specifier.toJSON()),
|
|
166
180
|
source: this.source?.toJSON(),
|
|
167
181
|
declaration: this.declaration?.toJSON(),
|
|
182
|
+
assertions: this.assertions?.map(assertion => assertion.toJSON()),
|
|
168
183
|
};
|
|
169
184
|
}
|
|
170
185
|
};
|
|
171
186
|
ExportNamedDeclaration = ExportNamedDeclaration_1 = __decorate([
|
|
172
187
|
Deserializer('ExportNamedDeclaration'),
|
|
173
|
-
__metadata("design:paramtypes", [Array,
|
|
188
|
+
__metadata("design:paramtypes", [Array, Object, Literal, Array])
|
|
174
189
|
], ExportNamedDeclaration);
|
|
175
190
|
export { ExportNamedDeclaration };
|
|
176
191
|
let ExportDefaultDeclaration = ExportDefaultDeclaration_1 = class ExportDefaultDeclaration extends AbstractExpressionNode {
|
|
@@ -217,26 +232,50 @@ ExportDefaultDeclaration = ExportDefaultDeclaration_1 = __decorate([
|
|
|
217
232
|
], ExportDefaultDeclaration);
|
|
218
233
|
export { ExportDefaultDeclaration };
|
|
219
234
|
let ExportAllDeclaration = ExportAllDeclaration_1 = class ExportAllDeclaration extends AbstractExpressionNode {
|
|
220
|
-
constructor(source) {
|
|
235
|
+
constructor(source, exported, assertions) {
|
|
221
236
|
super();
|
|
222
237
|
this.source = source;
|
|
238
|
+
this.exported = exported;
|
|
239
|
+
this.assertions = assertions;
|
|
223
240
|
}
|
|
224
241
|
static fromJSON(node, deserializer) {
|
|
225
|
-
return new ExportAllDeclaration_1(deserializer(node.source));
|
|
242
|
+
return new ExportAllDeclaration_1(deserializer(node.source), node.exported ? deserializer(node.exported) : void 0, node.assertions?.map(deserializer));
|
|
226
243
|
}
|
|
227
244
|
static visit(node, visitNode) {
|
|
228
245
|
visitNode(node.source);
|
|
246
|
+
node.exported && visitNode(node.exported);
|
|
247
|
+
node.assertions?.forEach(visitNode);
|
|
229
248
|
}
|
|
230
249
|
getSource() {
|
|
231
250
|
return this.source;
|
|
232
251
|
}
|
|
252
|
+
getExported() {
|
|
253
|
+
return this.exported;
|
|
254
|
+
}
|
|
255
|
+
getAssertions() {
|
|
256
|
+
return this.assertions;
|
|
257
|
+
}
|
|
233
258
|
shareVariables(scopeList) { }
|
|
234
259
|
set(stack) {
|
|
235
260
|
throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
|
|
236
261
|
}
|
|
237
262
|
get(stack) {
|
|
238
|
-
|
|
239
|
-
|
|
263
|
+
let importCallOptions;
|
|
264
|
+
if (this.assertions) {
|
|
265
|
+
const importAssertions = this.assertions
|
|
266
|
+
.map(assertion => assertion.get(stack))
|
|
267
|
+
.reduce((p, c) => Object.assign(p, c), {});
|
|
268
|
+
if (importAssertions) {
|
|
269
|
+
importCallOptions = { assert: importAssertions };
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
let localModule = stack.getModule();
|
|
273
|
+
const sourceModule = stack.importModule(this.source.get(), importCallOptions);
|
|
274
|
+
if (this.exported) {
|
|
275
|
+
const exportedName = this.exported.get(stack);
|
|
276
|
+
localModule.set(exportedName, {});
|
|
277
|
+
localModule = localModule.getScope(exportedName);
|
|
278
|
+
}
|
|
240
279
|
const properties = Object.keys(sourceModule.getContext());
|
|
241
280
|
properties.forEach(property => {
|
|
242
281
|
const localValue = sourceModule.get(property);
|
|
@@ -256,17 +295,20 @@ let ExportAllDeclaration = ExportAllDeclaration_1 = class ExportAllDeclaration e
|
|
|
256
295
|
return [];
|
|
257
296
|
}
|
|
258
297
|
toString() {
|
|
259
|
-
return `export
|
|
298
|
+
return `export *${this.exported ? ` as ${this.exported.toString()}` : ''} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
|
|
260
299
|
}
|
|
261
300
|
toJson() {
|
|
262
301
|
return {
|
|
263
302
|
source: this.source.toJSON(),
|
|
303
|
+
exported: this.exported?.toJSON(),
|
|
304
|
+
assertions: this.assertions?.map(assertion => assertion.toJSON()),
|
|
264
305
|
};
|
|
265
306
|
}
|
|
266
307
|
};
|
|
267
308
|
ExportAllDeclaration = ExportAllDeclaration_1 = __decorate([
|
|
268
309
|
Deserializer('ExportAllDeclaration'),
|
|
269
|
-
__metadata("design:paramtypes", [
|
|
310
|
+
__metadata("design:paramtypes", [Literal,
|
|
311
|
+
Identifier, Array])
|
|
270
312
|
], ExportAllDeclaration);
|
|
271
313
|
export { ExportAllDeclaration };
|
|
272
314
|
//# sourceMappingURL=export.js.map
|
package/api/module/export.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../src/expressions/api/module/export.ts"],"names":[],"mappings":";;AAuCA,OAAO,EAAiB,aAAa,EAAS,MAAM,sBAAsB,CAAC;AAE3E,OA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YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAC9C,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACtC,MAAM,iBAAiB,GAAG,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,EAAE;gBAC3F,IAAI,aAAa,KAAK,aAAa,EAAE;oBACpC,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;iBACzC;YACF,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACJ,CAAC;IACD,UAAU,CAAC,QAAe;QACzB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,cAAc,CAAC,QAAe;QAC7B,OAAO,EAAE,CAAC;IACX,CAAC;IACD,QAAQ;QACP,OAAO,iBAAiB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;IAClD,CAAC;IACD,MAAM;QACL,OAAO;YACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;SAC5B,CAAC;IACH,CAAC;CACD,CAAA;AAjDY,oBAAoB;IADhC,YAAY,CAAC,sBAAsB,CAAC;qCASnB,aAAa;GARlB,oBAAoB,CAiDhC;SAjDY,oBAAoB","sourcesContent":["\n/**\n * There are two types of exports:\n * 1- Named Exports (Zero or more exports per module)\n * 2- Default Exports (One per module)\n * \n * // Exporting individual features\n * export let name1, name2, …, nameN; // also var, const\n * export let name1 = …, name2 = …, …, nameN; // also var, const\n * export function functionName(){...}\n * export class ClassName {...}\n * \n * // Export list\n * export { name1, name2, …, nameN };\n * \n * // Renaming exports\n * export { variable1 as name1, variable2 as name2, …, nameN };\n * \n * // Exporting destructed assignments with renaming\n * export const { name1, name2: bar } = o;\n * \n * // Default exports\n * export default expression;\n * export default function (…) { … } // also class, function*\n * export default function name1(…) { … } // also class, function*\n * export { name1 as default, … };\n * \n * // Aggregating modules\n * export * from …; // does not set the default export\n * export * as name1 from …; // Draft ECMAScript® 2O21\n * export { name1, name2, …, nameN } from …;\n * export { import1 as name1, import2 as name2, …, nameN } from …;\n * export { default, … } from …;\n */\n\nimport type {\n\tNodeDeserializer, ExpressionNode,\n\tExpressionEventPath, VisitNodeType, CanDeclareExpression\n} from '../expression.js';\nimport { ModuleContext, ReactiveScope, Scope } from '../../scope/scope.js';\nimport { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { Identifier, StringLiteral } from '../definition/values.js';\nimport { ModuleSpecifier } from './import.js';\nimport { FunctionDeclaration } from '../definition/function.js';\nimport { ClassDeclaration } from '../class/class.js';\n\n\n/**\n * An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` in `export {bar as foo}`.\n * \n * The `exported` field refers to the name exported in the module.\n * \n * The `local` field refers to the binding into the local module scope.\n * \n * If it is a basic named export, such as in `export {foo}`, both `exported` and `local` are equivalent `Identifier` nodes;\n * in this case an Identifier node representing `foo`.\n * \n * If it is an aliased export,\n * such as in `export {bar as foo}`, the `exported` field is an `Identifier` node representing `foo`,\n * and the `local` field is an `Identifier` node representing `bar`.\n */\n@Deserializer('ExportSpecifier')\nexport class ExportSpecifier extends ModuleSpecifier {\n\tstatic fromJSON(node: ExportSpecifier, deserializer: NodeDeserializer): ExportSpecifier {\n\t\treturn new ExportSpecifier(\n\t\t\tdeserializer(node.local) as Identifier,\n\t\t\tdeserializer(node.exported) as Identifier\n\t\t);\n\t}\n\tstatic visit(node: ExportSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\n\t\tvisitNode(node.exported);\n\t}\n\tconstructor(local: Identifier, private exported: Identifier) {\n\t\tsuper(local);\n\t}\n\tgetExported() {\n\t\treturn this.exported;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\tconst local = this.local.toString();\n\t\tconst exported = this.exported.toString();\n\t\tif (local == exported) {\n\t\t\treturn local;\n\t\t}\n\t\treturn `${local} as ${exported}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tlocal: this.local.toJSON(),\n\t\t\texported: this.exported.toJSON()\n\t\t};\n\t}\n}\n\n\n/**\n * An export named declaration, e.g.,\n * `export {foo, bar};`,\n * `export {foo} from \"mod\";`\n * or `export var foo = 1;`.\n * \n * Note: Having `declaration` populated with non-empty `specifiers` or non-null `source` results in an invalid state.\n */\n@Deserializer('ExportNamedDeclaration')\nexport class ExportNamedDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportNamedDeclaration, deserializer: NodeDeserializer): ExportNamedDeclaration {\n\t\treturn new ExportNamedDeclaration(\n\t\t\tnode.specifiers.map(deserializer) as ExportSpecifier[],\n\t\t\tnode.source ? deserializer(node.source) as StringLiteral : void 0,\n\t\t\tnode.declaration ? deserializer(node.declaration) as CanDeclareExpression : void 0,\n\t\t);\n\t}\n\tstatic visit(node: ExportNamedDeclaration, visitNode: VisitNodeType): void {\n\t\tnode.specifiers.map(visitNode);\n\t\tnode.source && visitNode(node.source);\n\t\tnode.declaration && visitNode(node.declaration);\n\t}\n\tconstructor(\n\t\tprivate specifiers: ExportSpecifier[],\n\t\tprivate source?: StringLiteral,\n\t\tprivate declaration?: CanDeclareExpression) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tgetSpecifiers() {\n\t\treturn this.specifiers;\n\t}\n\tgetDeclaration() {\n\t\treturn this.declaration;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportNamedDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tif (this.declaration) {\n\t\t\tthis.exportDeclaration(stack);\n\t\t}\n\t\telse if (this.source) {\n\t\t\tthis.exportFromSource(stack);\n\t\t} else {\n\t\t\tthis.exportLocal(stack);\n\t\t}\n\t}\n\n\tprivate exportDeclaration(stack: Stack) {\n\t\tif (!this.declaration) {\n\t\t\treturn\n\t\t}\n\t\tconst declaration = this.declaration.get(stack);\n\t\tconst declaredName = this.declaration.getDeclarationName!();\n\t\tif (!declaredName) {\n\t\t\tthrow new Error(`Name is not defined for ${declaration.toString()}`);\n\t\t}\n\t\tstack.getModule()!.set(declaredName, declaration);\n\t}\n\tprivate exportFromSource(stack: Stack) {\n\t\tif (!this.source) {\n\t\t\treturn;\n\t\t}\n\t\tconst sourceModule = stack.importModule(this.source.get());\n\t\tconst localModule = stack.getModule()!;\n\t\tthis.specifiers.forEach(specifier => {\n\t\t\tconst localName = specifier.getLocal().get(stack);\n\t\t\tconst exportedName = specifier.getExported().get(stack);\n\t\t\tconst localValue = sourceModule.get(localName);\n\t\t\tlocalModule.set(exportedName, localValue);\n\t\t\tconst scopeSubscription = sourceModule.subscribe(localName, (newLocalValue, oldLocalValue) => {\n\t\t\t\tif (newLocalValue !== oldLocalValue) {\n\t\t\t\t\tlocalModule.set(exportedName, newLocalValue);\n\t\t\t\t}\n\t\t\t});\n\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t});\n\t}\n\tprivate exportLocal(stack: Stack) {\n\t\tconst localModule = stack.getModule()!;\n\t\tthis.specifiers.forEach(specifier => {\n\t\t\tconst localName = specifier.getLocal().get(stack);\n\t\t\tconst exportedName = specifier.getExported().get(stack);\n\t\t\tconst localValue = stack.get(localName);\n\t\t\tlocalModule.set(exportedName, localValue);\n\t\t\tconst scope = stack.findScope(localName);\n\t\t\tif (scope instanceof ReactiveScope) {\n\t\t\t\tconst scopeSubscription = scope.subscribe(localName, (newLocalValue, oldLocalValue) => {\n\t\t\t\t\tif (newLocalValue !== oldLocalValue) {\n\t\t\t\t\t\tlocalModule.set(exportedName, newLocalValue);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t\t}\n\t\t});\n\t}\n\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\tif (this.declaration) {\n\t\t\tconst declaration = this.declaration.toString();\n\t\t\treturn `export ${declaration}`;\n\t\t}\n\t\tconst specifiers = this.specifiers.map(specifier => specifier.toString()).join(',');\n\t\tlet exportStr = `export {${specifiers}}`;\n\t\tif (!this.source) {\n\t\t\treturn `${exportStr};`;\n\t\t}\n\t\tconst source = this.source.toString();\n\t\treturn `${exportStr} from ${source};`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tspecifiers: this.specifiers.map(specifier => specifier.toJSON()),\n\t\t\tsource: this.source?.toJSON(),\n\t\t\tdeclaration: this.declaration?.toJSON(),\n\t\t};\n\t}\n}\n\n\n/**\n * An export default declaration, e.g., \n * `export default function () {};`\n * or `export default 1;`.\n */\n@Deserializer('ExportDefaultDeclaration')\nexport class ExportDefaultDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportDefaultDeclaration, deserializer: NodeDeserializer): ExportDefaultDeclaration {\n\t\treturn new ExportDefaultDeclaration(deserializer(node.declaration));\n\t}\n\tstatic visit(node: ExportDefaultDeclaration, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.declaration);\n\t}\n\tconstructor(\n\t\tprivate declaration: FunctionDeclaration | ClassDeclaration | ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetDeclaration() {\n\t\treturn this.declaration;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportDefaultDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst declaration = this.declaration.get(stack);\n\t\tstack.getModule()!.set('default', declaration);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\tconst declaration = this.declaration.toString();\n\t\treturn `export default ${declaration}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tdeclaration: this.declaration.toJSON(),\n\t\t};\n\t}\n}\n\n/**\n * An export batch declaration, e.g., `export * from \"mod\";`.\n */\n@Deserializer('ExportAllDeclaration')\nexport class ExportAllDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportAllDeclaration, deserializer: NodeDeserializer): ExportAllDeclaration {\n\t\treturn new ExportAllDeclaration(deserializer(node.source) as StringLiteral);\n\t}\n\tstatic visit(node: ExportAllDeclaration, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.source);\n\t}\n\tconstructor(\n\t\tprivate source: StringLiteral) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportDefaultDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst localModule = stack.getModule()!;\n\t\tconst sourceModule = stack.importModule(this.source.get());\n\t\tconst properties = Object.keys(sourceModule.getContext()) as (keyof ModuleContext)[];\n\n\t\tproperties.forEach(property => {\n\n\t\t\tconst localValue = sourceModule.get(property);\n\t\t\tlocalModule.set(property, localValue);\n\t\t\tconst scopeSubscription = sourceModule.subscribe(property, (newLocalValue, oldLocalValue) => {\n\t\t\t\tif (newLocalValue !== oldLocalValue) {\n\t\t\t\t\tlocalModule.set(property, newLocalValue);\n\t\t\t\t}\n\t\t\t});\n\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t});\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\treturn `export * from ${this.source.toString()}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tsource: this.source.toJSON(),\n\t\t};\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../src/expressions/api/module/export.ts"],"names":[],"mappings":";;AAuCA,OAAO,EAAiB,aAAa,EAAS,MAAM,sBAAsB,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAmB,eAAe,EAAE,MAAM,aAAa,CAAC;AAoB/D,IAAa,eAAe,uBAA5B,MAAa,eAAgB,SAAQ,eAAe;IAWnD,YAAY,KAAiB,EAAU,QAAoB;QAC1D,KAAK,CAAC,KAAK,CAAC,CAAC;QADyB,aAAQ,GAAR,QAAQ,CAAY;IAE3D,CAAC;IAZD,MAAM,CAAC,QAAQ,CAAC,IAAqB,EAAE,YAA8B;QACpE,OAAO,IAAI,iBAAe,CACzB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAe,EACtC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAe,CACzC,CAAC;IACH,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,IAAqB,EAAE,SAAwB;QAC3D,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IAID,WAAW;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IACD,cAAc,CAAC,SAAuB;IAEtC,CAAC;IACD,GAAG,CAAC,KAAY,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AQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE;YACjC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;SACjE,CAAC;IACH,CAAC;CACD,CAAA;AAhFY,oBAAoB;IADhC,YAAY,CAAC,sBAAsB,CAAC;qCAenB,OAAO;QACJ,UAAU;GAflB,oBAAoB,CAgFhC;SAhFY,oBAAoB","sourcesContent":["\n/**\n * There are two types of exports:\n * 1- Named Exports (Zero or more exports per module)\n * 2- Default Exports (One per module)\n * \n * // Exporting individual features\n * export let name1, name2, …, nameN; // also var, const\n * export let name1 = …, name2 = …, …, nameN; // also var, const\n * export function functionName(){...}\n * export class ClassName {...}\n * \n * // Export list\n * export { name1, name2, …, nameN };\n * \n * // Renaming exports\n * export { variable1 as name1, variable2 as name2, …, nameN };\n * \n * // Exporting destructed assignments with renaming\n * export const { name1, name2: bar } = o;\n * \n * // Default exports\n * export default expression;\n * export default function (…) { … } // also class, function*\n * export default function name1(…) { … } // also class, function*\n * export { name1 as default, … };\n * \n * // Aggregating modules\n * export * from …; // does not set the default export\n * export * as name1 from …; // Draft ECMAScript® 2O21\n * export { name1, name2, …, nameN } from …;\n * export { import1 as name1, import2 as name2, …, nameN } from …;\n * export { default, … } from …;\n */\n\nimport type {\n\tNodeDeserializer, ExpressionNode,\n\tExpressionEventPath, VisitNodeType, DeclarationExpression\n} from '../expression.js';\nimport { ModuleContext, ReactiveScope, Scope } from '../../scope/scope.js';\nimport { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { Identifier, Literal } from '../definition/values.js';\nimport { ImportAttribute, ModuleSpecifier } from './common.js';\nimport { FunctionDeclaration } from '../definition/function.js';\nimport { ClassDeclaration } from '../class/class.js';\n\n\n/**\n * An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` in `export {bar as foo}`.\n * \n * The `exported` field refers to the name exported in the module.\n * \n * The `local` field refers to the binding into the local module scope.\n * \n * If it is a basic named export, such as in `export {foo}`, both `exported` and `local` are equivalent `Identifier` nodes;\n * in this case an Identifier node representing `foo`.\n * \n * If it is an aliased export,\n * such as in `export {bar as foo}`, the `exported` field is an `Identifier` node representing `foo`,\n * and the `local` field is an `Identifier` node representing `bar`.\n */\n@Deserializer('ExportSpecifier')\nexport class ExportSpecifier extends ModuleSpecifier {\n\tstatic fromJSON(node: ExportSpecifier, deserializer: NodeDeserializer): ExportSpecifier {\n\t\treturn new ExportSpecifier(\n\t\t\tdeserializer(node.local) as Identifier,\n\t\t\tdeserializer(node.exported) as Identifier\n\t\t);\n\t}\n\tstatic visit(node: ExportSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\n\t\tvisitNode(node.exported);\n\t}\n\tconstructor(local: Identifier, private exported: Identifier) {\n\t\tsuper(local);\n\t}\n\tgetExported() {\n\t\treturn this.exported;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\tconst local = this.local.toString();\n\t\tconst exported = this.exported.toString();\n\t\tif (local == exported) {\n\t\t\treturn local;\n\t\t}\n\t\treturn `${local} as ${exported}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tlocal: this.local.toJSON(),\n\t\t\texported: this.exported.toJSON()\n\t\t};\n\t}\n}\n\n\n/**\n * An export named declaration, e.g.,\n * `export {foo, bar};`,\n * `export {foo} from \"mod\";`\n * or `export var foo = 1;`.\n * \n * Note: Having `declaration` populated with non-empty `specifiers` or non-null `source` results in an invalid state.\n */\n@Deserializer('ExportNamedDeclaration')\nexport class ExportNamedDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportNamedDeclaration, deserializer: NodeDeserializer): ExportNamedDeclaration {\n\t\treturn new ExportNamedDeclaration(\n\t\t\tnode.specifiers.map(deserializer) as ExportSpecifier[],\n\t\t\tnode.declaration ? deserializer(node.declaration) as DeclarationExpression : void 0,\n\t\t\tnode.source ? deserializer(node.source) as Literal<string> : void 0,\n\t\t\tnode.assertions ? node.assertions.map(deserializer) as ImportAttribute[] : void 0,\n\t\t);\n\t}\n\tstatic visit(node: ExportNamedDeclaration, visitNode: VisitNodeType): void {\n\t\tnode.specifiers.map(visitNode);\n\t\tnode.source && visitNode(node.source);\n\t\tnode.declaration && visitNode(node.declaration);\n\t\tnode.assertions?.forEach(visitNode);\n\t}\n\tconstructor(\n\t\tprivate specifiers: ExportSpecifier[],\n\t\tprivate declaration?: DeclarationExpression,\n\t\tprivate source?: Literal<string>,\n\t\tprivate assertions?: ImportAttribute[],) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tgetSpecifiers() {\n\t\treturn this.specifiers;\n\t}\n\tgetDeclaration() {\n\t\treturn this.declaration;\n\t}\n\tgetAssertions() {\n\t\treturn this.assertions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportNamedDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tif (this.declaration) {\n\t\t\tthis.exportDeclaration(stack);\n\t\t}\n\t\telse if (this.source) {\n\t\t\tthis.exportFromSource(stack);\n\t\t} else {\n\t\t\tthis.exportLocal(stack);\n\t\t}\n\t}\n\n\tprivate exportDeclaration(stack: Stack) {\n\t\tif (!this.declaration) {\n\t\t\treturn\n\t\t}\n\t\tconst declaration = this.declaration.get(stack);\n\t\tconst declaredName = this.declaration.getDeclarationName!();\n\t\tif (!declaredName) {\n\t\t\tthrow new Error(`Name is not defined for ${declaration.toString()}`);\n\t\t}\n\t\tstack.getModule()!.set(declaredName, declaration);\n\t}\n\tprivate exportFromSource(stack: Stack) {\n\t\tif (!this.source) {\n\t\t\treturn;\n\t\t}\n\t\tlet importCallOptions: ImportCallOptions | undefined;\n\t\tif (this.assertions) {\n\t\t\tconst importAssertions: ImportAssertions = this.assertions\n\t\t\t\t.map(assertion => assertion.get(stack))\n\t\t\t\t.reduce((p, c) => Object.assign(p, c), {});\n\t\t\tif (importAssertions) {\n\t\t\t\timportCallOptions = { assert: importAssertions };\n\t\t\t}\n\t\t}\n\t\tconst sourceModule = stack.importModule(this.source.get(), importCallOptions);\n\t\tconst localModule = stack.getModule()!;\n\t\tthis.specifiers.forEach(specifier => {\n\t\t\tconst localName = specifier.getLocal().get(stack);\n\t\t\tconst exportedName = specifier.getExported().get(stack);\n\t\t\tconst localValue = sourceModule.get(localName);\n\t\t\tlocalModule.set(exportedName, localValue);\n\t\t\tconst scopeSubscription = sourceModule.subscribe(localName, (newLocalValue, oldLocalValue) => {\n\t\t\t\tif (newLocalValue !== oldLocalValue) {\n\t\t\t\t\tlocalModule.set(exportedName, newLocalValue);\n\t\t\t\t}\n\t\t\t});\n\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t});\n\t}\n\tprivate exportLocal(stack: Stack, importCallOptions?: ImportCallOptions) {\n\t\tconst localModule = stack.getModule()!;\n\t\tthis.specifiers.forEach(specifier => {\n\t\t\tconst localName = specifier.getLocal().get(stack);\n\t\t\tconst exportedName = specifier.getExported().get(stack);\n\t\t\tconst localValue = stack.get(localName);\n\t\t\tlocalModule.set(exportedName, localValue);\n\t\t\tconst scope = stack.findScope(localName);\n\t\t\tif (scope instanceof ReactiveScope) {\n\t\t\t\tconst scopeSubscription = scope.subscribe(localName, (newLocalValue, oldLocalValue) => {\n\t\t\t\t\tif (newLocalValue !== oldLocalValue) {\n\t\t\t\t\t\tlocalModule.set(exportedName, newLocalValue);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t\t}\n\t\t});\n\t}\n\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\tif (this.declaration) {\n\t\t\tconst declaration = this.declaration.toString();\n\t\t\treturn `export ${declaration}`;\n\t\t}\n\t\tconst specifiers = this.specifiers.map(specifier => specifier.toString()).join(',');\n\t\tlet exportStr = `export {${specifiers}}`;\n\t\tif (!this.source) {\n\t\t\treturn `${exportStr};`;\n\t\t}\n\t\tconst source = this.source.toString();\n\t\treturn `${exportStr} from ${source}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tspecifiers: this.specifiers.map(specifier => specifier.toJSON()),\n\t\t\tsource: this.source?.toJSON(),\n\t\t\tdeclaration: this.declaration?.toJSON(),\n\t\t\tassertions: this.assertions?.map(assertion => assertion.toJSON()),\n\t\t};\n\t}\n}\n\n\n/**\n * An export default declaration, e.g., \n * `export default function () {};`\n * or `export default 1;`.\n */\n@Deserializer('ExportDefaultDeclaration')\nexport class ExportDefaultDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportDefaultDeclaration, deserializer: NodeDeserializer): ExportDefaultDeclaration {\n\t\treturn new ExportDefaultDeclaration(deserializer(node.declaration));\n\t}\n\tstatic visit(node: ExportDefaultDeclaration, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.declaration);\n\t}\n\tconstructor(\n\t\tprivate declaration: FunctionDeclaration | ClassDeclaration | ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetDeclaration() {\n\t\treturn this.declaration;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportDefaultDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst declaration = this.declaration.get(stack);\n\t\tstack.getModule()!.set('default', declaration);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\tconst declaration = this.declaration.toString();\n\t\treturn `export default ${declaration}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tdeclaration: this.declaration.toJSON(),\n\t\t};\n\t}\n}\n\n/**\n * An export batch declaration, e.g., `export * from \"mod\";`.\n */\n@Deserializer('ExportAllDeclaration')\nexport class ExportAllDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ExportAllDeclaration, deserializer: NodeDeserializer): ExportAllDeclaration {\n\t\treturn new ExportAllDeclaration(\n\t\t\tdeserializer(node.source) as Literal<string>,\n\t\t\tnode.exported ? deserializer(node.exported) as Identifier : void 0,\n\t\t\tnode.assertions?.map(deserializer) as ImportAttribute[],\n\t\t);\n\t}\n\tstatic visit(node: ExportAllDeclaration, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.source);\n\t\tnode.exported && visitNode(node.exported);\n\t\tnode.assertions?.forEach(visitNode);\n\t}\n\tconstructor(\n\t\tprivate source: Literal<string>,\n\t\tprivate exported?: Identifier,\n\t\tprivate assertions?: ImportAttribute[],) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tgetExported() {\n\t\treturn this.exported;\n\t}\n\tgetAssertions() {\n\t\treturn this.assertions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ExportDefaultDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tlet importCallOptions: ImportCallOptions | undefined;\n\t\tif (this.assertions) {\n\t\t\tconst importAssertions: ImportAssertions = this.assertions\n\t\t\t\t.map(assertion => assertion.get(stack))\n\t\t\t\t.reduce((p, c) => Object.assign(p, c), {});\n\t\t\tif (importAssertions) {\n\t\t\t\timportCallOptions = { assert: importAssertions };\n\t\t\t}\n\t\t}\n\t\tlet localModule: ReactiveScope<ModuleContext> = stack.getModule()!;\n\t\tconst sourceModule = stack.importModule(this.source.get(), importCallOptions);\n\n\t\tif (this.exported) {\n\t\t\tconst exportedName = this.exported.get(stack);\n\t\t\tlocalModule.set(exportedName, {});\n\t\t\tlocalModule = localModule.getScope(exportedName)!;\n\t\t}\n\n\t\tconst properties = Object.keys(sourceModule.getContext()) as (keyof ModuleContext)[];\n\t\tproperties.forEach(property => {\n\n\t\t\tconst localValue = sourceModule.get(property);\n\t\t\tlocalModule.set(property, localValue);\n\t\t\tconst scopeSubscription = sourceModule.subscribe(property, (newLocalValue, oldLocalValue) => {\n\t\t\t\tif (newLocalValue !== oldLocalValue) {\n\t\t\t\t\tlocalModule.set(property, newLocalValue);\n\t\t\t\t}\n\t\t\t});\n\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t});\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString() {\n\t\treturn `export *${this.exported ? ` as ${this.exported.toString()}` : ''} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tsource: this.source.toJSON(),\n\t\t\texported: this.exported?.toJSON(),\n\t\t\tassertions: this.assertions?.map(assertion => assertion.toJSON()),\n\t\t};\n\t}\n}\n"]}
|
package/api/module/import.d.ts
CHANGED
|
@@ -3,12 +3,7 @@ import type { ModuleScope, Scope } from '../../scope/scope.js';
|
|
|
3
3
|
import type { Stack } from '../../scope/stack.js';
|
|
4
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
5
5
|
import { Identifier, Literal } from '../definition/values.js';
|
|
6
|
-
|
|
7
|
-
protected local: Identifier;
|
|
8
|
-
constructor(local: Identifier);
|
|
9
|
-
getLocal(): Identifier;
|
|
10
|
-
toJson(): object;
|
|
11
|
-
}
|
|
6
|
+
import { ImportAttribute, ModuleSpecifier } from './common.js';
|
|
12
7
|
export declare class ImportSpecifier extends ModuleSpecifier {
|
|
13
8
|
private imported;
|
|
14
9
|
static fromJSON(node: ImportSpecifier, deserializer: NodeDeserializer): ImportSpecifier;
|
|
@@ -49,10 +44,10 @@ export declare class ImportDeclaration extends AbstractExpressionNode {
|
|
|
49
44
|
private assertions?;
|
|
50
45
|
static fromJSON(node: ImportDeclaration, deserializer: NodeDeserializer): ImportDeclaration;
|
|
51
46
|
static visit(node: ImportDeclaration, visitNode: VisitNodeType): void;
|
|
52
|
-
constructor(source: Literal<string>, specifiers?: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[] | undefined, assertions?:
|
|
47
|
+
constructor(source: Literal<string>, specifiers?: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[] | undefined, assertions?: ImportAttribute[] | undefined);
|
|
53
48
|
getSource(): Literal<string>;
|
|
54
49
|
getSpecifiers(): (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[] | undefined;
|
|
55
|
-
getAssertions():
|
|
50
|
+
getAssertions(): ImportAttribute[] | undefined;
|
|
56
51
|
shareVariables(scopeList: Scope<any>[]): void;
|
|
57
52
|
set(stack: Stack): void;
|
|
58
53
|
get(stack: Stack): void;
|
package/api/module/import.js
CHANGED
|
@@ -3,20 +3,7 @@ import { __decorate, __metadata } from "tslib";
|
|
|
3
3
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
4
4
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
5
5
|
import { Identifier, Literal } from '../definition/values.js';
|
|
6
|
-
|
|
7
|
-
constructor(local) {
|
|
8
|
-
super();
|
|
9
|
-
this.local = local;
|
|
10
|
-
}
|
|
11
|
-
getLocal() {
|
|
12
|
-
return this.local;
|
|
13
|
-
}
|
|
14
|
-
toJson() {
|
|
15
|
-
return {
|
|
16
|
-
local: this.local.toJSON()
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
}
|
|
6
|
+
import { ModuleSpecifier } from './common.js';
|
|
20
7
|
let ImportSpecifier = ImportSpecifier_1 = class ImportSpecifier extends ModuleSpecifier {
|
|
21
8
|
constructor(local, imported) {
|
|
22
9
|
super(local);
|
|
@@ -132,12 +119,12 @@ let ImportDeclaration = ImportDeclaration_1 = class ImportDeclaration extends Ab
|
|
|
132
119
|
this.assertions = assertions;
|
|
133
120
|
}
|
|
134
121
|
static fromJSON(node, deserializer) {
|
|
135
|
-
return new ImportDeclaration_1(deserializer(node.source), node.specifiers?.map(deserializer),
|
|
122
|
+
return new ImportDeclaration_1(deserializer(node.source), node.specifiers?.map(deserializer), node.assertions?.map(deserializer));
|
|
136
123
|
}
|
|
137
124
|
static visit(node, visitNode) {
|
|
138
125
|
visitNode(node.source);
|
|
139
126
|
node.specifiers?.forEach(visitNode);
|
|
140
|
-
node.assertions
|
|
127
|
+
node.assertions?.forEach(visitNode);
|
|
141
128
|
}
|
|
142
129
|
getSource() {
|
|
143
130
|
return this.source;
|
|
@@ -155,7 +142,9 @@ let ImportDeclaration = ImportDeclaration_1 = class ImportDeclaration extends Ab
|
|
|
155
142
|
get(stack) {
|
|
156
143
|
let importCallOptions;
|
|
157
144
|
if (this.assertions) {
|
|
158
|
-
const importAssertions = this.assertions
|
|
145
|
+
const importAssertions = this.assertions
|
|
146
|
+
.map(assertion => assertion.get(stack))
|
|
147
|
+
.reduce((p, c) => Object.assign(p, c), {});
|
|
159
148
|
if (importAssertions) {
|
|
160
149
|
importCallOptions = { assert: importAssertions };
|
|
161
150
|
}
|
|
@@ -216,18 +205,19 @@ let ImportDeclaration = ImportDeclaration_1 = class ImportDeclaration extends Ab
|
|
|
216
205
|
const importSpecifiersString = importSpecifiers.map(importSpecifier => importSpecifier.toString()).join(',');
|
|
217
206
|
parts.push(`{ ${importSpecifiersString} }`);
|
|
218
207
|
}
|
|
219
|
-
return `import ${parts.join(', ')}
|
|
208
|
+
return `import ${parts.join(', ')} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;
|
|
220
209
|
}
|
|
221
210
|
toJson() {
|
|
222
211
|
return {
|
|
223
212
|
source: this.source.toJSON(),
|
|
224
213
|
specifiers: this.specifiers?.map(specifier => specifier.toJSON()),
|
|
214
|
+
assertions: this.assertions?.map(assertion => assertion.toJSON()),
|
|
225
215
|
};
|
|
226
216
|
}
|
|
227
217
|
};
|
|
228
218
|
ImportDeclaration = ImportDeclaration_1 = __decorate([
|
|
229
219
|
Deserializer('ImportDeclaration'),
|
|
230
|
-
__metadata("design:paramtypes", [Literal, Array,
|
|
220
|
+
__metadata("design:paramtypes", [Literal, Array, Array])
|
|
231
221
|
], ImportDeclaration);
|
|
232
222
|
export { ImportDeclaration };
|
|
233
223
|
let ImportExpression = ImportExpression_1 = class ImportExpression extends AbstractExpressionNode {
|
package/api/module/import.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../../../src/expressions/api/module/import.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,OAAgB,eAAgB,SAAQ,sBAAsB;IACnE,YAAsB,KAAiB;QACtC,KAAK,EAAE,CAAC;QADa,UAAK,GAAL,KAAK,CAAY;IAEvC,CAAC;IACD,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IACD,MAAM;QACL,OAAO;YACN,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;SAC1B,CAAC;IACH,CAAC;CACD;AAoBD,IAAa,eAAe,uBAA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C;IACpE,CAAC;IACD,GAAG,CAAC,KAAY;QACf,IAAI,iBAAgD,CAAC;QACrD,IAAI,IAAI,CAAC,UAAU,EAAE;YACpB,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC/C;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;QACxE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACD,UAAU,CAAC,QAAe;QACzB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,cAAc,CAAC,QAAe;QAC7B,OAAO,EAAE,CAAC;IACX,CAAC;IACD,QAAQ;QACP,OAAO,UAAU,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;IACvG,CAAC;IACD,MAAM;QACL,OAAO;YACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;SAC5B,CAAC;IACH,CAAC;CACD,CAAA;AA3CY,gBAAgB;IAD5B,YAAY,CAAC,kBAAkB,CAAC;qCAYJ,OAAO;GAXvB,gBAAgB,CA2C5B;SA3CY,gBAAgB","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode,\n\tExpressionEventPath, VisitNodeType,\n} from '../expression.js';\nimport type { ModuleScope, Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { Identifier, Literal } from '../definition/values.js';\n\nexport abstract class ModuleSpecifier extends AbstractExpressionNode {\n\tconstructor(protected local: Identifier) {\n\t\tsuper();\n\t}\n\tgetLocal() {\n\t\treturn this.local;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tlocal: this.local.toJSON()\n\t\t};\n\t}\n}\n\n/**\n * An imported variable binding,\n * \n * e.g., {foo} in import {foo} from \"mod\"\n * or {foo as bar} in import {foo as bar} from \"mod\".\n * \n * The imported field refers to the name of the export imported from the module.\n * \n * The local field refers to the binding imported into the local module scope.\n * \n * If it is a basic named import, such as in import {foo} from \"mod\",\n * both imported and local are equivalent Identifier nodes; in this case an Identifier node representing foo.\n * \n * If it is an aliased import, such as in import {foo as bar} from \"mod\",\n * the imported field is an Identifier node representing foo,\n * and the local field is an Identifier node representing bar.\n */\n@Deserializer('ImportSpecifier')\nexport class ImportSpecifier extends ModuleSpecifier {\n\tstatic fromJSON(node: ImportSpecifier, deserializer: NodeDeserializer): ImportSpecifier {\n\t\treturn new ImportSpecifier(\n\t\t\tdeserializer(node.local) as Identifier,\n\t\t\tdeserializer(node.imported) as Identifier\n\t\t);\n\t}\n\tstatic visit(node: ImportSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\n\t\tvisitNode(node.imported);\n\t}\n\tconstructor(local: Identifier, private imported: Identifier) {\n\t\tsuper(local);\n\t}\n\tgetImported() {\n\t\treturn this.imported;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\tconst local = this.local.toString();\n\t\tconst imported = this.imported.toString();\n\t\tif (local == imported) {\n\t\t\treturn local;\n\t\t}\n\t\treturn `${imported} as ${local}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tlocal: this.local.toJSON(),\n\t\t\timported: this.imported.toJSON()\n\t\t};\n\t}\n}\n\n/**\n * A default import specifier, e.g., foo in import foo from \"mod.js\".\n */\n@Deserializer('ImportDefaultSpecifier')\nexport class ImportDefaultSpecifier extends ModuleSpecifier {\n\tstatic fromJSON(node: ImportDefaultSpecifier, deserializer: NodeDeserializer): ImportDefaultSpecifier {\n\t\treturn new ImportDefaultSpecifier(\n\t\t\tdeserializer(node.local) as Identifier\n\t\t);\n\t}\n\tstatic visit(node: ImportDefaultSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\treturn this.local.toString();\n\t}\n}\n\n/**\n * A namespace import specifier, e.g., * as foo in import * as foo from \"mod.js\".\n */\n@Deserializer('ImportNamespaceSpecifier')\nexport class ImportNamespaceSpecifier extends ModuleSpecifier {\n\tstatic fromJSON(node: ImportNamespaceSpecifier, deserializer: NodeDeserializer): ImportNamespaceSpecifier {\n\t\treturn new ImportNamespaceSpecifier(\n\t\t\tdeserializer(node.local) as Identifier\n\t\t);\n\t}\n\tstatic visit(node: ImportNamespaceSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\treturn `* as ${this.local.toString()}`;\n\t}\n}\n\n/**\n * An import declaration, e.g., import foo from \"mod\";.\n * \n * import defaultExport from \"module-name\";\n * \n * import * as name from \"module-name\";\n * \n * import { export1 } from \"module-name\";\n * \n * import { export1 as alias1 } from \"module-name\";\n * \n * import { export1 , export2 } from \"module-name\";\n * \n * import { foo , bar } from \"module-name/path/to/specific/un-exported/file\";\n * \n * import { export1 , export2 as alias2 , [...] } from \"module-name\";\n * \n * import defaultExport, { export1 [ , [...] ] } from \"module-name\";\n * \n * import defaultExport, * as name from \"module-name\";\n * \n * import \"module-name\";\n * \n * var promise = import(\"module-name\");\n */\n@Deserializer('ImportDeclaration')\nexport class ImportDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ImportDeclaration, deserializer: NodeDeserializer): ImportDeclaration {\n\t\treturn new ImportDeclaration(\n\t\t\tdeserializer(node.source) as Literal<string>,\n\t\t\tnode.specifiers?.map(deserializer) as (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[],\n\t\t\t(node.assertions && deserializer(node.assertions)) || undefined,\n\t\t);\n\t}\n\tstatic visit(node: ImportDeclaration, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.source);\n\t\tnode.specifiers?.forEach(visitNode);\n\t\tnode.assertions && (node.assertions);\n\t}\n\tconstructor(\n\t\tprivate source: Literal<string>,\n\t\tprivate specifiers?: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[],\n\t\tprivate assertions?: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tgetSpecifiers() {\n\t\treturn this.specifiers;\n\t}\n\tgetAssertions() {\n\t\treturn this.assertions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ImportDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack): void {\n\t\tlet importCallOptions: ImportCallOptions | undefined;\n\t\tif (this.assertions) {\n\t\t\tconst importAssertions: ImportAssertions = this.assertions.get(stack);\n\t\t\tif (importAssertions) {\n\t\t\t\timportCallOptions = { assert: importAssertions };\n\t\t\t}\n\t\t}\n\t\tconst module = stack.importModule(this.source.get(), importCallOptions);\n\t\tif (!this.specifiers) {\n\t\t\treturn;\n\t\t}\n\t\tthis.specifiers.forEach(specifier => {\n\t\t\tconst local = specifier.getLocal().get(stack);\n\t\t\tif (specifier instanceof ImportSpecifier) {\n\t\t\t\tconst imported = specifier.getImported().get(stack);\n\t\t\t\tconst importedValue = module.get(imported);\n\t\t\t\tstack.getModule()?.set(local, importedValue);\n\t\t\t\tconst scopeSubscription = module.subscribe(local, (newValue, oldValue) => {\n\t\t\t\t\tif (newValue !== oldValue) {\n\t\t\t\t\t\tstack.getModule()?.set(local, newValue);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t\t} else if (specifier instanceof ImportDefaultSpecifier) {\n\t\t\t\tconst defaultValue = module.get('default');\n\t\t\t\tstack.getModule()?.set(local, defaultValue);\n\t\t\t\tconst scopeSubscription = module.subscribe('default', (newValue, oldValue) => {\n\t\t\t\t\tif (newValue !== oldValue) {\n\t\t\t\t\t\tstack.getModule()?.set(local, newValue);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t\t} else if (specifier instanceof ImportNamespaceSpecifier) {\n\t\t\t\tstack.getModule()?.importModule(local, module);\n\t\t\t}\n\t\t});\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\tif (!this.specifiers) {\n\t\t\treturn `import '${this.source.toString()}'`;\n\t\t}\n\t\tconst parts: string[] = [];\n\t\tconst importDefaultSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportDefaultSpecifier) as ImportDefaultSpecifier[];\n\t\tif (importDefaultSpecifiers?.length) {\n\t\t\tparts.push(importDefaultSpecifiers[0].toString());\n\t\t}\n\t\tconst importNamespaceSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportNamespaceSpecifier) as ImportNamespaceSpecifier[];\n\t\tif (importNamespaceSpecifiers?.length) {\n\t\t\tparts.push(importNamespaceSpecifiers[0].toString());\n\t\t}\n\t\tconst importSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportSpecifier) as ImportSpecifier[];\n\t\tif (importSpecifiers?.length) {\n\t\t\tconst importSpecifiersString = importSpecifiers.map(importSpecifier => importSpecifier.toString()).join(',');\n\t\t\tparts.push(`{ ${importSpecifiersString} }`);\n\t\t}\n\t\treturn `import ${parts.join(', ')} '${this.source.toString()}'${this.assertions ? ` assert ${this.assertions.toString()}` : ''}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tsource: this.source.toJSON(),\n\t\t\tspecifiers: this.specifiers?.map(specifier => specifier.toJSON()),\n\t\t};\n\t}\n}\n\n\n/**\n * `ImportExpression` node represents Dynamic Imports such as `import(source)`.\n * The `source` property is the importing source as similar to ImportDeclaration node,\n * but it can be an arbitrary expression node.\n */\n@Deserializer('ImportExpression')\nexport class ImportExpression extends AbstractExpressionNode {\n\tstatic fromJSON(node: ImportExpression, deserializer: NodeDeserializer): ImportExpression {\n\t\treturn new ImportExpression(\n\t\t\tdeserializer(node.source) as Literal<string>,\n\t\t\t(node.attributes && deserializer(node.attributes)) || undefined\n\t\t);\n\t}\n\tstatic visit(node: ImportExpression, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.source);\n\t\tnode.attributes && visitNode(node.attributes);\n\t}\n\tconstructor(private source: Literal<string>, private attributes?: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ImportDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack): Promise<ModuleScope> {\n\t\tlet importCallOptions: ImportCallOptions | undefined;\n\t\tif (this.attributes) {\n\t\t\timportCallOptions = this.attributes.get(stack);\n\t\t}\n\t\tconst module = stack.importModule(this.source.get(), importCallOptions);\n\t\treturn Promise.resolve(module);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\treturn `import(${this.source.toString()}${this.attributes ? `, ${this.attributes.toString()}` : ''})`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tsource: this.source.toJSON(),\n\t\t};\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../../../src/expressions/api/module/import.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAmB,eAAe,EAAE,MAAM,aAAa,CAAC;AAoB/D,IAAa,eAAe,uBAA5B,MAAa,eAAgB,SAAQ,eAAe;IAWnD,YAAY,KAAiB,EAAU,QAAoB;QAC1D,KAAK,CAAC,KAAK,CAAC,CAAC;QADyB,aAAQ,GAAR,QAAQ,CAAY;IAE3D,CAAC;IAZD,MAAM,CAAC,QAAQ,CAAC,IAAqB,EAAE,YAA8B;QACpE,OAAO,IAAI,iBAAe,CACzB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAe,EACtC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAe,CACzC,CAAC;IACH,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,IAAqB,EAAE,SAAwB;QAC3D,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IAID,WAAW;QACV,OA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/C;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;QACxE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACD,UAAU,CAAC,QAAe;QACzB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,cAAc,CAAC,QAAe;QAC7B,OAAO,EAAE,CAAC;IACX,CAAC;IACD,QAAQ;QACP,OAAO,UAAU,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;IACvG,CAAC;IACD,MAAM;QACL,OAAO;YACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;SAC5B,CAAC;IACH,CAAC;CACD,CAAA;AA3CY,gBAAgB;IAD5B,YAAY,CAAC,kBAAkB,CAAC;qCAYJ,OAAO;GAXvB,gBAAgB,CA2C5B;SA3CY,gBAAgB","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode,\n\tExpressionEventPath, VisitNodeType,\n} from '../expression.js';\nimport type { ModuleScope, Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { Identifier, Literal } from '../definition/values.js';\nimport { ImportAttribute, ModuleSpecifier } from './common.js';\n\n/**\n * An imported variable binding,\n * \n * e.g., {foo} in import {foo} from \"mod\"\n * or {foo as bar} in import {foo as bar} from \"mod\".\n * \n * The imported field refers to the name of the export imported from the module.\n * \n * The local field refers to the binding imported into the local module scope.\n * \n * If it is a basic named import, such as in import {foo} from \"mod\",\n * both imported and local are equivalent Identifier nodes; in this case an Identifier node representing foo.\n * \n * If it is an aliased import, such as in import {foo as bar} from \"mod\",\n * the imported field is an Identifier node representing foo,\n * and the local field is an Identifier node representing bar.\n */\n@Deserializer('ImportSpecifier')\nexport class ImportSpecifier extends ModuleSpecifier {\n\tstatic fromJSON(node: ImportSpecifier, deserializer: NodeDeserializer): ImportSpecifier {\n\t\treturn new ImportSpecifier(\n\t\t\tdeserializer(node.local) as Identifier,\n\t\t\tdeserializer(node.imported) as Identifier\n\t\t);\n\t}\n\tstatic visit(node: ImportSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\n\t\tvisitNode(node.imported);\n\t}\n\tconstructor(local: Identifier, private imported: Identifier) {\n\t\tsuper(local);\n\t}\n\tgetImported() {\n\t\treturn this.imported;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\tconst local = this.local.toString();\n\t\tconst imported = this.imported.toString();\n\t\tif (local == imported) {\n\t\t\treturn local;\n\t\t}\n\t\treturn `${imported} as ${local}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tlocal: this.local.toJSON(),\n\t\t\timported: this.imported.toJSON()\n\t\t};\n\t}\n}\n\n/**\n * A default import specifier, e.g., `foo` in `import foo from \"mod.js\";`.\n */\n@Deserializer('ImportDefaultSpecifier')\nexport class ImportDefaultSpecifier extends ModuleSpecifier {\n\tstatic fromJSON(node: ImportDefaultSpecifier, deserializer: NodeDeserializer): ImportDefaultSpecifier {\n\t\treturn new ImportDefaultSpecifier(\n\t\t\tdeserializer(node.local) as Identifier\n\t\t);\n\t}\n\tstatic visit(node: ImportDefaultSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\treturn this.local.toString();\n\t}\n}\n\n/**\n * A namespace import specifier, e.g., `* as foo` in `import * as foo from \"mod.js\";`.\n */\n@Deserializer('ImportNamespaceSpecifier')\nexport class ImportNamespaceSpecifier extends ModuleSpecifier {\n\tstatic fromJSON(node: ImportNamespaceSpecifier, deserializer: NodeDeserializer): ImportNamespaceSpecifier {\n\t\treturn new ImportNamespaceSpecifier(\n\t\t\tdeserializer(node.local) as Identifier\n\t\t);\n\t}\n\tstatic visit(node: ImportNamespaceSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\treturn `* as ${this.local.toString()}`;\n\t}\n}\n\n/**\n * An import declaration, e.g., import foo from \"mod\";.\n * \n * import defaultExport from \"module-name\";\n * \n * import * as name from \"module-name\";\n * \n * import { export1 } from \"module-name\";\n * \n * import { export1 as alias1 } from \"module-name\";\n * \n * import { export1 , export2 } from \"module-name\";\n * \n * import { foo , bar } from \"module-name/path/to/specific/un-exported/file\";\n * \n * import { export1 , export2 as alias2 , [...] } from \"module-name\";\n * \n * import defaultExport, { export1 [ , [...] ] } from \"module-name\";\n * \n * import defaultExport, * as name from \"module-name\";\n * \n * import \"module-name\";\n * \n */\n@Deserializer('ImportDeclaration')\nexport class ImportDeclaration extends AbstractExpressionNode {\n\tstatic fromJSON(node: ImportDeclaration, deserializer: NodeDeserializer): ImportDeclaration {\n\t\treturn new ImportDeclaration(\n\t\t\tdeserializer(node.source) as Literal<string>,\n\t\t\tnode.specifiers?.map(deserializer) as (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[],\n\t\t\tnode.assertions?.map(deserializer) as (ImportAttribute)[],\n\t\t);\n\t}\n\tstatic visit(node: ImportDeclaration, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.source);\n\t\tnode.specifiers?.forEach(visitNode);\n\t\tnode.assertions?.forEach(visitNode);\n\t}\n\tconstructor(\n\t\tprivate source: Literal<string>,\n\t\tprivate specifiers?: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[],\n\t\tprivate assertions?: ImportAttribute[]) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tgetSpecifiers() {\n\t\treturn this.specifiers;\n\t}\n\tgetAssertions() {\n\t\treturn this.assertions;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ImportDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack): void {\n\t\tlet importCallOptions: ImportCallOptions | undefined;\n\t\tif (this.assertions) {\n\t\t\tconst importAssertions: ImportAssertions = this.assertions\n\t\t\t\t.map(assertion => assertion.get(stack))\n\t\t\t\t.reduce((p, c) => Object.assign(p, c), {});\n\t\t\tif (importAssertions) {\n\t\t\t\timportCallOptions = { assert: importAssertions };\n\t\t\t}\n\t\t}\n\t\tconst module = stack.importModule(this.source.get(), importCallOptions);\n\t\tif (!this.specifiers) {\n\t\t\treturn;\n\t\t}\n\t\tthis.specifiers.forEach(specifier => {\n\t\t\tconst local = specifier.getLocal().get(stack);\n\t\t\tif (specifier instanceof ImportSpecifier) {\n\t\t\t\tconst imported = specifier.getImported().get(stack);\n\t\t\t\tconst importedValue = module.get(imported);\n\t\t\t\tstack.getModule()?.set(local, importedValue);\n\t\t\t\tconst scopeSubscription = module.subscribe(local, (newValue, oldValue) => {\n\t\t\t\t\tif (newValue !== oldValue) {\n\t\t\t\t\t\tstack.getModule()?.set(local, newValue);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t\t} else if (specifier instanceof ImportDefaultSpecifier) {\n\t\t\t\tconst defaultValue = module.get('default');\n\t\t\t\tstack.getModule()?.set(local, defaultValue);\n\t\t\t\tconst scopeSubscription = module.subscribe('default', (newValue, oldValue) => {\n\t\t\t\t\tif (newValue !== oldValue) {\n\t\t\t\t\t\tstack.getModule()?.set(local, newValue);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tstack.onDestroy(() => scopeSubscription.unsubscribe());\n\t\t\t} else if (specifier instanceof ImportNamespaceSpecifier) {\n\t\t\t\tstack.getModule()?.importModule(local, module);\n\t\t\t}\n\t\t});\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\tif (!this.specifiers) {\n\t\t\treturn `import '${this.source.toString()}'`;\n\t\t}\n\t\tconst parts: string[] = [];\n\t\tconst importDefaultSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportDefaultSpecifier) as ImportDefaultSpecifier[];\n\t\tif (importDefaultSpecifiers?.length) {\n\t\t\tparts.push(importDefaultSpecifiers[0].toString());\n\t\t}\n\t\tconst importNamespaceSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportNamespaceSpecifier) as ImportNamespaceSpecifier[];\n\t\tif (importNamespaceSpecifiers?.length) {\n\t\t\tparts.push(importNamespaceSpecifiers[0].toString());\n\t\t}\n\t\tconst importSpecifiers = this.specifiers.filter(specifier => specifier instanceof ImportSpecifier) as ImportSpecifier[];\n\t\tif (importSpecifiers?.length) {\n\t\t\tconst importSpecifiersString = importSpecifiers.map(importSpecifier => importSpecifier.toString()).join(',');\n\t\t\tparts.push(`{ ${importSpecifiersString} }`);\n\t\t}\n\t\treturn `import ${parts.join(', ')} from ${this.source.toString()}${this.assertions ? ` assert { ${this.assertions.map(assertion => assertion.toString()).join(', ')} }` : ''};`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tsource: this.source.toJSON(),\n\t\t\tspecifiers: this.specifiers?.map(specifier => specifier.toJSON()),\n\t\t\tassertions: this.assertions?.map(assertion => assertion.toJSON()),\n\t\t};\n\t}\n}\n\n\n/**\n * `ImportExpression` node represents Dynamic Imports such as `import(source)`.\n * The `source` property is the importing source as similar to ImportDeclaration node,\n * but it can be an arbitrary expression node.\n * var promise = import(\"module-name\");\n */\n@Deserializer('ImportExpression')\nexport class ImportExpression extends AbstractExpressionNode {\n\tstatic fromJSON(node: ImportExpression, deserializer: NodeDeserializer): ImportExpression {\n\t\treturn new ImportExpression(\n\t\t\tdeserializer(node.source) as Literal<string>,\n\t\t\t(node.attributes && deserializer(node.attributes)) || undefined\n\t\t);\n\t}\n\tstatic visit(node: ImportExpression, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.source);\n\t\tnode.attributes && visitNode(node.attributes);\n\t}\n\tconstructor(private source: Literal<string>, private attributes?: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void { }\n\tset(stack: Stack) {\n\t\tthrow new Error(`ImportDeclaration.#set() has no implementation.`);\n\t}\n\tget(stack: Stack): Promise<ModuleScope> {\n\t\tlet importCallOptions: ImportCallOptions | undefined;\n\t\tif (this.attributes) {\n\t\t\timportCallOptions = this.attributes.get(stack);\n\t\t}\n\t\tconst module = stack.importModule(this.source.get(), importCallOptions);\n\t\treturn Promise.resolve(module);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn [];\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn [];\n\t}\n\ttoString(): string {\n\t\treturn `import(${this.source.toString()}${this.attributes ? `, ${this.attributes.toString()}` : ''})`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tsource: this.source.toJSON(),\n\t\t};\n\t}\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ExpressionEventPath, ExpressionNode, NodeDeserializer, VisitNodeType } from '
|
|
2
|
-
import type { Scope, ScopeContext } from '
|
|
3
|
-
import type { Stack } from '
|
|
4
|
-
import { AbstractExpressionNode } from '
|
|
1
|
+
import type { ExpressionEventPath, ExpressionNode, NodeDeserializer, VisitNodeType } from './expression.js';
|
|
2
|
+
import type { Scope, ScopeContext } from '../scope/scope.js';
|
|
3
|
+
import type { Stack } from '../scope/stack.js';
|
|
4
|
+
import { AbstractExpressionNode } from './abstract.js';
|
|
5
5
|
export declare type ProgramSourceType = 'script' | 'module';
|
|
6
6
|
export declare class Program extends AbstractExpressionNode {
|
|
7
7
|
private sourceType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Program_1;
|
|
2
2
|
import { __decorate, __metadata } from "tslib";
|
|
3
|
-
import { AbstractExpressionNode } from '
|
|
4
|
-
import { Deserializer } from '
|
|
3
|
+
import { AbstractExpressionNode } from './abstract.js';
|
|
4
|
+
import { Deserializer } from './deserialize/deserialize.js';
|
|
5
5
|
let Program = Program_1 = class Program extends AbstractExpressionNode {
|
|
6
6
|
constructor(sourceType, body) {
|
|
7
7
|
super();
|
|
@@ -19,7 +19,7 @@ let Program = Program_1 = class Program extends AbstractExpressionNode {
|
|
|
19
19
|
throw new Error(`Program#set() has no implementation.`);
|
|
20
20
|
}
|
|
21
21
|
get(stack) {
|
|
22
|
-
return this.body.
|
|
22
|
+
return this.body.map(statement => statement.get(stack)).at(-1);
|
|
23
23
|
}
|
|
24
24
|
dependency(computed) {
|
|
25
25
|
return this.body.flatMap(statement => statement.dependency());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../../src/expressions/api/program.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAK5D,IAAa,OAAO,eAApB,MAAa,OAAQ,SAAQ,sBAAsB;IAQlD,YAAoB,UAA6B,EAAU,IAAsB;QAChF,KAAK,EAAE,CAAC;QADW,eAAU,GAAV,UAAU,CAAmB;QAAU,SAAI,GAAJ,IAAI,CAAkB;IAEjF,CAAC;IARD,MAAM,CAAC,QAAQ,CAAC,IAAa,EAAE,YAA8B;QAC5D,OAAO,IAAI,SAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;IAClE,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,IAAa,EAAE,SAAwB;QACnD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAID,cAAc,CAAC,SAAgC,IAAU,CAAC;IAC1D,GAAG,CAAC,KAAY,EAAE,KAAU;QAC3B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACzD,CAAC;IACD,GAAG,CAAC,KAAY;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,UAAU,CAAC,QAAe;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/D,CAAC;IACD,cAAc,CAAC,QAAe;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,QAAQ;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,CAAC;IACD,MAAM;QACL,OAAO;YACN,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;SACpD,CAAC;IACH,CAAC;CAED,CAAA;AAnCY,OAAO;IADnB,YAAY,CAAC,SAAS,CAAC;;GACX,OAAO,CAmCnB;SAnCY,OAAO","sourcesContent":["import type {\n\tExpressionEventPath, ExpressionNode,\n\tNodeDeserializer, VisitNodeType\n} from './expression.js';\nimport type { Scope, ScopeContext } from '../scope/scope.js';\nimport type { Stack } from '../scope/stack.js';\nimport { AbstractExpressionNode } from './abstract.js';\nimport { Deserializer } from './deserialize/deserialize.js';\n\nexport type ProgramSourceType = 'script' | 'module';\n\n@Deserializer('Program')\nexport class Program extends AbstractExpressionNode {\n\n\tstatic fromJSON(node: Program, deserializer: NodeDeserializer): Program {\n\t\treturn new Program(node.sourceType, node.body.map(deserializer));\n\t}\n\tstatic visit(node: Program, visitNode: VisitNodeType): void {\n\t\tnode.body.forEach(visitNode);\n\t}\n\tconstructor(private sourceType: ProgramSourceType, private body: ExpressionNode[]) {\n\t\tsuper();\n\t}\n\tshareVariables(scopeList: Scope<ScopeContext>[]): void { }\n\tset(stack: Stack, value: any): any {\n\t\tthrow new Error(`Program#set() has no implementation.`);\n\t}\n\tget(stack: Stack): any {\n\t\treturn this.body.map(statement => statement.get(stack)).at(-1);\n\t}\n\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.body.flatMap(statement => statement.dependency());\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.body.flatMap(statement => statement.dependencyPath());\n\t}\n\ttoString(): string {\n\t\treturn this.body.map(statement => statement.toString()).join('\\n');\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tsourceType: this.sourceType,\n\t\t\tbody: this.body.map(statement => statement.toJSON())\n\t\t};\n\t}\n\n}\n"]}
|
|
@@ -4,10 +4,9 @@ import type { Stack } from '../../../scope/stack.js';
|
|
|
4
4
|
import { AbstractExpressionNode } from '../../abstract.js';
|
|
5
5
|
export declare class BlockStatement extends AbstractExpressionNode {
|
|
6
6
|
protected body: ExpressionNode[];
|
|
7
|
-
isStatement: boolean;
|
|
8
7
|
static fromJSON(node: BlockStatement, deserializer: NodeDeserializer): BlockStatement;
|
|
9
8
|
static visit(node: BlockStatement, visitNode: VisitNodeType): void;
|
|
10
|
-
constructor(body: ExpressionNode[]
|
|
9
|
+
constructor(body: ExpressionNode[]);
|
|
11
10
|
getBody(): ExpressionNode[];
|
|
12
11
|
shareVariables(scopeList: Scope<any>[]): void;
|
|
13
12
|
set(stack: Stack, value: any): void;
|