MCPcopy Create free account
hub / github.com/arktypeio/arktype / keepExport

Method keepExport

ark/aot/flat.ts:813–833  ·  view source on GitHub ↗
(module: SourceModule, name: string)

Source from the content-addressed store, hash-verified

811 }
812
813 private keepExport(module: SourceModule, name: string): void {
814 const key = `${module.id}\0${name}`
815 if (this.exports.has(key)) return
816 this.exports.add(key)
817 const entry = module.scopes.exportsByName[name]
818 if (entry?.kind === "binding")
819 return this.keepBinding(module, entry.binding)
820 if (entry?.kind === "reexport" || entry?.kind === "namespace") {
821 const target = this.targetOf(entry.specifier, module)
822 if (!target) return
823 return entry.kind === "reexport" ?
824 this.keepExport(target, entry.name)
825 : this.keepExports(target)
826 }
827 if (entry) return this.keep(module, statementOf(entry.node))
828 if (name === "default") return
829 for (const specifier of module.scopes.starExports) {
830 const target = this.targetOf(specifier, module)
831 if (target) this.keepExport(target, name)
832 }
833 }
834
835 private keepBinding(module: SourceModule, binding: Binding | undefined) {
836 if (!binding || binding.scope !== module.scopes.root) return

Callers 2

keepExportsMethod · 0.95
keepBindingMethod · 0.95

Calls 7

keepBindingMethod · 0.95
targetOfMethod · 0.95
keepExportsMethod · 0.95
keepMethod · 0.95
statementOfFunction · 0.90
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected