@ibyar/expressions 0.5.6 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/abstract.js +5 -0
- package/api/abstract.js.map +1 -1
- package/api/class/class.d.ts +28 -13
- package/api/class/class.js +46 -41
- package/api/class/class.js.map +1 -1
- package/api/computing/return.d.ts +4 -0
- package/api/computing/return.js +5 -0
- package/api/computing/return.js.map +1 -1
- package/api/computing/throw.d.ts +4 -0
- package/api/computing/throw.js +4 -0
- package/api/computing/throw.js.map +1 -1
- package/api/definition/bind.d.ts +6 -0
- package/api/definition/bind.js +6 -0
- package/api/definition/bind.js.map +1 -1
- package/api/definition/function.js +6 -5
- package/api/definition/function.js.map +1 -1
- package/api/definition/member.js.map +1 -1
- package/api/definition/object.js +1 -1
- package/api/definition/object.js.map +1 -1
- package/api/definition/values.d.ts +12 -3
- package/api/definition/values.js +25 -4
- package/api/definition/values.js.map +1 -1
- package/api/deserialize/deserialize.d.ts +5 -0
- package/api/deserialize/deserialize.js +5 -0
- package/api/deserialize/deserialize.js.map +1 -1
- package/api/expression.d.ts +151 -5
- package/api/expression.js.map +1 -1
- package/api/module/export.d.ts +63 -0
- package/api/module/export.js +64 -1
- package/api/module/export.js.map +1 -1
- package/api/module/import.d.ts +53 -0
- package/api/module/import.js +53 -0
- package/api/module/import.js.map +1 -1
- package/api/operators/grouping.d.ts +7 -0
- package/api/operators/grouping.js +7 -0
- package/api/operators/grouping.js.map +1 -1
- package/api/operators/pipeline.d.ts +12 -0
- package/api/operators/pipeline.js +12 -0
- package/api/operators/pipeline.js.map +1 -1
- package/api/operators/unary.js +3 -0
- package/api/operators/unary.js.map +1 -1
- package/api/program.d.ts +2 -2
- package/api/program.js.map +1 -1
- package/api/statement/control/block.d.ts +4 -0
- package/api/statement/control/block.js +4 -0
- package/api/statement/control/block.js.map +1 -1
- package/api/statement/control/empty.d.ts +7 -0
- package/api/statement/control/empty.js +7 -0
- package/api/statement/control/empty.js.map +1 -1
- package/api/statement/control/if.d.ts +5 -0
- package/api/statement/control/if.js +5 -0
- package/api/statement/control/if.js.map +1 -1
- package/api/statement/control/switch.d.ts +6 -0
- package/api/statement/control/switch.js +9 -0
- package/api/statement/control/switch.js.map +1 -1
- package/api/statement/control/terminate.d.ts +8 -0
- package/api/statement/control/terminate.js +8 -0
- package/api/statement/control/terminate.js.map +1 -1
- package/api/statement/iterations/for.d.ts +5 -0
- package/api/statement/iterations/for.js +13 -0
- package/api/statement/iterations/for.js.map +1 -1
- package/api/statement/iterations/while.d.ts +6 -0
- package/api/statement/iterations/while.js +10 -0
- package/api/statement/iterations/while.js.map +1 -1
- package/package.json +5 -3
- package/scope/event.d.ts +3 -3
- package/scope/event.js +2 -2
- package/scope/event.js.map +1 -1
- package/scope/pool.d.ts +7 -0
- package/scope/pool.js +29 -0
- package/scope/pool.js.map +1 -0
- package/scope/proxy.d.ts +6 -9
- package/scope/proxy.js +22 -31
- package/scope/proxy.js.map +1 -1
- package/scope/scope.d.ts +161 -38
- package/scope/scope.js +260 -106
- package/scope/scope.js.map +1 -1
- package/scope/stack.d.ts +95 -19
- package/scope/stack.js +13 -0
- package/scope/stack.js.map +1 -1
- package/v8/enums.js +31 -0
- package/v8/enums.js.map +1 -1
- package/v8/inline.d.ts +36 -0
- package/v8/inline.js +407 -5
- package/v8/inline.js.map +1 -1
- package/v8/nodes.js +2 -1
- package/v8/nodes.js.map +1 -1
- package/v8/parser.d.ts +8 -0
- package/v8/parser.js +304 -1
- package/v8/parser.js.map +1 -1
- package/v8/stream.d.ts +4 -0
- package/v8/stream.js +79 -17
- package/v8/stream.js.map +1 -1
- package/v8/token.d.ts +229 -0
- package/v8/token.js +236 -1
- package/v8/token.js.map +1 -1
- package/visit/visitor.d.ts +3 -0
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":";;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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"]}
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../../src/expressions/api/module/export.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;AAMH,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;AAK/D;;;;;;;;;;;;;GAaG;AAEH,IAAa,eAAe,uBAA5B,MAAa,eAAgB,SAAQ,eAAe;IAWnD,YAAY,KAAiB,EAAU,QAAoB;QAC1D,KAAK,CAAC,KAAK,CAAC,CAAC;QADyB,aAAQ,GAA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,CAAC,QAAe;QAC7B,OAAO,EAAE,CAAC;IACX,CAAC;IACD,QAAQ;QACP,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,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;IACxN,CAAC;IACD,MAAM;QACL,OAAO;YACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAC5B,QAAQ,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.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"]}
|
package/api/module/import.d.ts
CHANGED
|
@@ -4,6 +4,23 @@ import type { Stack } from '../../scope/stack.js';
|
|
|
4
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
5
5
|
import { Identifier, Literal } from '../definition/values.js';
|
|
6
6
|
import { ImportAttribute, ModuleSpecifier } from './common.js';
|
|
7
|
+
/**
|
|
8
|
+
* An imported variable binding,
|
|
9
|
+
*
|
|
10
|
+
* e.g., {foo} in import {foo} from "mod"
|
|
11
|
+
* or {foo as bar} in import {foo as bar} from "mod".
|
|
12
|
+
*
|
|
13
|
+
* The imported field refers to the name of the export imported from the module.
|
|
14
|
+
*
|
|
15
|
+
* The local field refers to the binding imported into the local module scope.
|
|
16
|
+
*
|
|
17
|
+
* If it is a basic named import, such as in import {foo} from "mod",
|
|
18
|
+
* both imported and local are equivalent Identifier nodes; in this case an Identifier node representing foo.
|
|
19
|
+
*
|
|
20
|
+
* If it is an aliased import, such as in import {foo as bar} from "mod",
|
|
21
|
+
* the imported field is an Identifier node representing foo,
|
|
22
|
+
* and the local field is an Identifier node representing bar.
|
|
23
|
+
*/
|
|
7
24
|
export declare class ImportSpecifier extends ModuleSpecifier {
|
|
8
25
|
private imported;
|
|
9
26
|
static fromJSON(node: ImportSpecifier, deserializer: NodeDeserializer): ImportSpecifier;
|
|
@@ -18,6 +35,9 @@ export declare class ImportSpecifier extends ModuleSpecifier {
|
|
|
18
35
|
toString(): string;
|
|
19
36
|
toJson(): object;
|
|
20
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* A default import specifier, e.g., `foo` in `import foo from "mod.js";`.
|
|
40
|
+
*/
|
|
21
41
|
export declare class ImportDefaultSpecifier extends ModuleSpecifier {
|
|
22
42
|
static fromJSON(node: ImportDefaultSpecifier, deserializer: NodeDeserializer): ImportDefaultSpecifier;
|
|
23
43
|
static visit(node: ImportDefaultSpecifier, visitNode: VisitNodeType): void;
|
|
@@ -28,6 +48,9 @@ export declare class ImportDefaultSpecifier extends ModuleSpecifier {
|
|
|
28
48
|
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
29
49
|
toString(): string;
|
|
30
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* A namespace import specifier, e.g., `* as foo` in `import * as foo from "mod.js";`.
|
|
53
|
+
*/
|
|
31
54
|
export declare class ImportNamespaceSpecifier extends ModuleSpecifier {
|
|
32
55
|
static fromJSON(node: ImportNamespaceSpecifier, deserializer: NodeDeserializer): ImportNamespaceSpecifier;
|
|
33
56
|
static visit(node: ImportNamespaceSpecifier, visitNode: VisitNodeType): void;
|
|
@@ -38,6 +61,30 @@ export declare class ImportNamespaceSpecifier extends ModuleSpecifier {
|
|
|
38
61
|
dependencyPath(computed?: true): ExpressionEventPath[];
|
|
39
62
|
toString(): string;
|
|
40
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* An import declaration, e.g., import foo from "mod";.
|
|
66
|
+
*
|
|
67
|
+
* import defaultExport from "module-name";
|
|
68
|
+
*
|
|
69
|
+
* import * as name from "module-name";
|
|
70
|
+
*
|
|
71
|
+
* import { export1 } from "module-name";
|
|
72
|
+
*
|
|
73
|
+
* import { export1 as alias1 } from "module-name";
|
|
74
|
+
*
|
|
75
|
+
* import { export1 , export2 } from "module-name";
|
|
76
|
+
*
|
|
77
|
+
* import { foo , bar } from "module-name/path/to/specific/un-exported/file";
|
|
78
|
+
*
|
|
79
|
+
* import { export1 , export2 as alias2 , [...] } from "module-name";
|
|
80
|
+
*
|
|
81
|
+
* import defaultExport, { export1 [ , [...] ] } from "module-name";
|
|
82
|
+
*
|
|
83
|
+
* import defaultExport, * as name from "module-name";
|
|
84
|
+
*
|
|
85
|
+
* import "module-name";
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
41
88
|
export declare class ImportDeclaration extends AbstractExpressionNode {
|
|
42
89
|
private source;
|
|
43
90
|
private specifiers?;
|
|
@@ -56,6 +103,12 @@ export declare class ImportDeclaration extends AbstractExpressionNode {
|
|
|
56
103
|
toString(): string;
|
|
57
104
|
toJson(): object;
|
|
58
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* `ImportExpression` node represents Dynamic Imports such as `import(source)`.
|
|
108
|
+
* The `source` property is the importing source as similar to ImportDeclaration node,
|
|
109
|
+
* but it can be an arbitrary expression node.
|
|
110
|
+
* var promise = import("module-name");
|
|
111
|
+
*/
|
|
59
112
|
export declare class ImportExpression extends AbstractExpressionNode {
|
|
60
113
|
private source;
|
|
61
114
|
private attributes?;
|
package/api/module/import.js
CHANGED
|
@@ -4,6 +4,23 @@ import { AbstractExpressionNode } from '../abstract.js';
|
|
|
4
4
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
5
5
|
import { Identifier, Literal } from '../definition/values.js';
|
|
6
6
|
import { ModuleSpecifier } from './common.js';
|
|
7
|
+
/**
|
|
8
|
+
* An imported variable binding,
|
|
9
|
+
*
|
|
10
|
+
* e.g., {foo} in import {foo} from "mod"
|
|
11
|
+
* or {foo as bar} in import {foo as bar} from "mod".
|
|
12
|
+
*
|
|
13
|
+
* The imported field refers to the name of the export imported from the module.
|
|
14
|
+
*
|
|
15
|
+
* The local field refers to the binding imported into the local module scope.
|
|
16
|
+
*
|
|
17
|
+
* If it is a basic named import, such as in import {foo} from "mod",
|
|
18
|
+
* both imported and local are equivalent Identifier nodes; in this case an Identifier node representing foo.
|
|
19
|
+
*
|
|
20
|
+
* If it is an aliased import, such as in import {foo as bar} from "mod",
|
|
21
|
+
* the imported field is an Identifier node representing foo,
|
|
22
|
+
* and the local field is an Identifier node representing bar.
|
|
23
|
+
*/
|
|
7
24
|
let ImportSpecifier = ImportSpecifier_1 = class ImportSpecifier extends ModuleSpecifier {
|
|
8
25
|
constructor(local, imported) {
|
|
9
26
|
super(local);
|
|
@@ -53,6 +70,9 @@ ImportSpecifier = ImportSpecifier_1 = __decorate([
|
|
|
53
70
|
__metadata("design:paramtypes", [Identifier, Identifier])
|
|
54
71
|
], ImportSpecifier);
|
|
55
72
|
export { ImportSpecifier };
|
|
73
|
+
/**
|
|
74
|
+
* A default import specifier, e.g., `foo` in `import foo from "mod.js";`.
|
|
75
|
+
*/
|
|
56
76
|
let ImportDefaultSpecifier = ImportDefaultSpecifier_1 = class ImportDefaultSpecifier extends ModuleSpecifier {
|
|
57
77
|
static fromJSON(node, deserializer) {
|
|
58
78
|
return new ImportDefaultSpecifier_1(deserializer(node.local));
|
|
@@ -82,6 +102,9 @@ ImportDefaultSpecifier = ImportDefaultSpecifier_1 = __decorate([
|
|
|
82
102
|
Deserializer('ImportDefaultSpecifier')
|
|
83
103
|
], ImportDefaultSpecifier);
|
|
84
104
|
export { ImportDefaultSpecifier };
|
|
105
|
+
/**
|
|
106
|
+
* A namespace import specifier, e.g., `* as foo` in `import * as foo from "mod.js";`.
|
|
107
|
+
*/
|
|
85
108
|
let ImportNamespaceSpecifier = ImportNamespaceSpecifier_1 = class ImportNamespaceSpecifier extends ModuleSpecifier {
|
|
86
109
|
static fromJSON(node, deserializer) {
|
|
87
110
|
return new ImportNamespaceSpecifier_1(deserializer(node.local));
|
|
@@ -111,6 +134,30 @@ ImportNamespaceSpecifier = ImportNamespaceSpecifier_1 = __decorate([
|
|
|
111
134
|
Deserializer('ImportNamespaceSpecifier')
|
|
112
135
|
], ImportNamespaceSpecifier);
|
|
113
136
|
export { ImportNamespaceSpecifier };
|
|
137
|
+
/**
|
|
138
|
+
* An import declaration, e.g., import foo from "mod";.
|
|
139
|
+
*
|
|
140
|
+
* import defaultExport from "module-name";
|
|
141
|
+
*
|
|
142
|
+
* import * as name from "module-name";
|
|
143
|
+
*
|
|
144
|
+
* import { export1 } from "module-name";
|
|
145
|
+
*
|
|
146
|
+
* import { export1 as alias1 } from "module-name";
|
|
147
|
+
*
|
|
148
|
+
* import { export1 , export2 } from "module-name";
|
|
149
|
+
*
|
|
150
|
+
* import { foo , bar } from "module-name/path/to/specific/un-exported/file";
|
|
151
|
+
*
|
|
152
|
+
* import { export1 , export2 as alias2 , [...] } from "module-name";
|
|
153
|
+
*
|
|
154
|
+
* import defaultExport, { export1 [ , [...] ] } from "module-name";
|
|
155
|
+
*
|
|
156
|
+
* import defaultExport, * as name from "module-name";
|
|
157
|
+
*
|
|
158
|
+
* import "module-name";
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
114
161
|
let ImportDeclaration = ImportDeclaration_1 = class ImportDeclaration extends AbstractExpressionNode {
|
|
115
162
|
constructor(source, specifiers, assertions) {
|
|
116
163
|
super();
|
|
@@ -220,6 +267,12 @@ ImportDeclaration = ImportDeclaration_1 = __decorate([
|
|
|
220
267
|
__metadata("design:paramtypes", [Literal, Array, Array])
|
|
221
268
|
], ImportDeclaration);
|
|
222
269
|
export { ImportDeclaration };
|
|
270
|
+
/**
|
|
271
|
+
* `ImportExpression` node represents Dynamic Imports such as `import(source)`.
|
|
272
|
+
* The `source` property is the importing source as similar to ImportDeclaration node,
|
|
273
|
+
* but it can be an arbitrary expression node.
|
|
274
|
+
* var promise = import("module-name");
|
|
275
|
+
*/
|
|
223
276
|
let ImportExpression = ImportExpression_1 = class ImportExpression extends AbstractExpressionNode {
|
|
224
277
|
constructor(source, attributes) {
|
|
225
278
|
super();
|
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,EAA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C;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
|
+
{"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;AAE/D;;;;;;;;;;;;;;;;GAgBG;AAEH,IAAa,eAAe,uBAA5B,MAAa,eAAgB,SAAQ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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"]}
|
|
@@ -2,6 +2,13 @@ import type { NodeDeserializer, ExpressionNode, ExpressionEventPath, VisitNodeTy
|
|
|
2
2
|
import type { Scope } from '../../scope/scope.js';
|
|
3
3
|
import type { Stack } from '../../scope/stack.js';
|
|
4
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
5
|
+
/**
|
|
6
|
+
* The grouping operator consists of a pair of parentheses around
|
|
7
|
+
* an expression or sub-expression to override the normal operator
|
|
8
|
+
* precedence so that expressions with lower precedence can be evaluated
|
|
9
|
+
* before an expression with higher priority.
|
|
10
|
+
* As it sounds, it groups what's inside of the parentheses.
|
|
11
|
+
*/
|
|
5
12
|
export declare class GroupingExpression extends AbstractExpressionNode {
|
|
6
13
|
private node;
|
|
7
14
|
static fromJSON(node: GroupingExpression, deserializer: NodeDeserializer): GroupingExpression;
|
|
@@ -2,6 +2,13 @@ var GroupingExpression_1;
|
|
|
2
2
|
import { __decorate, __metadata } from "tslib";
|
|
3
3
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
4
4
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
5
|
+
/**
|
|
6
|
+
* The grouping operator consists of a pair of parentheses around
|
|
7
|
+
* an expression or sub-expression to override the normal operator
|
|
8
|
+
* precedence so that expressions with lower precedence can be evaluated
|
|
9
|
+
* before an expression with higher priority.
|
|
10
|
+
* As it sounds, it groups what's inside of the parentheses.
|
|
11
|
+
*/
|
|
5
12
|
let GroupingExpression = GroupingExpression_1 = class GroupingExpression extends AbstractExpressionNode {
|
|
6
13
|
constructor(node) {
|
|
7
14
|
super();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grouping.js","sourceRoot":"","sources":["../../../../src/expressions/api/operators/grouping.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"grouping.js","sourceRoot":"","sources":["../../../../src/expressions/api/operators/grouping.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;;;;;GAMG;AAEH,IAAa,kBAAkB,0BAA/B,MAAa,kBAAmB,SAAQ,sBAAsB;IAO7D,YAAoB,IAAoB;QACvC,KAAK,EAAE,CAAC;QADW,SAAI,GAAJ,IAAI,CAAgB;IAExC,CAAC;IARD,MAAM,CAAC,QAAQ,CAAC,IAAwB,EAAE,YAA8B;QACvE,OAAO,IAAI,oBAAkB,CAAC,YAAY,CAAC,IAAI,CAAC,IAAW,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,IAAwB,EAAE,SAAwB;QAC9D,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAID,OAAO;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IACD,cAAc,CAAC,SAAuB;QACrC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IACD,GAAG,CAAC,KAAY,EAAE,KAAU;QAC3B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,GAAG,CAAC,KAAY;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IACD,UAAU,CAAC,QAAe;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IACD,cAAc,CAAC,QAAe;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IACD,QAAQ;QACP,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC;IACpC,CAAC;IACD,MAAM;QACL,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;IACrC,CAAC;CACD,CAAA;AAlCY,kBAAkB;IAD9B,YAAY,CAAC,oBAAoB,CAAC;;GACtB,kBAAkB,CAkC9B;SAlCY,kBAAkB","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode,\n\tExpressionEventPath, VisitNodeType\n} from '../expression.js';\nimport type { Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\n\n/**\n * The grouping operator consists of a pair of parentheses around\n * an expression or sub-expression to override the normal operator\n * precedence so that expressions with lower precedence can be evaluated\n * before an expression with higher priority.\n * As it sounds, it groups what's inside of the parentheses.\n */\n@Deserializer('GroupingExpression')\nexport class GroupingExpression extends AbstractExpressionNode {\n\tstatic fromJSON(node: GroupingExpression, deserializer: NodeDeserializer): GroupingExpression {\n\t\treturn new GroupingExpression(deserializer(node.node as any));\n\t}\n\tstatic visit(node: GroupingExpression, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.node);\n\t}\n\tconstructor(private node: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetNode() {\n\t\treturn this.node;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.node.shareVariables(scopeList);\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthis.node.set(stack, value);\n\t}\n\tget(stack: Stack,) {\n\t\treturn this.node.get(stack);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.node.dependency(computed);\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.node.dependencyPath(computed);\n\t}\n\ttoString(): string {\n\t\treturn `(${this.node.toString()})`;\n\t}\n\ttoJson(): object {\n\t\treturn { node: this.node.toJSON() };\n\t}\n}\n"]}
|
|
@@ -2,6 +2,18 @@ import type { NodeDeserializer, ExpressionNode, ExpressionEventPath, VisitNodeTy
|
|
|
2
2
|
import type { Scope } from '../../scope/scope.js';
|
|
3
3
|
import type { Stack } from '../../scope/stack.js';
|
|
4
4
|
import { AbstractExpressionNode } from '../abstract.js';
|
|
5
|
+
/**
|
|
6
|
+
* pipeline ('|>') operator support syntax:
|
|
7
|
+
* param |> func
|
|
8
|
+
* param |> func:arg1:arg2:arg3
|
|
9
|
+
* param |> func:arg1:?:arg3
|
|
10
|
+
* param |> func:arg1:?:arg3:?:arg5
|
|
11
|
+
* param |> func:arg1:...?:arg3
|
|
12
|
+
*
|
|
13
|
+
* param |> func(arg1, arg2, arg3)
|
|
14
|
+
* param |> func(arg1, ?, arg3)
|
|
15
|
+
* param |> func(arg1, ?, arg3, arg4, ?, arg6)
|
|
16
|
+
*/
|
|
5
17
|
export declare class PipelineExpression extends AbstractExpressionNode {
|
|
6
18
|
private left;
|
|
7
19
|
private right;
|
|
@@ -4,6 +4,18 @@ import { AbstractExpressionNode } from '../abstract.js';
|
|
|
4
4
|
import { Deserializer } from '../deserialize/deserialize.js';
|
|
5
5
|
import { SpreadElement } from '../computing/spread.js';
|
|
6
6
|
import { MemberExpression } from '../definition/member.js';
|
|
7
|
+
/**
|
|
8
|
+
* pipeline ('|>') operator support syntax:
|
|
9
|
+
* param |> func
|
|
10
|
+
* param |> func:arg1:arg2:arg3
|
|
11
|
+
* param |> func:arg1:?:arg3
|
|
12
|
+
* param |> func:arg1:?:arg3:?:arg5
|
|
13
|
+
* param |> func:arg1:...?:arg3
|
|
14
|
+
*
|
|
15
|
+
* param |> func(arg1, arg2, arg3)
|
|
16
|
+
* param |> func(arg1, ?, arg3)
|
|
17
|
+
* param |> func(arg1, ?, arg3, arg4, ?, arg6)
|
|
18
|
+
*/
|
|
7
19
|
let PipelineExpression = PipelineExpression_1 = class PipelineExpression extends AbstractExpressionNode {
|
|
8
20
|
constructor(left, right, params = []) {
|
|
9
21
|
super();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../../src/expressions/api/operators/pipeline.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../../src/expressions/api/operators/pipeline.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;A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,CACnD,CAAC;IACJ,CAAC;IACD,QAAQ;QACP,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IAC7H,CAAC;IACD,MAAM;QACL,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACxB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;YAC1B,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;SAClF,CAAC;IACH,CAAC;CACD,CAAA;AA9FY,kBAAkB;IAD9B,YAAY,CAAC,oBAAoB,CAAC;;GACtB,kBAAkB,CA8F9B;SA9FY,kBAAkB","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode,\n\tExpressionEventPath, VisitNodeType\n} from '../expression.js';\nimport type { Scope } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { SpreadElement } from '../computing/spread.js';\nimport { MemberExpression } from '../definition/member.js';\n\n/**\n * pipeline ('|>') operator support syntax:\n * param |> func\n * param |> func:arg1:arg2:arg3\n * param |> func:arg1:?:arg3\n * param |> func:arg1:?:arg3:?:arg5\n * param |> func:arg1:...?:arg3\n * \n * param |> func(arg1, arg2, arg3)\n * param |> func(arg1, ?, arg3)\n * param |> func(arg1, ?, arg3, arg4, ?, arg6)\n */\n@Deserializer('PipelineExpression')\nexport class PipelineExpression extends AbstractExpressionNode {\n\tstatic fromJSON(node: PipelineExpression, deserializer: NodeDeserializer): PipelineExpression {\n\t\treturn new PipelineExpression(\n\t\t\tdeserializer(node.left),\n\t\t\tdeserializer(node.right),\n\t\t\tnode.arguments.map(arg => typeof arg === 'string' ? arg : deserializer(arg))\n\t\t);\n\t}\n\tstatic visit(node: PipelineExpression, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.left);\n\t\tvisitNode(node.right);\n\t\tnode.arguments.forEach(arg => typeof arg == 'object' && visitNode(arg));\n\t}\n\tprivate arguments: (ExpressionNode | '?' | '...?')[];\n\tconstructor(private left: ExpressionNode, private right: ExpressionNode, params: (ExpressionNode | '?' | '...?')[] = []) {\n\t\tsuper();\n\t\tthis.arguments = params;\n\t}\n\tgetLeft() {\n\t\treturn this.left;\n\t}\n\tgetRight() {\n\t\treturn this.right;\n\t}\n\tgetArguments() {\n\t\treturn this.arguments;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.left.shareVariables(scopeList);\n\t\tthis.right.shareVariables(scopeList);\n\t\t(this.arguments\n\t\t\t.filter(param => typeof param !== 'string') as ExpressionNode[])\n\t\t\t.forEach(param => param.shareVariables(scopeList))\n\t}\n\tset(stack: Stack, value: any) {\n\t\tthrow new Error(`PipelineNode#set() has no implementation.`);\n\t}\n\tget(stack: Stack) {\n\t\tconst paramValue = this.left.get(stack);\n\t\tconst parameters: any[] = [];\n\t\tlet indexed = false;\n\t\tfor (const arg of this.arguments) {\n\t\t\tif (arg === '?') {\n\t\t\t\tparameters.push(paramValue);\n\t\t\t\tindexed = true;\n\t\t\t} else if (arg === '...?') {\n\t\t\t\tparameters.push(...paramValue);\n\t\t\t\tindexed = true;\n\t\t\t} else {\n\t\t\t\tif (arg instanceof SpreadElement) {\n\t\t\t\t\tconst paramScope = stack.pushBlockScopeFor(parameters);\n\t\t\t\t\targ.get(stack);\n\t\t\t\t\tstack.clearTo(paramScope);\n\t\t\t\t} else {\n\t\t\t\t\tparameters.push(arg.get(stack));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!indexed) {\n\t\t\tparameters.unshift(paramValue);\n\t\t}\n\t\tconst funCallBack = this.right.get(stack) as Function;\n\t\tif (this.right instanceof MemberExpression) {\n\t\t\tconst thisArg = this.right.getObject().get(stack);\n\t\t\treturn funCallBack.apply(thisArg, parameters);\n\t\t}\n\t\treturn funCallBack(...parameters);\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.right.dependency(computed)\n\t\t\t.concat(\n\t\t\t\tthis.left.dependency(computed),\n\t\t\t\t(this.arguments.filter(arg => (arg !== '?' && arg !== '...?')) as ExpressionNode[])\n\t\t\t\t\t.flatMap(param => param.dependency!(computed))\n\t\t\t);\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.right.dependencyPath(computed)\n\t\t\t.concat(\n\t\t\t\tthis.left.dependencyPath(computed),\n\t\t\t\t(this.arguments.filter(arg => (arg !== '?' && arg !== '...?')) as ExpressionNode[])\n\t\t\t\t\t.flatMap(param => param.dependencyPath!(computed))\n\t\t\t);\n\t}\n\ttoString() {\n\t\treturn `${this.left.toString()} |> ${this.right.toString()}${this.arguments.flatMap(arg => `:${arg.toString()}`).join('')}`;\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\tleft: this.left.toJSON(),\n\t\t\tright: this.right.toJSON(),\n\t\t\targuments: this.arguments.map(arg => typeof arg === 'string' ? arg : arg.toJSON())\n\t\t};\n\t}\n}\n"]}
|
package/api/operators/unary.js
CHANGED
|
@@ -42,12 +42,15 @@ let UnaryExpression = UnaryExpression_1 = class UnaryExpression extends Abstract
|
|
|
42
42
|
let propertyKey;
|
|
43
43
|
const right = this.argument.getProperty();
|
|
44
44
|
if (right instanceof MemberExpression) {
|
|
45
|
+
// [Symbol.asyncIterator]
|
|
45
46
|
propertyKey = this.argument.getProperty().get(stack);
|
|
46
47
|
}
|
|
47
48
|
else if (right instanceof Literal) {
|
|
49
|
+
// x[10], x['string'], x.name
|
|
48
50
|
propertyKey = right.getValue();
|
|
49
51
|
}
|
|
50
52
|
else {
|
|
53
|
+
// x[u == 3 ? 'y': 'n']
|
|
51
54
|
propertyKey = this.argument.getProperty().get(stack);
|
|
52
55
|
}
|
|
53
56
|
return scope.delete(propertyKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unary.js","sourceRoot":"","sources":["../../../../src/expressions/api/operators/unary.ts"],"names":[],"mappings":";;AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIlD,IAAa,eAAe,uBAA5B,MAAa,eAAgB,SAAQ,sBAAsB;IAe1D,YAAoB,QAAuB,EAAU,QAAwB;QAC5E,KAAK,EAAE,CAAC;QADW,aAAQ,GAAR,QAAQ,CAAe;QAAU,aAAQ,GAAR,QAAQ,CAAgB;IAE7E,CAAC;IAhBD,MAAM,CAAC,QAAQ,CAAC,IAAqB,EAAE,YAA8B;QACpE,OAAO,IAAI,iBAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxE,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,IAAqB,EAAE,SAAwB;QAC3D,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IAYD,WAAW;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IACD,WAAW;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IACD,cAAc,CAAC,SAAuB;QACrC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IACD,GAAG,CAAC,KAAY,EA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AO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,GAAG,EAAE,CAAC,KAAa,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1C,GAAG,EAAE,CAAC,KAAU,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,MAAM,EAAE,CAAC,KAAU,EAAE,EAAE,GAAG,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC;IAC9C,QAAQ,EAAE,CAAC,KAAU,EAAE,EAAE,GAAG,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC;CACjD,CAAA;AAdU,eAAe;IAD3B,YAAY,CAAC,iBAAiB,CAAC;;GACnB,eAAe,CAgF3B;SAhFY,eAAe","sourcesContent":["import type {\n\tNodeDeserializer, ExpressionNode,\n\tExpressionEventPath, VisitNodeType\n} from '../expression.js';\nimport type { Scope, Context } from '../../scope/scope.js';\nimport type { Stack } from '../../scope/stack.js';\nimport { Deserializer } from '../deserialize/deserialize.js';\nimport { AbstractExpressionNode } from '../abstract.js';\nimport { MemberExpression } from '../definition/member.js';\nimport { Literal } from '../definition/values.js';\n\nexport type UnaryOperator = '-' | '+' | '~' | '!' | 'void' | 'delete' | 'typeof';\n@Deserializer('UnaryExpression')\nexport class UnaryExpression extends AbstractExpressionNode {\n\tstatic fromJSON(node: UnaryExpression, deserializer: NodeDeserializer): UnaryExpression {\n\t\treturn new UnaryExpression(node.operator, deserializer(node.argument));\n\t}\n\tstatic visit(node: UnaryExpression, visitNode: VisitNodeType): void {\n\t\tvisitNode(node.argument);\n\t}\n\tstatic Evaluations: { [key: string]: (value: any) => any } = {\n\t\t'+': (value: string) => { return +value; },\n\t\t'-': (value: number) => { return -value; },\n\t\t'~': (value: number) => { return ~value; },\n\t\t'!': (value: any) => { return !value; },\n\t\t'void': (value: any) => { return void value; },\n\t\t'typeof': (value: any) => { return typeof value; },\n\t};\n\tconstructor(private operator: UnaryOperator, private argument: ExpressionNode) {\n\t\tsuper();\n\t}\n\tgetOperator() {\n\t\treturn this.operator;\n\t}\n\tgetArgument() {\n\t\treturn this.argument;\n\t}\n\tshareVariables(scopeList: Scope<any>[]): void {\n\t\tthis.argument.shareVariables(scopeList);\n\t}\n\tset(stack: Stack, value: any) {\n\t\treturn this.argument.set(stack, value);\n\t}\n\tget(stack: Stack, thisContext?: any) {\n\t\tswitch (this.operator) {\n\t\t\tcase 'delete': return this.executeDelete(stack, thisContext);\n\t\t\tdefault:\n\t\t\t\tconst value = this.argument.get(stack);\n\t\t\t\treturn UnaryExpression.Evaluations[this.operator](value);\n\t\t}\n\t}\n\tprivate executeDelete(stack: Stack, thisContext?: any): boolean {\n\t\tif (this.argument instanceof MemberExpression) {\n\t\t\tconst scope = this.argument.findScope<Context>(stack);\n\t\t\tlet propertyKey: PropertyKey;\n\t\t\tconst right = this.argument.getProperty();\n\t\t\tif (right instanceof MemberExpression) {\n\t\t\t\t// [Symbol.asyncIterator]\n\t\t\t\tpropertyKey = this.argument.getProperty().get(stack);\n\t\t\t} else if (right instanceof Literal) {\n\t\t\t\t// x[10], x['string'], x.name\n\t\t\t\tpropertyKey = right.getValue();\n\t\t\t} else {\n\t\t\t\t// x[u == 3 ? 'y': 'n']\n\t\t\t\tpropertyKey = this.argument.getProperty().get(stack);\n\t\t\t}\n\t\t\treturn scope.delete(propertyKey);\n\t\t}\n\t\treturn false;\n\t}\n\tdependency(computed?: true): ExpressionNode[] {\n\t\treturn this.argument.dependency(computed);\n\t}\n\tdependencyPath(computed?: true): ExpressionEventPath[] {\n\t\treturn this.argument.dependencyPath(computed);\n\t}\n\ttoString() {\n\t\tswitch (this.operator) {\n\t\t\tcase 'void':\n\t\t\tcase 'delete':\n\t\t\tcase 'typeof':\n\t\t\t\treturn `${this.operator} ${this.argument.toString()}`;\n\t\t\tdefault:\n\t\t\t\treturn `${this.operator}${this.argument.toString()}`;\n\t\t}\n\t}\n\ttoJson(): object {\n\t\treturn {\n\t\t\toperator: this.operator,\n\t\t\targument: this.argument.toJSON(),\n\t\t\tprefix: true\n\t\t};\n\t}\n}\n"]}
|
package/api/program.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExpressionEventPath, ExpressionNode, NodeDeserializer, VisitNodeType } from './expression.js';
|
|
2
|
-
import type { Scope,
|
|
2
|
+
import type { Scope, Context } from '../scope/scope.js';
|
|
3
3
|
import type { Stack } from '../scope/stack.js';
|
|
4
4
|
import { AbstractExpressionNode } from './abstract.js';
|
|
5
5
|
export declare type ProgramSourceType = 'script' | 'module';
|
|
@@ -9,7 +9,7 @@ export declare class Program extends AbstractExpressionNode {
|
|
|
9
9
|
static fromJSON(node: Program, deserializer: NodeDeserializer): Program;
|
|
10
10
|
static visit(node: Program, visitNode: VisitNodeType): void;
|
|
11
11
|
constructor(sourceType: ProgramSourceType, body: ExpressionNode[]);
|
|
12
|
-
shareVariables(scopeList: Scope<
|
|
12
|
+
shareVariables(scopeList: Scope<Context>[]): void;
|
|
13
13
|
set(stack: Stack, value: any): any;
|
|
14
14
|
get(stack: Stack): any;
|
|
15
15
|
dependency(computed?: true): ExpressionNode[];
|
package/api/program.js.map
CHANGED
|
@@ -1 +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,IA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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, Context } 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<Context>[]): 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"]}
|