@opencode/plugin 0.0.0-dev-19651 → 0.0.0-dev-19653

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import { Host } from "./host.js";
6
6
  import { localSource } from "./source.js";
7
+ import { missingPackageTarget } from "./source.package.js";
7
8
  let generation = Date.now();
8
9
  export async function prepareSource(entrypoint, track) {
9
10
  const root = fileURLToPath(entrypoint);
@@ -39,8 +40,17 @@ export async function prepareSource(entrypoint, track) {
39
40
  const local = item.path.startsWith("./") || item.path.startsWith("../")
40
41
  ? new URL(item.path, pathToFileURL(file))
41
42
  : localSource(item.path, path.dirname(file));
42
- if (!local)
43
+ if (!local) {
44
+ try {
45
+ Bun.resolveSync(item.path, path.dirname(file));
46
+ }
47
+ catch {
48
+ const target = missingPackageTarget(item.path, file);
49
+ if (target)
50
+ track(target, true);
51
+ }
43
52
  continue;
53
+ }
44
54
  const requested = fileURLToPath(local);
45
55
  // Resolving a workspace symlink can erase its node_modules boundary.
46
56
  if (requested.split(path.sep).includes("node_modules"))
@@ -2,6 +2,7 @@ import { registerHooks } from "node:module";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { localSource } from "./source.js";
5
+ import { missingPackageTarget } from "./source.package.js";
5
6
  import { Host } from "./host.js";
6
7
  let generation = Date.now();
7
8
  export async function prepareSource(entrypoint, track) {
@@ -18,8 +19,17 @@ export async function prepareSource(entrypoint, track) {
18
19
  const local = specifier.startsWith("./") || specifier.startsWith("../")
19
20
  ? new URL(specifier, context.parentURL)
20
21
  : localSource(specifier, path.dirname(fileURLToPath(context.parentURL)));
21
- if (!local)
22
- return nextResolve(specifier, context);
22
+ if (!local) {
23
+ try {
24
+ return nextResolve(specifier, context);
25
+ }
26
+ catch (error) {
27
+ const target = missingPackageTarget(specifier, fileURLToPath(context.parentURL));
28
+ if (target)
29
+ track(target, true);
30
+ throw error;
31
+ }
32
+ }
23
33
  if (fileURLToPath(local).split(path.sep).includes("node_modules"))
24
34
  return nextResolve(specifier, context);
25
35
  const resolved = (() => {
@@ -0,0 +1 @@
1
+ export declare function missingPackageTarget(specifier: string, importer: string): string | undefined;
@@ -0,0 +1,15 @@
1
+ import { existsSync } from "node:fs";
2
+ import path from "node:path";
3
+ export function missingPackageTarget(specifier, importer) {
4
+ if (specifier.startsWith("#"))
5
+ return undefined;
6
+ const parts = specifier.split("/");
7
+ const name = specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
8
+ const start = path.dirname(importer);
9
+ for (let directory = start;; directory = path.dirname(directory)) {
10
+ if (existsSync(path.join(directory, "package.json")))
11
+ return path.join(directory, "node_modules", name);
12
+ if (path.dirname(directory) === directory)
13
+ return path.join(start, "node_modules", name);
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/plugin",
4
- "version": "0.0.0-dev-19651",
4
+ "version": "0.0.0-dev-19653",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -43,17 +43,17 @@
43
43
  ],
44
44
  "dependencies": {
45
45
  "@ai-sdk/provider": "3.0.8",
46
- "@opencode/ai": "0.0.0-dev-19651",
47
- "@opencode/client": "0.0.0-dev-19651",
48
- "@opencode/protocol": "0.0.0-dev-19651",
49
- "@opencode/schema": "0.0.0-dev-19651",
50
- "@opencode/util": "0.0.0-dev-19651",
46
+ "@opencode/ai": "0.0.0-dev-19653",
47
+ "@opencode/client": "0.0.0-dev-19653",
48
+ "@opencode/protocol": "0.0.0-dev-19653",
49
+ "@opencode/schema": "0.0.0-dev-19653",
50
+ "@opencode/util": "0.0.0-dev-19653",
51
51
  "@standard-schema/spec": "1.1.0",
52
52
  "effect": "4.0.0-rc.112",
53
53
  "zod": "4.1.8"
54
54
  },
55
55
  "peerDependencies": {
56
- "@opencode/theme": "0.0.0-dev-19651",
56
+ "@opencode/theme": "0.0.0-dev-19653",
57
57
  "@opentui/core": ">=0.5.10",
58
58
  "@opentui/solid": ">=0.5.10",
59
59
  "solid-js": ">=1.9.0"
@@ -73,7 +73,7 @@
73
73
  }
74
74
  },
75
75
  "devDependencies": {
76
- "@opencode/theme": "0.0.0-dev-19651",
76
+ "@opencode/theme": "0.0.0-dev-19653",
77
77
  "@opentui/core": "0.5.10",
78
78
  "@opentui/solid": "0.5.10",
79
79
  "@tsconfig/bun": "1.0.9",