Skip to content

feat: make webjs.nvim self-contained (bundle @webjsdev/ts-plugin) #398

Description

@vivek7405

Problem

webjs.nvim currently relies on the app having @webjsdev/ts-plugin in its node_modules for language intelligence (tsserver resolves plugins from the project's node_modules). That leaks an internal dependency to the user: installing webjs.nvim alone is not enough. The VS Code extension already bundles the plugin; webjs.nvim should too, so it is one-install all-in-one.

Approach

tsserver accepts plugins from explicit probe locations (init_options.plugins[].location in typescript-language-server / vtsls, which becomes tsserver pluginProbeLocations). Since @webjsdev/ts-plugin is now standalone, dependency-free plain CJS (#386), webjs.nvim can VENDOR a verbatim copy of it and point tsserver at the bundled location.

  • Vendor packages/ts-plugin/{package.json, src/} into packages/nvim/vendor/node_modules/@webjsdev/ts-plugin/ via a sync script, COMMITTED (lazy.nvim has no build step, so the bundle must be present after clone).
  • require('webjs').with_tsserver_plugin() returns { plugins = {{ name = '@webjsdev/ts-plugin', location = <plugin_root>/vendor }} } so tsserver loads the vendored copy, NOT the app's node_modules.
  • A test asserts the vendored copy is in sync with packages/ts-plugin/src (drift guard), plus a headless check that the location resolves.

Consequence

After this, neither editor plugin requires the app to install @webjsdev/ts-plugin. The npm publish of @webjsdev/ts-plugin becomes optional, needed ONLY for JetBrains / hand-wired-tsconfig users (and the scaffold pin that serves them). Keeping it for now.

Acceptance criteria

  • webjs.nvim ships a vendored @webjsdev/ts-plugin and with_tsserver_plugin() points tsserver at it.
  • Installing only webjs.nvim (no app dependency) yields go-to-def / completions / diagnostics in an html template.
  • A drift test fails if the vendored copy diverges from packages/ts-plugin/src.
  • README / doc / AGENTS updated; PUBLISHING note about re-vendoring before a subtree split.

Follow-up to epic #381 (Phase 4 #387).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions