MCPcopy Create free account
hub / github.com/Effect-TS/effect / toLocalDistPath

Function toLocalDistPath

packages/tools/bundle/src/Plugins.ts:33–44  ·  view source on GitHub ↗
(pathService: Path.Path, packageDir: string, resolvedId: string)

Source from the content-addressed store, hash-verified

31const TYPE_SCRIPT_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts"])
32
33const toLocalDistPath = (pathService: Path.Path, packageDir: string, resolvedId: string): string => {
34 const srcDir = pathService.join(packageDir, "src")
35 const relative = pathService.relative(srcDir, resolvedId)
36 if (relative === "" || relative.startsWith("..") || pathService.isAbsolute(relative)) {
37 return resolvedId
38 }
39 const extension = pathService.extname(relative)
40 if (!TYPE_SCRIPT_EXTENSIONS.has(extension)) {
41 return resolvedId
42 }
43 return pathService.join(packageDir, "dist", relative.slice(0, -extension.length) + ".js")
44}
45
46/**
47 * Options for configuring Rollup plugins.

Callers 1

resolveIdFunction · 0.85

Calls 2

joinMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected