diff --git a/bun.lock b/bun.lock index 8e5532615..9d103d406 100644 --- a/bun.lock +++ b/bun.lock @@ -84,9 +84,6 @@ "packages/natives": { "name": "@oh-my-pi/pi-natives", "version": "13.19.0", - "dependencies": { - "@oh-my-pi/pi-utils": "workspace:*", - }, "devDependencies": { "@napi-rs/cli": "3.6.0", "@types/bun": "^1.3", diff --git a/packages/natives/native/index.js b/packages/natives/native/index.js index 42bbb815b..e41da5123 100644 --- a/packages/natives/native/index.js +++ b/packages/natives/native/index.js @@ -7,7 +7,19 @@ const fs = require("node:fs"); const { createRequire } = require("node:module"); const os = require("node:os"); const path = require("node:path"); -const { getNativesDir, logger } = require("@oh-my-pi/pi-utils"); +// Inline the two pi-utils helpers this loader needs (getNativesDir, logger.time). +// Pi-natives used to require('@oh-my-pi/pi-utils') at module top, but Bun's +// static resolver rejects that import when pi-natives is installed via a +// tarball where its workspace:* dep cannot be resolved next to this nested +// CJS file. Inlining removes the hard dep. +function getNativesDir() { + return path.join(os.homedir(), ".omp", "natives"); +} +const logger = { + time(_label, fn, ...args) { + return fn(...args); + }, +}; const packageJson = require("../package.json"); const { embeddedAddon } = require("./embedded-addon"); diff --git a/packages/natives/package.json b/packages/natives/package.json index 52908afd1..4b38f9eb8 100644 --- a/packages/natives/package.json +++ b/packages/natives/package.json @@ -37,9 +37,7 @@ "test": "bun run build:native && bun test", "bench": "bun bench/grep.ts" }, - "dependencies": { - "@oh-my-pi/pi-utils": "workspace:*" - }, + "devDependencies": { "@napi-rs/cli": "3.6.0", "@types/bun": "^1.3"