| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Mounts app plugins straight from the CLI, no config file needed:
jss start --root ./data --public --plugin ./chat/plugin.js@/chat
parsePluginFlag splits on the last '@' followed by '/', so scoped
package specifiers parse unambiguously ('@scope/pkg/plugin.js@/app').
A value with no such separator is all module — a malformed prefix
becomes a loud import failure, never a surprise mount.
CLI entries APPEND to the config file's plugins array instead of
following the CLI-replaces-file rule: replacing would make -c plus one
--plugin silently drop the file's declared apps. Per-plugin config
objects and explicit ids stay config-file territory; entries reach the
loader untouched, so its validation (prefix, duplicate ids,
fail-loudly) applies as-is.
Unit tests for the parser; verified end-to-end: flag-only mounts and
serves, and config-file + flag mount both apps side by side.
There was a problem hiding this comment.
Adds a repeatable --plugin <module[@prefix]> CLI flag to mount app plugins without requiring a config file, while preserving existing plugin-loader validation semantics by parsing only { module, prefix } and appending CLI entries to any plugins defined in a config file.
Changes:
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/config.js | Adds parsePluginFlag() helper for parsing --plugin flag values. |
| bin/jss.js | Introduces repeatable --plugin option and appends parsed plugin entries to config plugins. |
| test/config.test.js | Adds unit tests covering parsePluginFlag() parsing edge cases (scoped packages, multiple @, etc.). |
| docs/configuration.md | Documents CLI usage of repeatable --plugin flag with examples and merging behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
Unquoted leading @ is PowerShell splatting syntax (Copilot review).
| export function parsePluginFlag(value) { | ||
| const str = String(value); | ||
| const at = str.lastIndexOf('@/'); | ||
| if (at > 0) { | ||
| return { module: str.slice(0, at), prefix: str.slice(at + 1) }; | ||
| } | ||
| return { module: str }; | ||
| } |
There was a problem hiding this comment.
Good catch — changed to >= 0 in 665e2ac; '@/app' now raises the loader's "each entry needs a module" error (verified via CLI), with a unit test for the case.
Sorry, something went wrong.
…s clear no-module error (Copilot review)
The --plugin CLI flag (#594, #595): jss start --plugin 'module[@Prefix]' mounts app plugins with no config file — repeatable, split on the last '@' followed by '/' so scoped package specifiers parse unambiguously, and a malformed or missing module fails the boot through the loader's own validation. CLI entries append to the config file's plugins array rather than replacing it, so -c plus --plugin composes. With 0.0.216's config-file forwarding this completes the CLI half of #206: plugins now load from config.json, from flags, or both. Documented in docs/configuration.md App Plugins. Remaining: pluginDataDir override so served trees don't collect .plugins/ (#592), #583 raw-body mode, #564 feature migration.
| Back | FazBrowse Home | New Git URL |
Closes #594. Builds on #593.
What
Tests
Sets up the servejss side of #592's plan: jsserve can now forward --plugin verbatim and stay a pure flag translator.