MCPcopy
hub / github.com/evanw/esbuild / pkgForSomeOtherPlatform

Function pkgForSomeOtherPlatform

lib/npm/node-platform.ts:86–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84}
85
86function pkgForSomeOtherPlatform(): string | null {
87 const libMainJS = require.resolve('esbuild')
88 const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)))
89
90 if (path.basename(nodeModulesDirectory) === 'node_modules') {
91 for (const unixKey in knownUnixlikePackages) {
92 try {
93 const pkg = knownUnixlikePackages[unixKey]
94 if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg
95 } catch {
96 }
97 }
98
99 for (const windowsKey in knownWindowsPackages) {
100 try {
101 const pkg = knownWindowsPackages[windowsKey]
102 if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg
103 } catch {
104 }
105 }
106 }
107
108 return null
109}
110
111export function downloadedBinPath(pkg: string, subpath: string): string {
112 const esbuildLibDir = path.dirname(require.resolve('esbuild'))

Callers 1

generateBinPathFunction · 0.85

Calls 2

resolveMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…