Repository navigation
fix(setup): remove stale CJS bundle check from setup-open-code #3908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,8 +44,7 @@ const PACKAGE_ROOT = resolve(__dirname, "..", "..", ".."); | |
| // (see root package.json `files`: ["@omniroute/", ...]). The env override | ||
| // exists so tests can point at a fixture without building the real plugin. | ||
| const BUNDLED_PLUGIN_DIR = | ||
| process.env.OMNIROUTE_OPENCODE_PLUGIN_DIR || | ||
| join(PACKAGE_ROOT, "@omniroute", "opencode-plugin"); | ||
| process.env.OMNIROUTE_OPENCODE_PLUGIN_DIR || join(PACKAGE_ROOT, "@omniroute", "opencode-plugin"); | ||
|
|
||
| /** | ||
| * Resolve the OpenCode config directory. Honours XDG_CONFIG_HOME and the | ||
|
|
@@ -89,7 +88,7 @@ function resolveOpenCodeDirs() { | |
| * a clear error instead of running tsup here, because the CLI runtime | ||
| * may not have tsup available (it's a devDependency). | ||
| * | ||
| * @returns {{ distEntry: string, cjsEntry: string, packageDir: string }} | ||
| * @returns {{ distEntry: string, packageDir: string }} | ||
| */ | ||
| function resolveBundledPlugin() { | ||
| if (!existsSync(BUNDLED_PLUGIN_DIR)) { | ||
|
|
@@ -102,17 +101,17 @@ function resolveBundledPlugin() { | |
| } | ||
|
|
||
| const esmEntry = join(BUNDLED_PLUGIN_DIR, "dist", "index.js"); | ||
| const cjsEntry = join(BUNDLED_PLUGIN_DIR, "dist", "index.cjs"); | ||
|
|
||
| if (!existsSync(esmEntry) || !existsSync(cjsEntry)) { | ||
| if (!existsSync(esmEntry)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the Repository Style Guide (Rule 9), you must always include or update tests when changing production code under References
|
||
| throw new Error( | ||
| `@omniroute/opencode-plugin dist/ not built (looked for ${esmEntry}).\n` + | ||
| `Run \`cd ${BUNDLED_PLUGIN_DIR} && npm install && npm run build\` and re-run this command.` | ||
| ); | ||
| } | ||
|
|
||
| // Prefer ESM. OpenCode (≥1.15) loads ESM modules natively. | ||
| return { distEntry: esmEntry, cjsEntry, packageDir: BUNDLED_PLUGIN_DIR }; | ||
| // ESM-only build (CJS was dropped in tsup config). OpenCode (>=1.15) loads | ||
| // ESM modules natively. | ||
| return { distEntry: esmEntry, packageDir: BUNDLED_PLUGIN_DIR }; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc description above (specifically on line 84 of the file) still mentions
dist/index.cjs(e.g.,Built (dist/index.cjs + dist/index.js exist)). Since the CommonJS bundle has been dropped, please update that description to reflect that onlydist/index.jsis expected.