MCPcopy Index your code
hub / github.com/codeaashu/claude-code / setup

Function setup

scripts/build-bundle.ts:33–63  ·  view source on GitHub ↗
(build)

Source from the content-addressed store, hash-verified

31const srcResolverPlugin: esbuild.Plugin = {
32 name: 'src-resolver',
33 setup(build) {
34 build.onResolve({ filter: /^src\// }, (args) => {
35 const basePath = resolve(ROOT, args.path)
36
37 // Already exists as-is
38 if (existsSync(basePath)) {
39 return { path: basePath }
40 }
41
42 // Strip .js/.jsx and try TypeScript extensions
43 const withoutExt = basePath.replace(/\.(js|jsx)$/, '')
44 for (const ext of ['.ts', '.tsx', '.js', '.jsx']) {
45 const candidate = withoutExt + ext
46 if (existsSync(candidate)) {
47 return { path: candidate }
48 }
49 }
50
51 // Try as directory with index file
52 const dirPath = basePath.replace(/\.(js|jsx)$/, '')
53 for (const ext of ['.ts', '.tsx', '.js', '.jsx']) {
54 const candidate = resolve(dirPath, 'index' + ext)
55 if (existsSync(candidate)) {
56 return { path: candidate }
57 }
58 }
59
60 // Let esbuild handle it (will error if truly missing)
61 return undefined
62 })
63 },
64}
65
66const buildOptions: esbuild.BuildOptions = {

Callers

nothing calls this directly

Calls 3

existsSyncFunction · 0.90
onResolveMethod · 0.80
resolveFunction · 0.50

Tested by

no test coverage detected