feat: support npm scoped package specifiers for plugins

Plugins can now be referenced as "@quartz-community/<name>" in
quartz.config.yaml and via 'quartz plugin add'. The npm path skips
git installation and resolves from node_modules.

Changes:
- gitLoader.ts: detect @scope/name as npm package in parsePluginSource()
- config-loader.ts: skip git install for npm packages, read manifests
  from node_modules via createRequire
- install-plugins.ts: filter npm packages from prebuild, fallback to
  YAML config parsing to avoid loading full quartz.ts
- plugin-data.js: npm detection in CLI parseGitSource()
- plugin-git-handlers.js: npm install path in handlePluginAdd()
- package.json: add missing hast-util-from-html dependency
This commit is contained in:
saberzero1
2026-07-23 01:17:53 +02:00
parent 9cf87ff1c2
commit 5b34917e98
7 changed files with 369 additions and 8 deletions
+5
View File
@@ -190,6 +190,11 @@ export function parseGitSource(source) {
typeof source === "object" && source.name ? source.name : path.basename(parsed, ".git")
return { name, url: parsed, ref, subdir }
}
// Handle npm scoped packages
if (typeof url === "string" && url.startsWith("@") && url.includes("/") && !url.includes(":")) {
const name = typeof source === "object" && source.name ? source.name : url
return { name, url: "", npmPackage: true, subdir }
}
throw new Error(`Cannot parse plugin source: ${formatSource(source)}`)
}