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

Function readsRuntimeExport

ark/aot/graph.ts:1145–1163  ·  view source on GitHub ↗
(
	module: SourceModule,
	specifier: ImportSpecifier
)

Source from the content-addressed store, hash-verified

1143
1144// arktype/runtime's `type` holds only `errors`
1145const readsRuntimeExport = (
1146 module: SourceModule,
1147 specifier: ImportSpecifier
1148): boolean => {
1149 const name = exportNameOf(specifier.imported)
1150 if (name in runtimeExports) return true
1151 const binding = module.scopes.bindingsById.get(specifier.local)
1152 return (
1153 name === "type" &&
1154 !!binding?.references.every(
1155 ({ id, isWrite }) =>
1156 !isWrite &&
1157 id.parent?.type === "MemberExpression" &&
1158 id.parent.object === id &&
1159 !id.parent.computed &&
1160 id.parent.property.name === "errors"
1161 )
1162 )
1163}
1164
1165export class ModuleGraph {
1166 host: PrecompileHost

Callers 1

readsOnlyRuntimeMethod · 0.85

Calls 2

exportNameOfFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected