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

Function pluginCallsIn

ark/aot/pluginCalls.ts:42–60  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

40
41// what reads options is a file at the project's root, like a bundler's config
42export const pluginCallsIn = (cwd: string): PluginCall[] => {
43 const project = projectOf(resolve(cwd))
44 const root =
45 existsSync(join(project, "package.json")) ? project : resolve(cwd)
46 const result: PluginCall[] = []
47 for (const entry of readdirSync(root, { withFileTypes: true })) {
48 if (!entry.isFile() || !scriptFile.test(entry.name)) continue
49 const file = join(root, entry.name)
50 const source = readFileSync(file, "utf8")
51 if (!mentionsEntry.test(source)) continue
52 const module = new SourceModule(
53 file,
54 source,
55 printablePathOf(cwd, file) || entry.name
56 )
57 if (!module.parseErrors.length) result.push(...callsIn(module))
58 }
59 return result
60}
61
62const callsIn = (module: SourceModule): PluginCall[] => {
63 const result: PluginCall[] = []

Callers 1

checkFunction · 0.90

Calls 7

projectOfFunction · 0.90
printablePathOfFunction · 0.90
joinFunction · 0.85
callsInFunction · 0.85
testMethod · 0.80
resolveFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected