fix: prefer .js over .ts when loading plugins for npm compatibility#8
Merged
simongdavies merged 1 commit intohyperlight-dev:mainfrom Mar 24, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts plugin source resolution to prefer compiled JavaScript over TypeScript to avoid Node.js “Stripping types is currently unsupported” errors when plugins are installed via npm (i.e., under node_modules), while still supporting TypeScript in dev workflows.
Changes:
- Added a
resolvePluginSource()helper in the plugin manager and used it for plugin hashing, source loading, and source verification. - Updated plugin source read/error messages to reflect
{ts,js}support. - Updated the agent’s plugin loader to prefer
index.jswhen present before dynamically importing plugins.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/plugin-system/manager.ts | Introduces and applies JS-first plugin source resolution for hashing/load/verify paths. |
| src/agent/index.ts | Updates runtime plugin dynamic import to select index.js when available. |
6cbb04a to
0ac76e4
Compare
Node.js refuses to strip types from .ts files under node_modules, causing 'Stripping types is currently unsupported' errors when plugins are loaded via npm install. - Add resolvePluginSource() helper that prefers .js over .ts - Update plugin import, source loading, hash computation, and source verification to use the helper - .js files exist in dist/ builds (compiled at build time) - .ts files still used in dev mode (tsx handles them) Type validation is unaffected — it uses pre-built .d.ts files (plugins/host-modules.d.ts), not runtime plugin source. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
0ac76e4 to
e37a4dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Node.js refuses to strip types from .ts files under node_modules, causing 'Stripping types is currently unsupported' errors when plugins are loaded via npm install.
Type validation is unaffected — it uses pre-built .d.ts files (plugins/host-modules.d.ts), not runtime plugin source.