Skip to content

fix(vscode): include all runtime deps in extension package#2910

Closed
ckeller42 wants to merge 1 commit into
mainfrom
fix/vscode-extension-packaging
Closed

fix(vscode): include all runtime deps in extension package#2910
ckeller42 wants to merge 1 commit into
mainfrom
fix/vscode-extension-packaging

Conversation

@ckeller42

@ckeller42 ckeller42 commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix VSCode extension language server crash on v1.55.1 — "Cannot find package 'bundle-require'".

Root Cause

The package-vsix.mts script used pnpm ls -P --json to discover production dependency versions. But pnpm doesn't list dependencies that are hoisted through devDependencies — bundle-require and esbuild are declared in package.json but resolved through @likec4/lsp (a devDep), so pnpm ls -P returned only 2 of 4 declared deps.

Before: VSIX included only fdir, std-env
After: VSIX includes bundle-require, esbuild (as esbuild-wasm), fdir, load-tsconfig, std-env

Fix

Replace pnpm ls -P --json with pnpm why <pkg> --json for each declared dependency. pnpm why finds packages anywhere in the dependency graph regardless of hoisting.

Files changed

File Change
packages/vscode/scripts/package-vsix.mts Use pnpm why instead of pnpm ls -P for version resolution

Test plan

  • pnpm package-vsix produces VSIX with all 5 runtime deps in node_modules
  • Installed extension starts language server without "Cannot find package" errors
  • CI passes

🤖 Generated with Claude Code

@ckeller42 ckeller42 requested a review from davydkov April 16, 2026 15:22
@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@changeset-bot

changeset-bot Bot commented Apr 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 71c4b55

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
likec4-vscode Patch
likec4 Patch
@likec4/docs-astro Patch
@likec4/playground Patch
@likec4/style-preset Patch
@likec4/styles Patch
@likec4/config Patch
@likec4/core Patch
@likec4/diagram Patch
@likec4/generators Patch
@likec4/language-server Patch
@likec4/language-services Patch
@likec4/layouts Patch
@likec4/leanix-bridge Patch
@likec4/log Patch
@likec4/lsp Patch
@likec4/mcp Patch
@likec4/react Patch
@likec4/tsconfig Patch
@likec4/vite-plugin Patch
@likec4/vscode-preview Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@ckeller42 ckeller42 force-pushed the fix/vscode-extension-packaging branch from cc3949d to 5dbe27d Compare April 16, 2026 15:25
@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a changeset for likec4-vscode and modifies the VSCode packaging script to resolve production dependency versions from pnpm-lock.yaml (extracting packages/vscode.dependencies), populate package.json.dependencies with lockfile-derived exact versions (rewriting esbuild to npm:esbuild-wasm@<version>), log resolutions, and fail if any dependency is missing.

Changes

Cohort / File(s) Summary
Changeset Documentation
.changeset/fix-vscode-packaging-deps.md
Adds a changeset marking likec4-vscode for a patch release and documents inclusion of runtime dependencies (bundle-require, esbuild, load-tsconfig) for packaging.
VSCode Packaging Script
packages/vscode/scripts/package-vsix.mts
Replaces pnpm ls -P JSON parsing with lockfile-based resolution: reads ../../pnpm-lock.yaml, extracts packages/vscode.dependencies, builds resolvedDeps with exact versions (applies esbuild -> npm:esbuild-wasm@<version> rewrite), logs each resolved dependency, clears devDependencies, and errors if any declared production dependency or lockfile section is missing.

Sequence Diagram(s)

sequenceDiagram
    participant Script as rect rgba(70,130,180,0.5) Script
    participant Lockfile as rect rgba(34,139,34,0.5) pnpm-lock.yaml
    participant FS as rect rgba(220,20,60,0.5) File System

    Script->>FS: read package.json (declared production deps)
    Script->>FS: read ../../pnpm-lock.yaml
    Script->>Lockfile: extract packages/vscode -> dependencies block
    loop for each declared dependency
        Script->>Lockfile: lookup `<name>@*` entry (regex match)
        alt found
            Lockfile-->>Script: version string
            Script->>Script: map to exact resolved value (apply esbuild rewrite if needed)
            Script->>FS: log resolved dependency entry
        else not found
            Script->>Script: throw error and abort
        end
    end
    Script->>FS: write updated package.json.dependencies (resolvedDeps)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • davydkov
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing VSCode extension packaging to include all required runtime dependencies in the extension package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description provides a clear summary, root cause analysis, detailed fix explanation, and test plan, covering all essential information required by the repository's contribution guidelines.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/vscode-extension-packaging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e767bd73-b00c-4d9c-b001-4d487531167a

📥 Commits

Reviewing files that changed from the base of the PR and between 935f6bb and cc3949d.

📒 Files selected for processing (2)
  • .changeset/fix-vscode-packaging-deps.md
  • packages/vscode/scripts/package-vsix.mts

Comment thread packages/vscode/scripts/package-vsix.mts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/vscode/scripts/package-vsix.mts (1)

11-14: Stale comment references old approach.

The comment mentions pnpm ls --json but the actual implementation uses pnpm why. Consider updating for accuracy.

 *
- * Resolve actual versions via `pnpm ls --json` (includes all deps,
- * not just those linked into node_modules) and build a clean
+ * Resolve actual versions via `pnpm why <pkg> --json` (finds deps
+ * anywhere in the dependency graph, even if hoisted) and build a clean
 * dependencies object for npm install.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/vscode/scripts/package-vsix.mts` around lines 11 - 14, Update the
stale comment in the package-vsix.mts script that currently says "Resolve actual
versions via `pnpm ls --json`" to reflect the actual implementation which uses
`pnpm why`; locate the comment block near the top of the file (the description
about resolving versions and building a dependencies object) and change the
wording to mention `pnpm why` (or otherwise accurately describe the approach
used) so the comment matches the code behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/vscode/scripts/package-vsix.mts`:
- Around line 11-14: Update the stale comment in the package-vsix.mts script
that currently says "Resolve actual versions via `pnpm ls --json`" to reflect
the actual implementation which uses `pnpm why`; locate the comment block near
the top of the file (the description about resolving versions and building a
dependencies object) and change the wording to mention `pnpm why` (or otherwise
accurately describe the approach used) so the comment matches the code behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b448899d-17aa-4a81-bb5b-44b69f3a2da6

📥 Commits

Reviewing files that changed from the base of the PR and between cc3949d and 5dbe27d.

📒 Files selected for processing (2)
  • .changeset/fix-vscode-packaging-deps.md
  • packages/vscode/scripts/package-vsix.mts
✅ Files skipped from review due to trivial changes (1)
  • .changeset/fix-vscode-packaging-deps.md

@ckeller42 ckeller42 force-pushed the fix/vscode-extension-packaging branch from 5dbe27d to 444513e Compare April 16, 2026 15:40
@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@ckeller42 ckeller42 force-pushed the fix/vscode-extension-packaging branch from 444513e to bf8890b Compare April 17, 2026 06:47
@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/vscode/scripts/package-vsix.mts (1)

53-53: Version-suffix stripping is greedy and may over-strip.

version.replace(/\(.*\)$/, '') uses a greedy .*, which is fine for a single trailing (...) group but would collapse nested/multiple groups incorrectly. pnpm versions can look like 5.1.0(esbuild@0.27.4)(foo@1.2.3) — the greedy match correctly strips both here, but if a version ever contained a literal ) followed by more text it would misbehave. Prefer a first-paren split for clarity and safety:

-  const version = versionMatch[1].replace(/\(.*\)$/, '')
+  const version = versionMatch[1].split('(')[0].trim()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/vscode/scripts/package-vsix.mts` at line 53, The current extraction
for version using versionMatch[1].replace(/\(.*\)$/, '') uses a greedy regex
that can over-strip; update the logic that sets the version (where version is
derived from versionMatch[1]) to trim any suffix beginning with the first '('
instead (e.g., split on '(' and take the first segment, trim whitespace) so
nested or unexpected parentheses won't remove unintended parts of the version
string.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/vscode/scripts/package-vsix.mts`:
- Line 53: The current extraction for version using
versionMatch[1].replace(/\(.*\)$/, '') uses a greedy regex that can over-strip;
update the logic that sets the version (where version is derived from
versionMatch[1]) to trim any suffix beginning with the first '(' instead (e.g.,
split on '(' and take the first segment, trim whitespace) so nested or
unexpected parentheses won't remove unintended parts of the version string.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e7c5bd71-c42b-401f-b4c3-87bfb9e3463d

📥 Commits

Reviewing files that changed from the base of the PR and between 444513e and bf8890b.

📒 Files selected for processing (2)
  • .changeset/fix-vscode-packaging-deps.md
  • packages/vscode/scripts/package-vsix.mts
✅ Files skipped from review due to trivial changes (1)
  • .changeset/fix-vscode-packaging-deps.md

The package-vsix.mts script used `pnpm ls -P --json` to resolve production
dependency versions, but pnpm doesn't list deps that are hoisted through
devDependencies (bundle-require, esbuild). This caused the language server
to fail with "Cannot find package 'bundle-require'" on v1.55.1.

Switch to `pnpm why <pkg> --json` which finds packages anywhere in the
dependency graph regardless of hoisting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@davydkov

Copy link
Copy Markdown
Member

I've updated package.json of vscode plugin with explicit list of runtime deps - should be enough for now

@davydkov davydkov closed this Apr 28, 2026
@davydkov davydkov deleted the fix/vscode-extension-packaging branch May 8, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants