singularity-forge/src/bundled-resource-path.ts
Mikael Hugo b24f426f2b batch: snapshot of in-flight v2 work
This commit captures uncommitted modifications that accumulated in the
working tree across multiple in-progress workstreams. It is a snapshot
to clear the deck before sf v3 work begins; individual workstreams
should land separately on top of this.

Notable additions:
- trace-collector.ts, traces.ts, src/tests/trace-export.test.ts —
  trace export plumbing
- biome.json — Biome linter configuration
- .gitignore — exclude native/npm/**/*.node compiled binaries

The bulk of the diff is across src/resources/extensions/sf/ (301 files)
and src/resources/extensions/sf/tests/ (277 files), reflecting the
ongoing sf extension work. Specific feature commits should follow this
snapshot rather than being archaeology'd out of it.

The 76MB native/npm/linux-x64-gnu/forge_engine.node compiled binary
was left out of the commit — it's now gitignored and built locally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 12:42:31 +02:00

18 lines
643 B
TypeScript

import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
/**
* Resolve bundled raw resource files from the package root.
*
* Both `src/*.ts` and compiled `dist/*.js` entry points need to load the same
* raw `.ts` resource modules via jiti. Those modules are shipped under
* `src/resources/**`, not next to the compiled entry point.
*/
export function resolveBundledSourceResource(
importUrl: string,
...segments: string[]
): string {
const moduleDir = dirname(fileURLToPath(importUrl));
const packageRoot = resolve(moduleDir, "..");
return join(packageRoot, "src", "resources", ...segments);
}