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

Method readExport

ark/aot/usage.ts:647–694  ·  view source on GitHub ↗
(
		runtime: RuntimeModule,
		name: string,
		path: readonly string[] = []
	)

Source from the content-addressed store, hash-verified

645 }
646
647 private readExport(
648 runtime: RuntimeModule,
649 name: string,
650 path: readonly string[] = []
651 ): void {
652 const id = runtime.module.id
653 const key = `${id}\0${name}\0${path.join(".")}`
654 if (this.readExports.has(key)) return
655 this.readExports.add(key)
656 if (this.program.entries.has(id)) {
657 escape(
658 `${runtime.module.path} exports ${name}, which code outside the bundle may read`
659 )
660 }
661 if (this.program.exposed.has(id)) {
662 escape(
663 `${runtime.module.path} exports ${name}, which a dependency may read`
664 )
665 }
666 for (const edge of this.edgesByTarget.get(id) ?? []) {
667 switch (edge.kind) {
668 case "named":
669 if (edge.name === name)
670 this.readBinding(edge.binding, edge.importer, path)
671 break
672 case "namespace":
673 this.readNamespace(edge.binding, edge.importer, name, path)
674 break
675 case "reexport":
676 if (edge.name === name) this.readExport(edge.importer, edge.as, path)
677 break
678 case "star":
679 if (name !== "default") this.readExport(edge.importer, name, path)
680 break
681 case "whole":
682 escape(
683 `${edge.at} ${edge.how(runtime.module.path)}, which may read its ${name} any way`
684 )
685 break
686 case "input":
687 if (edge.name === name) {
688 escape(
689 `${runtime.module.path}'s ${name} is passed to a factory, which may read any member`
690 )
691 }
692 }
693 }
694 }
695
696 // `ns.T` reads the export, and nothing else may read the namespace
697 private readNamespace(

Callers 1

readBindingMethod · 0.95

Calls 6

readBindingMethod · 0.95
readNamespaceMethod · 0.95
escapeFunction · 0.70
getMethod · 0.65
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected