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

Function addOverlayForProject

ark/aot/declare.ts:257–278  ·  view source on GitHub ↗
(
	overlay: VirtualDeclarations,
	result: Declarations,
	frontend: Frontend,
	sourceRoot: string | undefined,
	cwd: string
)

Source from the content-addressed store, hash-verified

255 )
256
257const addOverlayForProject = (
258 overlay: VirtualDeclarations,
259 result: Declarations,
260 frontend: Frontend,
261 sourceRoot: string | undefined,
262 cwd: string
263): void => {
264 overlay.add(result.files)
265 // when a downstream composite project imports a referenced project's source
266 // file, TypeScript redirects it to the output .d.ts but resolves relative
267 // imports inside that .d.ts (like `./~arktype.js`) from the upstream source
268 // rootDir; expose the virtual ~arktype.d.ts there too so it resolves cleanly
269 const sharedText = result.files[frontend.sharedPath]
270 if (sharedText !== undefined && sourceRoot) {
271 const sourceSharedPath = `${tsPath(sourceRoot)}/${sharedDeclarationFile}`
272 if (
273 canonicalConfigPath(sourceSharedPath, cwd) !==
274 canonicalConfigPath(frontend.sharedPath, cwd)
275 )
276 overlay.addFile(sourceSharedPath, sharedText)
277 }
278}
279
280export type SourceRootOptions = {
281 rootDir?: string | undefined

Callers 2

emitDeclarationsJsFunction · 0.85
emitDeclarationsFunction · 0.85

Calls 4

canonicalConfigPathFunction · 0.85
addFileMethod · 0.80
tsPathFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected