Plugin config schemas and helpers: discovers local plugin files in a directory, reads a plugin spec's identifier and options, resolves path-like specs relative to the declaring config file, and deduplicates plugins by load identity.
Members
(static, constant) Options
Schema for arbitrary inline plugin options (a string-keyed record of unknown values).
(static, constant) Spec
Schema for a plugin spec: a plain identifier string, or a [identifier, options] tuple.
Methods
(static) deduplicatePluginOrigins(plugins) → {Array}
Deduplicate plugins by load identity, keeping the last-declared occurrence of each (package name for npm specs, exact file URL for local specs) while preserving the original ordering and each entry's full provenance.
| Name | Type | Description |
|---|---|---|
plugins | Array | Plugin origin entries, each with a |
The deduplicated plugin entries in their original order.
- Type:
- Array
(static) load(dir) → {Promise.<Array.<string>>}
Discover local plugin files under plugin/ or plugins/ in a directory.
| Name | Type | Description |
|---|---|---|
dir | string | The directory to scan (its |
File URLs (file://) of the discovered .js/.mjs plugins.
- Type:
- Promise.<Array.<string>>
(static) pluginOptions(plugin) → {Object|undefined}
Extract the inline options of a plugin spec, if any.
| Name | Type | Description |
|---|---|---|
plugin | string | | A plugin spec string or |
The options object, or undefined when the spec is a bare identifier.
- Type:
- Object |
undefined
(static) pluginSpecifier(plugin) → {string}
Extract the identifier portion of a plugin spec.
| Name | Type | Description |
|---|---|---|
plugin | string | | A plugin spec string or |
The plugin identifier.
- Type:
- string
(static) resolvePluginSpec(plugin, configFilepath) → {Promise.<(string|Array)>}
Resolve a path-like plugin spec into an absolute file:// URL (or its package entry), anchored to the config file that declared it. Non-path specs (e.g. npm package names) are returned unchanged.
| Name | Type | Description |
|---|---|---|
plugin | string | | A plugin spec string or |
configFilepath | string | Path to the config file that declared the plugin. |
The resolved spec, preserving the tuple shape when options were present.
- Type:
- Promise.<(string|Array)>