@ibyar/expressions 3.0.0 → 4.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/LICENSE +1 -1
- package/api/module/export.d.ts +6 -6
- package/api/module/export.js +28 -28
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +3 -3
- package/api/module/import.js +14 -14
- package/api/module/import.js.map +1 -1
- package/bin/cli.js +0 -0
- package/package.json +6 -5
- package/scope/scope.d.ts +4 -0
- package/scope/scope.d.ts.map +1 -1
- package/scope/scope.js +12 -1
- package/scope/scope.js.map +1 -1
- package/scope/stack.d.ts.map +1 -1
- package/scope/stack.js +2 -2
- package/scope/stack.js.map +1 -1
- package/v8/factory.d.ts +4 -4
- package/v8/factory.d.ts.map +1 -1
- package/v8/factory.js +7 -7
- package/v8/factory.js.map +1 -1
- package/v8/node.d.ts +4 -4
- package/v8/node.d.ts.map +1 -1
- package/v8/node.js.map +1 -1
- package/v8/parser.d.ts +1 -1
- package/v8/parser.d.ts.map +1 -1
- package/v8/parser.js +19 -20
- package/v8/parser.js.map +1 -1
- package/v8/stream.js +2 -2
- package/v8/stream.js.map +1 -1
package/LICENSE
CHANGED
package/api/module/export.d.ts
CHANGED
|
@@ -77,14 +77,14 @@ export declare class ExportNamedDeclaration extends AbstractExpressionNode {
|
|
|
77
77
|
private specifiers;
|
|
78
78
|
private declaration?;
|
|
79
79
|
private source?;
|
|
80
|
-
private
|
|
80
|
+
private attributes?;
|
|
81
81
|
static fromJSON(node: ExportNamedDeclaration, deserializer: NodeDeserializer): ExportNamedDeclaration;
|
|
82
82
|
static visit(node: ExportNamedDeclaration, visitNode: VisitNodeType): void;
|
|
83
|
-
constructor(specifiers: ExportSpecifier[], declaration?: DeclarationExpression | undefined, source?: Literal<string> | undefined,
|
|
83
|
+
constructor(specifiers: ExportSpecifier[], declaration?: DeclarationExpression | undefined, source?: Literal<string> | undefined, attributes?: ImportAttribute[] | undefined, range?: [number, number], loc?: SourceLocation);
|
|
84
84
|
getSource(): Literal<string> | undefined;
|
|
85
85
|
getSpecifiers(): ExportSpecifier[];
|
|
86
86
|
getDeclaration(): DeclarationExpression | undefined;
|
|
87
|
-
|
|
87
|
+
getAttributes(): ImportAttribute[] | undefined;
|
|
88
88
|
set(stack: Stack): void;
|
|
89
89
|
get(stack: Stack): void;
|
|
90
90
|
private exportDeclaration;
|
|
@@ -119,13 +119,13 @@ export declare class ExportDefaultDeclaration extends AbstractExpressionNode {
|
|
|
119
119
|
export declare class ExportAllDeclaration extends AbstractExpressionNode {
|
|
120
120
|
private source;
|
|
121
121
|
private exported?;
|
|
122
|
-
private
|
|
122
|
+
private attributes?;
|
|
123
123
|
static fromJSON(node: ExportAllDeclaration, deserializer: NodeDeserializer): ExportAllDeclaration;
|
|
124
124
|
static visit(node: ExportAllDeclaration, visitNode: VisitNodeType): void;
|
|
125
|
-
constructor(source: Literal<string>, exported?: Identifier | undefined,
|
|
125
|
+
constructor(source: Literal<string>, exported?: Identifier | undefined, attributes?: ImportAttribute[] | undefined, range?: [number, number], loc?: SourceLocation);
|
|
126
126
|
getSource(): Literal<string>;
|
|
127
127
|
getExported(): Identifier | undefined;
|
|
128
|
-
|
|
128
|
+
getAttributes(): ImportAttribute[] | undefined;
|
|
129
129
|
set(stack: Stack): void;
|
|
130
130
|
get(stack: Stack): void;
|
|
131
131
|
dependency(computed?: true): ExpressionNode[];
|
package/api/module/export.js
CHANGED
|
@@ -136,22 +136,22 @@ let ExportNamedDeclaration = (() => {
|
|
|
136
136
|
specifiers;
|
|
137
137
|
declaration;
|
|
138
138
|
source;
|
|
139
|
-
|
|
139
|
+
attributes;
|
|
140
140
|
static fromJSON(node, deserializer) {
|
|
141
|
-
return new ExportNamedDeclaration(node.specifiers.map(deserializer), node.declaration ? deserializer(node.declaration) : void 0, node.source ? deserializer(node.source) : void 0, node.
|
|
141
|
+
return new ExportNamedDeclaration(node.specifiers.map(deserializer), node.declaration ? deserializer(node.declaration) : void 0, node.source ? deserializer(node.source) : void 0, node.attributes ? node.attributes.map(deserializer) : void 0, node.range, node.loc);
|
|
142
142
|
}
|
|
143
143
|
static visit(node, visitNode) {
|
|
144
144
|
node.specifiers.map(visitNode);
|
|
145
145
|
node.source && visitNode(node.source);
|
|
146
146
|
node.declaration && visitNode(node.declaration);
|
|
147
|
-
node.
|
|
147
|
+
node.attributes?.forEach(visitNode);
|
|
148
148
|
}
|
|
149
|
-
constructor(specifiers, declaration, source,
|
|
149
|
+
constructor(specifiers, declaration, source, attributes, range, loc) {
|
|
150
150
|
super(range, loc);
|
|
151
151
|
this.specifiers = specifiers;
|
|
152
152
|
this.declaration = declaration;
|
|
153
153
|
this.source = source;
|
|
154
|
-
this.
|
|
154
|
+
this.attributes = attributes;
|
|
155
155
|
}
|
|
156
156
|
getSource() {
|
|
157
157
|
return this.source;
|
|
@@ -162,8 +162,8 @@ let ExportNamedDeclaration = (() => {
|
|
|
162
162
|
getDeclaration() {
|
|
163
163
|
return this.declaration;
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
return this.
|
|
165
|
+
getAttributes() {
|
|
166
|
+
return this.attributes;
|
|
167
167
|
}
|
|
168
168
|
set(stack) {
|
|
169
169
|
throw new Error(`ExportNamedDeclaration.#set() has no implementation.`);
|
|
@@ -196,12 +196,12 @@ let ExportNamedDeclaration = (() => {
|
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
198
|
let importCallOptions;
|
|
199
|
-
if (this.
|
|
200
|
-
const
|
|
201
|
-
.map(
|
|
199
|
+
if (this.attributes) {
|
|
200
|
+
const importAttributes = this.attributes
|
|
201
|
+
.map(attribute => attribute.get(stack))
|
|
202
202
|
.reduce((p, c) => Object.assign(p, c), {});
|
|
203
|
-
if (
|
|
204
|
-
importCallOptions = {
|
|
203
|
+
if (importAttributes) {
|
|
204
|
+
importCallOptions = { with: importAttributes };
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
const sourceModule = stack.importModule(this.source.get(), importCallOptions);
|
|
@@ -254,14 +254,14 @@ let ExportNamedDeclaration = (() => {
|
|
|
254
254
|
return `${exportStr};`;
|
|
255
255
|
}
|
|
256
256
|
const source = this.source.toString();
|
|
257
|
-
return `${exportStr} from ${source}${this.
|
|
257
|
+
return `${exportStr} from ${source}${this.attributes ? ` with { ${this.attributes.map(attribute => attribute.toString()).join(', ')} }` : ''};`;
|
|
258
258
|
}
|
|
259
259
|
toJson() {
|
|
260
260
|
return {
|
|
261
261
|
specifiers: this.specifiers.map(specifier => specifier.toJSON()),
|
|
262
262
|
source: this.source?.toJSON(),
|
|
263
263
|
declaration: this.declaration?.toJSON(),
|
|
264
|
-
|
|
264
|
+
attributes: this.attributes?.map(attribute => attribute.toJSON()),
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
267
|
};
|
|
@@ -348,20 +348,20 @@ let ExportAllDeclaration = (() => {
|
|
|
348
348
|
}
|
|
349
349
|
source;
|
|
350
350
|
exported;
|
|
351
|
-
|
|
351
|
+
attributes;
|
|
352
352
|
static fromJSON(node, deserializer) {
|
|
353
|
-
return new ExportAllDeclaration(deserializer(node.source), node.exported ? deserializer(node.exported) : void 0, node.
|
|
353
|
+
return new ExportAllDeclaration(deserializer(node.source), node.exported ? deserializer(node.exported) : void 0, node.attributes?.map(deserializer), node.range, node.loc);
|
|
354
354
|
}
|
|
355
355
|
static visit(node, visitNode) {
|
|
356
356
|
visitNode(node.source);
|
|
357
357
|
node.exported && visitNode(node.exported);
|
|
358
|
-
node.
|
|
358
|
+
node.attributes?.forEach(visitNode);
|
|
359
359
|
}
|
|
360
|
-
constructor(source, exported,
|
|
360
|
+
constructor(source, exported, attributes, range, loc) {
|
|
361
361
|
super(range, loc);
|
|
362
362
|
this.source = source;
|
|
363
363
|
this.exported = exported;
|
|
364
|
-
this.
|
|
364
|
+
this.attributes = attributes;
|
|
365
365
|
}
|
|
366
366
|
getSource() {
|
|
367
367
|
return this.source;
|
|
@@ -369,20 +369,20 @@ let ExportAllDeclaration = (() => {
|
|
|
369
369
|
getExported() {
|
|
370
370
|
return this.exported;
|
|
371
371
|
}
|
|
372
|
-
|
|
373
|
-
return this.
|
|
372
|
+
getAttributes() {
|
|
373
|
+
return this.attributes;
|
|
374
374
|
}
|
|
375
375
|
set(stack) {
|
|
376
376
|
throw new Error(`ExportDefaultDeclaration.#set() has no implementation.`);
|
|
377
377
|
}
|
|
378
378
|
get(stack) {
|
|
379
379
|
let importCallOptions;
|
|
380
|
-
if (this.
|
|
381
|
-
const
|
|
382
|
-
.map(
|
|
380
|
+
if (this.attributes) {
|
|
381
|
+
const importAttributes = this.attributes
|
|
382
|
+
.map(attribute => attribute.get(stack))
|
|
383
383
|
.reduce((p, c) => Object.assign(p, c), {});
|
|
384
|
-
if (
|
|
385
|
-
importCallOptions = {
|
|
384
|
+
if (importAttributes) {
|
|
385
|
+
importCallOptions = { with: importAttributes };
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
let localModule = stack.getModule();
|
|
@@ -411,13 +411,13 @@ let ExportAllDeclaration = (() => {
|
|
|
411
411
|
return [];
|
|
412
412
|
}
|
|
413
413
|
toString() {
|
|
414
|
-
return `export *${this.exported ? ` as ${this.exported.toString()}` : ''} from ${this.source.toString()}${this.
|
|
414
|
+
return `export *${this.exported ? ` as ${this.exported.toString()}` : ''} from ${this.source.toString()}${this.attributes ? ` with { ${this.attributes.map(attribute => attribute.toString()).join(', ')} }` : ''};`;
|
|
415
415
|
}
|
|
416
416
|
toJson() {
|
|
417
417
|
return {
|
|
418
418
|
source: this.source.toJSON(),
|
|
419
419
|
exported: this.exported?.toJSON(),
|
|
420
|
-
|
|
420
|
+
attributes: this.attributes?.map(attribute => attribute.toJSON()),
|
|
421
421
|
};
|
|
422
422
|
}
|
|
423
423
|
};
|
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":"AACA;;;;;;;;;;;;;;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Q,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QACxN,CAAC;QACD,MAAM;YACL,OAAO;gBACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;gBAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE;gBACjC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;aACjE,CAAC;QACH,CAAC;;;;SAlFW,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, ExpressionEventPath,\n\tVisitNodeType, DeclarationExpression, SourceLocation\n} from '../expression.js';\nimport { ModuleContext, ReactiveScope } 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\tnode.range,\n\t\t\tnode.loc\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(\n\t\tlocal: Identifier,\n\t\tprivate exported: Identifier,\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(local, range, loc);\n\t}\n\tgetExported() {\n\t\treturn this.exported;\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\tnode.range,\n\t\t\tnode.loc\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\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\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\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\tthis.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 ${this.declaration.toString()}`);\n\t\t}\n\t\tconst value = stack.get(declaredName);\n\t\tstack.getModule()!.set(declaredName, value);\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(\n\t\t\tdeserializer(node.declaration),\n\t\t\tnode.range,\n\t\t\tnode.loc\n\t\t);\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\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\n\t}\n\tgetDeclaration() {\n\t\treturn this.declaration;\n\t}\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\tnode.range,\n\t\t\tnode.loc\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\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\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\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.getInnerScope(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"]}
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../src/expressions/api/module/export.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;AAMH,OAAO,EAAiB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAmB,eAAe,EAAE,MAAM,aAAa,CAAC;AAK/D;;;;;;;;;;;;;GAaG;IAEU,eAAe;4BAD3B,YAAY,CAAC,iBAAiB,CAAC;;;;sBACK,eAAe;+BAAvB,SAAQ,WAAe;;;;YAApD,6KAiDC;;;YAjDY,uDAAe;;QAelB,QAAQ;QAdjB,MAAM,CAAC,QAAQ,CAAC,IAAqB,EAAE,YAA8B;YACpE,OAAO,IAAI,eAAe,CACzB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAe,EACtC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAe,EACzC,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,GAAG,CACR,CAAC;QACH,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,IAAqB,EAAE,SAAwB;YAC3D,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC;QACD,YACC,KAAiB,EACT,QAAoB,EAC5B,KAAwB,EACxB,GAAoB;YACpB,KAAK,CAA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AAC;gBACF,CAAC,CAAC,CAAC;gBACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,UAAU,CAAC,QAAe;YACzB,OAAO,EAAE,CAAC;QACX,CAAC;QACD,cAAc,CAAC,QAAe;YAC7B,OAAO,EAAE,CAAC;QACX,CAAC;QACD,QAAQ;YACP,OAAO,WAAW,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;QACtN,CAAC;QACD,MAAM;YACL,OAAO;gBACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;gBAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE;gBACjC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;aACjE,CAAC;QACH,CAAC;;;;SAlFW,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, ExpressionEventPath,\n\tVisitNodeType, DeclarationExpression, SourceLocation\n} from '../expression.js';\nimport { ModuleContext, ReactiveScope } 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\tnode.range,\n\t\t\tnode.loc\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(\n\t\tlocal: Identifier,\n\t\tprivate exported: Identifier,\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(local, range, loc);\n\t}\n\tgetExported() {\n\t\treturn this.exported;\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.attributes ? node.attributes.map(deserializer) as ImportAttribute[] : void 0,\n\t\t\tnode.range,\n\t\t\tnode.loc\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.attributes?.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 attributes?: ImportAttribute[],\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\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\tgetAttributes() {\n\t\treturn this.attributes;\n\t}\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\tthis.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 ${this.declaration.toString()}`);\n\t\t}\n\t\tconst value = stack.get(declaredName);\n\t\tstack.getModule()!.set(declaredName, value);\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.attributes) {\n\t\t\tconst importAttributes: ImportAttributes = this.attributes\n\t\t\t\t.map(attribute => attribute.get(stack))\n\t\t\t\t.reduce((p, c) => Object.assign(p, c), {});\n\t\t\tif (importAttributes) {\n\t\t\t\timportCallOptions = { with: importAttributes };\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.attributes ? ` with { ${this.attributes.map(attribute => attribute.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\tattributes: this.attributes?.map(attribute => attribute.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(\n\t\t\tdeserializer(node.declaration),\n\t\t\tnode.range,\n\t\t\tnode.loc\n\t\t);\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\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\n\t}\n\tgetDeclaration() {\n\t\treturn this.declaration;\n\t}\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.attributes?.map(deserializer) as ImportAttribute[],\n\t\t\tnode.range,\n\t\t\tnode.loc\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.attributes?.forEach(visitNode);\n\t}\n\tconstructor(\n\t\tprivate source: Literal<string>,\n\t\tprivate exported?: Identifier,\n\t\tprivate attributes?: ImportAttribute[],\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tgetExported() {\n\t\treturn this.exported;\n\t}\n\tgetAttributes() {\n\t\treturn this.attributes;\n\t}\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.attributes) {\n\t\t\tconst importAttributes: ImportAttributes = this.attributes\n\t\t\t\t.map(attribute => attribute.get(stack))\n\t\t\t\t.reduce((p, c) => Object.assign(p, c), {});\n\t\t\tif (importAttributes) {\n\t\t\t\timportCallOptions = { with: importAttributes };\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.getInnerScope(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.attributes ? ` with { ${this.attributes.map(attribute => attribute.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\tattributes: this.attributes?.map(attribute => attribute.toJSON()),\n\t\t};\n\t}\n}\n"]}
|
package/api/module/import.d.ts
CHANGED
|
@@ -86,13 +86,13 @@ export declare class ImportNamespaceSpecifier extends ModuleSpecifier {
|
|
|
86
86
|
export declare class ImportDeclaration extends AbstractExpressionNode {
|
|
87
87
|
private source;
|
|
88
88
|
private specifiers?;
|
|
89
|
-
private
|
|
89
|
+
private attributes?;
|
|
90
90
|
static fromJSON(node: ImportDeclaration, deserializer: NodeDeserializer): ImportDeclaration;
|
|
91
91
|
static visit(node: ImportDeclaration, visitNode: VisitNodeType): void;
|
|
92
|
-
constructor(source: Literal<string>, specifiers?: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[] | undefined,
|
|
92
|
+
constructor(source: Literal<string>, specifiers?: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[] | undefined, attributes?: ImportAttribute[] | undefined, range?: [number, number], loc?: SourceLocation);
|
|
93
93
|
getSource(): Literal<string>;
|
|
94
94
|
getSpecifiers(): (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[] | undefined;
|
|
95
|
-
|
|
95
|
+
getAttributes(): ImportAttribute[] | undefined;
|
|
96
96
|
set(stack: Stack): void;
|
|
97
97
|
get(stack: Stack): void;
|
|
98
98
|
dependency(computed?: true): ExpressionNode[];
|
package/api/module/import.js
CHANGED
|
@@ -209,20 +209,20 @@ let ImportDeclaration = (() => {
|
|
|
209
209
|
}
|
|
210
210
|
source;
|
|
211
211
|
specifiers;
|
|
212
|
-
|
|
212
|
+
attributes;
|
|
213
213
|
static fromJSON(node, deserializer) {
|
|
214
|
-
return new ImportDeclaration(deserializer(node.source), node.specifiers?.map(deserializer), node.
|
|
214
|
+
return new ImportDeclaration(deserializer(node.source), node.specifiers?.map(deserializer), node.attributes?.map(deserializer), node.range, node.loc);
|
|
215
215
|
}
|
|
216
216
|
static visit(node, visitNode) {
|
|
217
217
|
visitNode(node.source);
|
|
218
218
|
node.specifiers?.forEach(visitNode);
|
|
219
|
-
node.
|
|
219
|
+
node.attributes?.forEach(visitNode);
|
|
220
220
|
}
|
|
221
|
-
constructor(source, specifiers,
|
|
221
|
+
constructor(source, specifiers, attributes, range, loc) {
|
|
222
222
|
super(range, loc);
|
|
223
223
|
this.source = source;
|
|
224
224
|
this.specifiers = specifiers;
|
|
225
|
-
this.
|
|
225
|
+
this.attributes = attributes;
|
|
226
226
|
}
|
|
227
227
|
getSource() {
|
|
228
228
|
return this.source;
|
|
@@ -230,20 +230,20 @@ let ImportDeclaration = (() => {
|
|
|
230
230
|
getSpecifiers() {
|
|
231
231
|
return this.specifiers;
|
|
232
232
|
}
|
|
233
|
-
|
|
234
|
-
return this.
|
|
233
|
+
getAttributes() {
|
|
234
|
+
return this.attributes;
|
|
235
235
|
}
|
|
236
236
|
set(stack) {
|
|
237
237
|
throw new Error(`ImportDeclaration.#set() has no implementation.`);
|
|
238
238
|
}
|
|
239
239
|
get(stack) {
|
|
240
240
|
let importCallOptions;
|
|
241
|
-
if (this.
|
|
242
|
-
const
|
|
243
|
-
.map(
|
|
241
|
+
if (this.attributes) {
|
|
242
|
+
const importAttributes = this.attributes
|
|
243
|
+
.map(attribute => attribute.get(stack))
|
|
244
244
|
.reduce((p, c) => Object.assign(p, c), {});
|
|
245
|
-
if (
|
|
246
|
-
importCallOptions = {
|
|
245
|
+
if (importAttributes) {
|
|
246
|
+
importCallOptions = { with: importAttributes };
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
const module = stack.importModule(this.source.get(), importCallOptions);
|
|
@@ -302,13 +302,13 @@ let ImportDeclaration = (() => {
|
|
|
302
302
|
const importSpecifiersString = importSpecifiers.map(importSpecifier => importSpecifier.toString()).join(',');
|
|
303
303
|
parts.push(`{ ${importSpecifiersString} }`);
|
|
304
304
|
}
|
|
305
|
-
return `import ${parts.join(', ')} from ${this.source.toString()}${this.
|
|
305
|
+
return `import ${parts.join(', ')} from ${this.source.toString()}${this.attributes ? ` with { ${this.attributes.map(attribute => attribute.toString()).join(', ')} }` : ''};`;
|
|
306
306
|
}
|
|
307
307
|
toJson() {
|
|
308
308
|
return {
|
|
309
309
|
source: this.source.toJSON(),
|
|
310
310
|
specifiers: this.specifiers?.map(specifier => specifier.toJSON()),
|
|
311
|
-
|
|
311
|
+
attributes: this.attributes?.map(attribute => attribute.toJSON()),
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
314
|
};
|
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;AAE7D,OAAO,EAAmB,eAAe,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;;;;;;;;;;;;;GAgBG;IAEU,eAAe;4BAD3B,YAAY,CAAC,iBAAiB,CAAC;;;;sBACK,eAAe;+BAAvB,S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ACD,cAAc,CAAC,QAAe;YAC7B,OAAO,EAAE,CAAC;QACX,CAAC;QACD,QAAQ;YACP,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;QACvG,CAAC;QACD,MAAM;YACL,OAAO;gBACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;aAC5B,CAAC;QACH,CAAC;;;;SA/CW,gBAAgB","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode, ExpressionEventPath,\n\tVisitNodeType, SourceLocation,\n} from '../expression.js';\nimport type { ModuleScope } 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\tnode.range,\n\t\t\tnode.loc\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(\n\t\tlocal: Identifier,\n\t\tprivate imported: Identifier,\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(local, range, loc);\n\t}\n\tgetImported() {\n\t\treturn this.imported;\n\t}\n\tgetImportedName() {\n\t\treturn this.imported.getName();\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\tnode.range,\n\t\t\tnode.loc\n\t\t);\n\t}\n\tstatic visit(node: ImportDefaultSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\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\tnode.range,\n\t\t\tnode.loc\n\t\t);\n\t}\n\tstatic visit(node: ImportNamespaceSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\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\tnode.range,\n\t\t\tnode.loc\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\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\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\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.getLocalName();\n\t\t\tif (specifier instanceof ImportSpecifier) {\n\t\t\t\tconst imported = specifier.getImportedName();\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\tnode.range,\n\t\t\tnode.loc\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(\n\t\tprivate source: Literal<string>,\n\t\tprivate attributes?: ExpressionNode,\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\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;AAE7D,OAAO,EAAmB,eAAe,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;;;;;;;;;;;;;GAgBG;IAEU,eAAe;4BAD3B,YAAY,CAAC,iBAAiB,CAAC;;;;sBACK,eAAe;+BAAvB,SAAQ,WAAe;;;;YAApD,6KAoDC;;;YApDY,uDAAe;;QAelB,QAAQ;QAdjB,MAAM,CAAC,QAAQ,CAAC,IAAqB,EAAE,YAA8B;YACpE,OAAO,IAAI,eAAe,CACzB,YAAY,CAAC,IAAI,CAAC,KAAK,CAAe,EACtC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAe,EACzC,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,GAAG,CACR,CAAC;QACH,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,IAAqB,EAAE,SAAwB;YAC3D,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC;QACD,YACC,KAAiB,EACT,QAAoB,EAC5B,KAAwB,EACxB,GAAoB;YACpB,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;YAHjB,aAAQ,GAAR,QAAQ,CAAY;QAI7B,CAAC;QACD,WAAW;YACV,OAAO,IAAI,CAAC,QAAQ,CAAC;QACtB,CAAC;QACD,eAAe;YACd,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QAChC,CAAC;QACD,GAAG,CAAC,KAAY,EAAE,KAAU;YAC3B,MAAM,IAAI,KAAK,CAAC,yBAAy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,GAAG,CAAC,KAAY;YACf,IAAI,iBAAgD,CAAC;YACrD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACrB,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAChD,CAAC;YACD,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;YACxE,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;QACD,UAAU,CAAC,QAAe;YACzB,OAAO,EAAE,CAAC;QACX,CAAC;QACD,cAAc,CAAC,QAAe;YAC7B,OAAO,EAAE,CAAC;QACX,CAAC;QACD,QAAQ;YACP,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;QACvG,CAAC;QACD,MAAM;YACL,OAAO;gBACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;aAC5B,CAAC;QACH,CAAC;;;;SA/CW,gBAAgB","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode, ExpressionEventPath,\n\tVisitNodeType, SourceLocation,\n} from '../expression.js';\nimport type { ModuleScope } 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\tnode.range,\n\t\t\tnode.loc\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(\n\t\tlocal: Identifier,\n\t\tprivate imported: Identifier,\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(local, range, loc);\n\t}\n\tgetImported() {\n\t\treturn this.imported;\n\t}\n\tgetImportedName() {\n\t\treturn this.imported.getName();\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\tnode.range,\n\t\t\tnode.loc\n\t\t);\n\t}\n\tstatic visit(node: ImportDefaultSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\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\tnode.range,\n\t\t\tnode.loc\n\t\t);\n\t}\n\tstatic visit(node: ImportNamespaceSpecifier, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.local);\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.attributes?.map(deserializer) as (ImportAttribute)[],\n\t\t\tnode.range,\n\t\t\tnode.loc\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.attributes?.forEach(visitNode);\n\t}\n\tconstructor(\n\t\tprivate source: Literal<string>,\n\t\tprivate specifiers?: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[],\n\t\tprivate attributes?: ImportAttribute[],\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\n\tgetSpecifiers() {\n\t\treturn this.specifiers;\n\t}\n\tgetAttributes() {\n\t\treturn this.attributes;\n\t}\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.attributes) {\n\t\t\tconst importAttributes: ImportAttributes = this.attributes\n\t\t\t\t.map(attribute => attribute.get(stack))\n\t\t\t\t.reduce((p, c) => Object.assign(p, c), {});\n\t\t\tif (importAttributes) {\n\t\t\t\timportCallOptions = { with: importAttributes };\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.getLocalName();\n\t\t\tif (specifier instanceof ImportSpecifier) {\n\t\t\t\tconst imported = specifier.getImportedName();\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.attributes ? ` with { ${this.attributes.map(attribute => attribute.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\tattributes: this.attributes?.map(attribute => attribute.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\tnode.range,\n\t\t\tnode.loc\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(\n\t\tprivate source: Literal<string>,\n\t\tprivate attributes?: ExpressionNode,\n\t\trange?: [number, number],\n\t\tloc?: SourceLocation) {\n\t\tsuper(range, loc);\n\t}\n\tgetSource() {\n\t\treturn this.source;\n\t}\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"]}
|
package/bin/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibyar/expressions",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Aurora expression, an template expression and evaluation, An 100% spec compliant ES2022 JavaScript toolchain,",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ibyar/aurora/tree/dev/packages/expressions",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"contributors": [
|
|
17
17
|
{
|
|
18
18
|
"name": "Muhammad Salem",
|
|
19
|
-
"email": "salem.ebo@gmail.com"
|
|
19
|
+
"email": "salem.ebo@gmail.com",
|
|
20
|
+
"url": "https://github.com/muhammad-salem"
|
|
20
21
|
}
|
|
21
22
|
],
|
|
22
23
|
"main": "./index.js",
|
|
@@ -36,11 +37,11 @@
|
|
|
36
37
|
"access": "public"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@ibyar/decorators": "^
|
|
40
|
+
"@ibyar/decorators": "^4.0.0",
|
|
40
41
|
"tslib": "^2.8.1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"typescript": "^5.
|
|
44
|
+
"typescript": "^5.8.3"
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"build": "tsc --build --verbose",
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"backend",
|
|
66
67
|
"front-end"
|
|
67
68
|
],
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "6671356b7c827061a32d138db5cad660ad0053c5"
|
|
69
70
|
}
|
package/scope/scope.d.ts
CHANGED
|
@@ -108,6 +108,10 @@ export declare class ReactiveScope<T extends Context> extends Scope<T> {
|
|
|
108
108
|
static readOnlyScopeForThis<T extends Context>(ctx: T, propertyKeys?: (keyof T)[]): ReadOnlyScope<{
|
|
109
109
|
this: T;
|
|
110
110
|
}>;
|
|
111
|
+
static readOnlyScopeForAliasThis<T extends Context>(ctx: T, alias: string): ReadOnlyScope<{
|
|
112
|
+
[alias]: T;
|
|
113
|
+
this: T;
|
|
114
|
+
}>;
|
|
111
115
|
protected _clone: T;
|
|
112
116
|
protected _inners: Map<keyof T, ReactiveScope<any>>;
|
|
113
117
|
protected _observer: ValueChangeObserver<T>;
|
package/scope/scope.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/expressions/scope/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AAC/C,MAAM,WAAW,KAAK,CAAC,CAAC,GAAG,OAAO;IAEjC;;;OAGG;IACH,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC;IAE/B;;;;;OAKG;IACH,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;I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,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,UAAU,CAAA;CAChB;AAED,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC7C,MAAM,EAAE,YAAY,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;CACxD;AAED,qBAAa,WAAY,SAAQ,aAAa,CAAC,aAAa,CAAC;gBAChD,OAAO,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,CAAC,MAAM,aAAa,CAAC,EAAE;IAG1E,YAAY,CAAC,WAAW,EAAE,MAAM,aAAa,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;CAKxE;AACD,qBAAa,cAAe,SAAQ,WAAW;IAIlC,OAAO,CAAC,MAAM;IAAU,OAAO,CAAC,iBAAiB,CAAC;IAD9D,OAAO,CAAC,MAAM,CAAe;gBACT,MAAM,EAAE,MAAM,EAAU,iBAAiB,CAAC,EAAE,iBAAiB,YAAA;IAOjF,OAAO,CAAC,aAAa;IAKrB,aAAa;CAGb"}
|
package/scope/scope.js
CHANGED
|
@@ -187,6 +187,17 @@ export class ReactiveScope extends Scope {
|
|
|
187
187
|
rootScope.setInnerScope('this', thisScope);
|
|
188
188
|
return rootScope;
|
|
189
189
|
}
|
|
190
|
+
static readOnlyScopeForAliasThis(ctx, alias) {
|
|
191
|
+
const thisScope = ReactiveScope.for(ctx);
|
|
192
|
+
const thisCtx = {
|
|
193
|
+
'this': ctx,
|
|
194
|
+
[alias]: ctx,
|
|
195
|
+
};
|
|
196
|
+
const rootScope = ReadOnlyScope.for(thisCtx, ['this', alias]);
|
|
197
|
+
rootScope.setInnerScope('this', thisScope);
|
|
198
|
+
rootScope.setInnerScope(alias, thisScope);
|
|
199
|
+
return rootScope;
|
|
200
|
+
}
|
|
190
201
|
_clone;
|
|
191
202
|
_observer = new ValueChangeObserver();
|
|
192
203
|
constructor(context, propertyKeys, _name, _parent) {
|
|
@@ -395,7 +406,7 @@ export class WebModuleScope extends ModuleScope {
|
|
|
395
406
|
this.source = source;
|
|
396
407
|
this.importCallOptions = importCallOptions;
|
|
397
408
|
this.import = import(source
|
|
398
|
-
/*, {
|
|
409
|
+
/*, { with: importCallOptions?.with } */ // TODO: update in future, node16, ESNEXT,ES2022, ES2023, ES2024, ES2025
|
|
399
410
|
).then(module => (this.updateContext(module))).then(() => this._ctx, () => this._ctx);
|
|
400
411
|
}
|
|
401
412
|
updateContext(context) {
|