| | |
| | | /** @typedef {import("../Generator").GenerateContext} GenerateContext */ |
| | | /** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */ |
| | | /** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */ |
| | | /** @typedef {Map<string, Set<string>>} ImportSpecifiers */ |
| | | /** @typedef {{ name: string, value?: string }[]} ArrayImportSpecifiers */ |
| | | /** @typedef {Set<string>} ImportSpecifier */ |
| | | /** @typedef {Map<string, ImportSpecifier>} ImportSpecifiers */ |
| | | |
| | | /** |
| | | * @extends {InitFragment<GenerateContext>} |
| | |
| | | class ExternalModuleInitFragment extends InitFragment { |
| | | /** |
| | | * @param {string} importedModule imported module |
| | | * @param {{ name: string, value?: string }[] | ImportSpecifiers} specifiers import specifiers |
| | | * @param {ArrayImportSpecifiers | ImportSpecifiers} specifiers import specifiers |
| | | * @param {string=} defaultImport default import |
| | | */ |
| | | constructor(importedModule, specifiers, defaultImport) { |
| | |
| | | for (const { name, value } of specifiers) { |
| | | let specifiers = this.specifiers.get(name); |
| | | if (!specifiers) { |
| | | /** @type {ImportSpecifier} */ |
| | | specifiers = new Set(); |
| | | this.specifiers.set(name, specifiers); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns the source code that will be included as initialization code. |
| | | * @param {GenerateContext} context context |
| | | * @returns {string | Source | undefined} the source code that will be included as initialization code |
| | | */ |
| | | getContent({ runtimeRequirements }) { |
| | | /** @type {string[]} */ |
| | | const namedImports = []; |
| | | |
| | | for (const [name, specifiers] of this.specifiers) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Serializes this instance into the provided serializer context. |
| | | * @param {ObjectSerializerContext} context context |
| | | */ |
| | | serialize(context) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Restores this instance from the provided deserializer context. |
| | | * @param {ObjectDeserializerContext} context context |
| | | */ |
| | | deserialize(context) { |