MCPcopy
hub / github.com/opentrace/opentrace / findWasmDir

Function findWasmDir

ui/src/components/pipeline/wasm.ts:58–69  ·  view source on GitHub ↗

* Resolve the WASM directory. Walks up from this file's location until * it finds a `public/wasm` directory. Works from both source and dist: * * - Source: components/src/pipeline/wasm.ts (2 levels up) * - Dist: components/dist/pipeline.js (1 level up) * - npm: @opentrace/components/

()

Source from the content-addressed store, hash-verified

56 * - npm: @opentrace/components/dist/pipeline.js (1 level up)
57 */
58function findWasmDir(): string {
59 let dir = __dirname;
60 for (let i = 0; i < 5; i++) {
61 const candidate = join(dir, 'public', 'wasm');
62 if (existsSync(candidate)) return candidate;
63 dir = dirname(dir);
64 }
65 // Should not happen in a correctly installed package
66 throw new Error(
67 'Could not find WASM directory. Ensure @opentrace/components is installed correctly.',
68 );
69}
70
71let _wasmDir: string | undefined;
72

Callers 1

getWasmDirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected