Npm plugin loading#242
Open
kzhou314 wants to merge 4 commits into
Open
Conversation
Accept object entries in the 'scans' input ({name, package, version}) and install/import them at runtime via npm install --ignore-scripts. Loading is gated to first-party allowlist. Includes unit tests.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for installing and loading curated first-party accessibility scanner plugins from NPM, driven by object entries in the scans input (alongside existing built-in and local plugins). This addresses consumers who want to use a first-party plugin without vendoring plugin source into their repo.
Changes:
- Extend
scansinput parsing to accept{name, package, version?}entries and forward requested NPM plugins into plugin loading. - Add an NPM plugin loader that installs packages at runtime and dynamically imports them.
- Document the new NPM plugin mechanism and update the action input description; add unit tests for the NPM loader and NPM-plugin loading path.
Show a summary per file
| File | Description |
|---|---|
| PLUGINS.md | Documents how to request and load first-party NPM-published plugins via scans. |
| .github/actions/find/action.yml | Expands scans input description to include object-form entries for NPM plugins. |
| .github/actions/find/src/scansContextProvider.ts | Parses scans entries into scan names + a list of requested NPM plugins. |
| .github/actions/find/src/pluginManager/types.ts | Introduces NpmPluginRequest type for NPM plugin requests. |
| .github/actions/find/src/pluginManager/npmPluginLoader.ts | Adds runtime npm install + dynamic import for NPM plugin modules. |
| .github/actions/find/src/pluginManager/index.ts | Loads curated first-party NPM plugins after built-in and local plugins, with validation/precedence rules. |
| .github/actions/find/src/findForUrl.ts | Passes parsed npmPlugins into plugin loading so NPM plugins can be installed/loaded for the scan run. |
| .github/actions/find/tests/npmPluginLoader.test.ts | Adds unit tests for NPM install flags and NPM plugin loading/skip behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 8/8 changed files
- Comments generated: 5
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.
Scanner-side fixes for https://github.com/github/accessibility/issues/10755.
Consumers request a first-party NPM plugin by passing an object in the
scansinput: