summaryrefslogtreecommitdiffhomepage
path: root/packages/shared/src/util/module.ts
diff options
context:
space:
mode:
authorShoubhit Dash <[email protected]>2026-04-16 17:30:14 +0530
committerShoubhit Dash <[email protected]>2026-04-16 17:30:14 +0530
commit2e18a603f0ea24154908e748493fd4bfaa74fc00 (patch)
treeb723e00af2821b213573b16fa199b64babd5f1f5 /packages/shared/src/util/module.ts
parent9819eb04614fd607cacb07d754052f1531a82331 (diff)
parent7341718f9234b0cf3a8758c87e91d2006b71bff6 (diff)
downloadopencode-2e18a603f0ea24154908e748493fd4bfaa74fc00.tar.gz
opencode-2e18a603f0ea24154908e748493fd4bfaa74fc00.zip
merge dev
Diffstat (limited to 'packages/shared/src/util/module.ts')
-rw-r--r--packages/shared/src/util/module.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/shared/src/util/module.ts b/packages/shared/src/util/module.ts
new file mode 100644
index 000000000..6ed3b23d7
--- /dev/null
+++ b/packages/shared/src/util/module.ts
@@ -0,0 +1,10 @@
+import { createRequire } from "node:module"
+import path from "node:path"
+
+export namespace Module {
+ export function resolve(id: string, dir: string) {
+ try {
+ return createRequire(path.join(dir, "package.json")).resolve(id)
+ } catch {}
+ }
+}