From 97eea3ee342fe3d1de3f30927acf3004c14cc196 Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Thu, 23 Jul 2026 01:29:25 +0200 Subject: [PATCH] feat: migrate default config and templates to npm specifiers - quartz.config.default.yaml: all 44 plugins use @quartz-community/* npm specifiers - cli/templates/*.yaml: all 4 templates updated (default, blog, obsidian, ttrpg) - bootstrap-cli.mjs: updated help text - package.json: devDeps use npm semver ranges instead of github: specifiers - gitLoader.ts: regeneratePluginIndex scans npm packages from node_modules - install-plugins.ts: generates plugin index for npm packages - Removed quartz.lock.json (only relevant for git-installed plugins) --- package.json | 4 +- quartz.config.default.yaml | 88 +++---- quartz.lock.json | 286 ----------------------- quartz/bootstrap-cli.mjs | 2 +- quartz/cli/templates/blog.yaml | 88 +++---- quartz/cli/templates/default.yaml | 88 +++---- quartz/cli/templates/obsidian.yaml | 90 +++---- quartz/cli/templates/ttrpg.yaml | 90 +++---- quartz/plugins/loader/gitLoader.ts | 58 ++++- quartz/plugins/loader/install-plugins.ts | 31 ++- quartz/plugins/loader/types.ts | 2 +- 11 files changed, 297 insertions(+), 530 deletions(-) delete mode 100644 quartz.lock.json diff --git a/package.json b/package.json index 1b258a5..420adf0 100644 --- a/package.json +++ b/package.json @@ -73,8 +73,8 @@ "yargs": "^18.0.0" }, "devDependencies": { - "@quartz-community/types": "github:quartz-community/types", - "@quartz-community/utils": "github:quartz-community/utils", + "@quartz-community/types": "^0.2.1", + "@quartz-community/utils": "^0.1.0", "@types/hast": "^3.0.4", "@types/node": "^25.0.10", "@types/pretty-time": "^1.1.5", diff --git a/quartz.config.default.yaml b/quartz.config.default.yaml index 771725d..21c57d9 100644 --- a/quartz.config.default.yaml +++ b/quartz.config.default.yaml @@ -41,7 +41,7 @@ configuration: highlight: rgba(143, 159, 169, 0.15) textHighlight: "#b3aa0288" plugins: - - source: github:quartz-community/created-modified-date + - source: "@quartz-community/created-modified-date" enabled: true options: defaultDateType: modified @@ -50,7 +50,7 @@ plugins: - git - filesystem order: 10 - - source: github:quartz-community/syntax-highlighting + - source: "@quartz-community/syntax-highlighting" enabled: true options: theme: @@ -58,84 +58,84 @@ plugins: dark: github-dark keepBackground: false order: 20 - - source: github:quartz-community/obsidian-flavored-markdown + - source: "@quartz-community/obsidian-flavored-markdown" enabled: true options: enableInHtmlEmbed: false enableCheckbox: true order: 30 - - source: github:quartz-community/github-flavored-markdown + - source: "@quartz-community/github-flavored-markdown" enabled: true order: 40 - - source: github:quartz-community/table-of-contents + - source: "@quartz-community/table-of-contents" enabled: true order: 50 layout: position: right priority: 30 - - source: github:quartz-community/crawl-links + - source: "@quartz-community/crawl-links" enabled: true options: markdownLinkResolution: shortest order: 60 - - source: github:quartz-community/description + - source: "@quartz-community/description" enabled: true order: 70 - - source: github:quartz-community/latex + - source: "@quartz-community/latex" enabled: true options: renderEngine: katex order: 80 - - source: github:quartz-community/citations + - source: "@quartz-community/citations" enabled: false order: 85 - - source: github:quartz-community/hard-line-breaks + - source: "@quartz-community/hard-line-breaks" enabled: false order: 90 - - source: github:quartz-community/ox-hugo + - source: "@quartz-community/ox-hugo" enabled: false order: 91 - - source: github:quartz-community/roam + - source: "@quartz-community/roam" enabled: false order: 92 - - source: github:quartz-community/fonts + - source: "@quartz-community/fonts" enabled: true - - source: github:quartz-community/remove-draft + - source: "@quartz-community/remove-draft" enabled: true - - source: github:quartz-community/explicit-publish + - source: "@quartz-community/explicit-publish" enabled: false - - source: github:quartz-community/alias-redirects + - source: "@quartz-community/alias-redirects" enabled: true - - source: github:quartz-community/content-index + - source: "@quartz-community/content-index" enabled: true options: enableSiteMap: true enableRSS: true - - source: github:quartz-community/favicon + - source: "@quartz-community/favicon" enabled: true - - source: github:quartz-community/og-image + - source: "@quartz-community/og-image" enabled: true - - source: github:quartz-community/cname + - source: "@quartz-community/cname" enabled: true - - source: github:quartz-community/canvas-page + - source: "@quartz-community/canvas-page" enabled: true - - source: github:quartz-community/content-page + - source: "@quartz-community/content-page" enabled: true - - source: github:quartz-community/folder-page + - source: "@quartz-community/folder-page" enabled: true - - source: github:quartz-community/tag-page + - source: "@quartz-community/tag-page" enabled: true - - source: github:quartz-community/explorer + - source: "@quartz-community/explorer" enabled: true layout: position: left priority: 50 - - source: github:quartz-community/graph + - source: "@quartz-community/graph" enabled: true layout: position: right priority: 10 - - source: github:quartz-community/search + - source: "@quartz-community/search" enabled: true layout: position: left @@ -143,50 +143,50 @@ plugins: group: toolbar groupOptions: grow: true - - source: github:quartz-community/backlinks + - source: "@quartz-community/backlinks" enabled: true layout: position: right priority: 50 - - source: github:quartz-community/article-title + - source: "@quartz-community/article-title" enabled: true layout: position: beforeBody priority: 10 - - source: github:quartz-community/content-meta + - source: "@quartz-community/content-meta" enabled: true layout: position: beforeBody priority: 20 - - source: github:quartz-community/tag-list + - source: "@quartz-community/tag-list" enabled: false layout: position: beforeBody priority: 30 - - source: github:quartz-community/page-title + - source: "@quartz-community/page-title" enabled: true layout: position: left priority: 10 - - source: github:quartz-community/darkmode + - source: "@quartz-community/darkmode" enabled: true layout: position: left priority: 30 group: toolbar - - source: github:quartz-community/reader-mode + - source: "@quartz-community/reader-mode" enabled: true layout: position: left priority: 35 group: toolbar - - source: github:quartz-community/breadcrumbs + - source: "@quartz-community/breadcrumbs" enabled: true layout: position: beforeBody priority: 5 condition: not-index - - source: github:quartz-community/comments + - source: "@quartz-community/comments" enabled: false options: provider: giscus @@ -194,15 +194,15 @@ plugins: layout: position: afterBody priority: 10 - - source: github:quartz-community/footer + - source: "@quartz-community/footer" enabled: true options: links: GitHub: https://github.com/jackyzha0/quartz Discord Community: https://discord.gg/cRFFHYye7t - - source: github:quartz-community/recent-notes + - source: "@quartz-community/recent-notes" enabled: false - - source: github:quartz-community/spacer + - source: "@quartz-community/spacer" enabled: true options: {} order: 25 @@ -210,11 +210,11 @@ plugins: position: left priority: 25 display: mobile-only - - source: github:quartz-community/bases-page + - source: "@quartz-community/bases-page" enabled: true options: {} order: 50 - - source: github:quartz-community/note-properties + - source: "@quartz-community/note-properties" enabled: true options: includeAll: false @@ -231,11 +231,11 @@ plugins: position: beforeBody priority: 15 display: all - - source: github:quartz-community/unlisted-pages + - source: "@quartz-community/unlisted-pages" enabled: true options: {} order: 45 - - source: github:quartz-community/encrypted-pages + - source: "@quartz-community/encrypted-pages" enabled: true options: iterations: 600000 @@ -247,7 +247,7 @@ plugins: position: body priority: 100 display: all - - source: github:quartz-community/stacked-pages + - source: "@quartz-community/stacked-pages" enabled: false layout: position: afterBody diff --git a/quartz.lock.json b/quartz.lock.json deleted file mode 100644 index 3f97ed5..0000000 --- a/quartz.lock.json +++ /dev/null @@ -1,286 +0,0 @@ -{ - "version": "1.0.0", - "plugins": { - "alias-redirects": { - "source": "github:quartz-community/alias-redirects", - "resolved": "https://github.com/quartz-community/alias-redirects.git", - "commit": "73a98dda7e4f55239310833299d91daf8611349f", - "installedAt": "2026-06-09T17:57:45.809Z" - }, - "article-title": { - "source": "github:quartz-community/article-title", - "resolved": "https://github.com/quartz-community/article-title.git", - "commit": "e608ca815e137e22b598094f735bcd8a481dafaa", - "installedAt": "2026-06-03T13:32:35.204Z" - }, - "backlinks": { - "source": "github:quartz-community/backlinks", - "resolved": "https://github.com/quartz-community/backlinks.git", - "commit": "7490f921b7bd974c3f2f985ad3744b06160827d6", - "installedAt": "2026-06-03T13:32:35.225Z" - }, - "bases-page": { - "source": "github:quartz-community/bases-page", - "resolved": "https://github.com/quartz-community/bases-page.git", - "commit": "f8fc7da3515a4d4bbe0bd4be0fd9188823866a01", - "installedAt": "2026-06-03T13:32:35.344Z" - }, - "breadcrumbs": { - "source": "github:quartz-community/breadcrumbs", - "resolved": "https://github.com/quartz-community/breadcrumbs.git", - "commit": "cf2e161425165e1ac713f1feb7250b07fe0250ae", - "installedAt": "2026-06-03T13:32:35.270Z" - }, - "canvas-page": { - "source": "github:quartz-community/canvas-page", - "resolved": "https://github.com/quartz-community/canvas-page.git", - "commit": "84fc96799671a65f76b66e30217dbefdd43a2905", - "installedAt": "2026-06-03T13:32:35.291Z" - }, - "citations": { - "source": "github:quartz-community/citations", - "resolved": "https://github.com/quartz-community/citations.git", - "commit": "2ad133a123c5b15b7c41d4fb684d422622113081", - "installedAt": "2026-06-03T13:16:37.060Z" - }, - "cname": { - "source": "github:quartz-community/cname", - "resolved": "https://github.com/quartz-community/cname.git", - "commit": "ec4c81c91da13a6f6c2cbe1656daf5c14575dab3", - "installedAt": "2026-06-03T13:16:37.301Z" - }, - "comments": { - "source": "github:quartz-community/comments", - "resolved": "https://github.com/quartz-community/comments.git", - "commit": "42c5023e42cf62495219095a862b2ea144b65600", - "installedAt": "2026-06-03T13:32:35.236Z" - }, - "content-index": { - "source": "github:quartz-community/content-index", - "resolved": "https://github.com/quartz-community/content-index.git", - "commit": "c3d4f5c85311712c3355cd71da46b28e2d8eba71", - "installedAt": "2026-06-03T13:32:35.431Z" - }, - "content-meta": { - "source": "github:quartz-community/content-meta", - "resolved": "https://github.com/quartz-community/content-meta.git", - "commit": "dd6e94b5ca1cb195104a2b5e624a43ee6aa0a324", - "installedAt": "2026-06-03T13:32:35.221Z" - }, - "content-page": { - "source": "github:quartz-community/content-page", - "resolved": "https://github.com/quartz-community/content-page.git", - "commit": "d22fae357ae74a3e97a2f450862f23f5227842c4", - "installedAt": "2026-06-03T13:32:35.505Z" - }, - "crawl-links": { - "source": "github:quartz-community/crawl-links", - "resolved": "https://github.com/quartz-community/crawl-links.git", - "commit": "43edc6d5182e79bf1b63fed7eb3ba0c7624a1526", - "installedAt": "2026-06-03T13:32:35.242Z" - }, - "created-modified-date": { - "source": "github:quartz-community/created-modified-date", - "resolved": "https://github.com/quartz-community/created-modified-date.git", - "commit": "c003199fb842969d43ee9e0f54120a85e588260e", - "installedAt": "2026-06-03T13:16:36.740Z" - }, - "darkmode": { - "source": "github:quartz-community/darkmode", - "resolved": "https://github.com/quartz-community/darkmode.git", - "commit": "c6484f72ebc6ea89339be7cf86ad14b40c47dcc7", - "installedAt": "2026-06-03T13:32:35.196Z" - }, - "description": { - "source": "github:quartz-community/description", - "resolved": "https://github.com/quartz-community/description.git", - "commit": "56dc546614d905ad07dd0da8dd5820e25e5ea97b", - "installedAt": "2026-06-03T13:32:35.233Z" - }, - "encrypted-pages": { - "source": "github:quartz-community/encrypted-pages", - "resolved": "https://github.com/quartz-community/encrypted-pages.git", - "commit": "89e88af565dfaa9ab2d9c99677b82394ea7be356", - "installedAt": "2026-06-03T13:32:35.661Z" - }, - "explicit-publish": { - "source": "github:quartz-community/explicit-publish", - "resolved": "https://github.com/quartz-community/explicit-publish.git", - "commit": "4afb630a1cc9034267beb93c928e81d0fa2f4d4b", - "installedAt": "2026-06-03T13:16:36.746Z" - }, - "explorer": { - "source": "github:quartz-community/explorer", - "resolved": "https://github.com/quartz-community/explorer.git", - "commit": "a2dfd1373abe58ace461ebea0b4e94cb287f894e", - "installedAt": "2026-06-03T13:32:35.808Z" - }, - "favicon": { - "source": "github:quartz-community/favicon", - "resolved": "https://github.com/quartz-community/favicon.git", - "commit": "85842d5c15f937a3d1a02c45accee27118146d73", - "installedAt": "2026-06-03T13:16:37.198Z" - }, - "folder-page": { - "source": "github:quartz-community/folder-page", - "resolved": "https://github.com/quartz-community/folder-page.git", - "commit": "93304d22e1d7f09f93a33658ec273f7cb8d17793", - "installedAt": "2026-06-03T13:32:35.810Z" - }, - "fonts": { - "source": "github:quartz-community/fonts", - "resolved": "https://github.com/quartz-community/fonts.git", - "commit": "8be5be706d19ca34fa8e342327b78e11aff3d4f0", - "installedAt": "2026-06-10T21:13:18.081Z" - }, - "footer": { - "source": "github:quartz-community/footer", - "resolved": "https://github.com/quartz-community/footer.git", - "commit": "6ed61928d3c0178d7cef972ebcbca6a206a2f065", - "installedAt": "2026-06-03T13:32:35.802Z" - }, - "github-flavored-markdown": { - "source": "github:quartz-community/github-flavored-markdown", - "resolved": "https://github.com/quartz-community/github-flavored-markdown.git", - "commit": "3eabbaa252ce175665ab3f62e1af25948a83e8b6", - "installedAt": "2026-06-03T13:16:36.665Z" - }, - "graph": { - "source": "github:quartz-community/graph", - "resolved": "https://github.com/quartz-community/graph.git", - "commit": "46f0ba1c3c0cc484697572e7bcf315fa384d80d2", - "installedAt": "2026-06-03T13:32:35.872Z" - }, - "hard-line-breaks": { - "source": "github:quartz-community/hard-line-breaks", - "resolved": "https://github.com/quartz-community/hard-line-breaks.git", - "commit": "0d448f38a24c568c5539ff2cd57d813293430ccd", - "installedAt": "2026-06-03T13:16:36.965Z" - }, - "latex": { - "source": "github:quartz-community/latex", - "resolved": "https://github.com/quartz-community/latex.git", - "commit": "3dcfedcb5ae5e28b71248a72665ccb881e82c185", - "installedAt": "2026-06-03T13:16:36.841Z" - }, - "note-properties": { - "source": "github:quartz-community/note-properties", - "resolved": "https://github.com/quartz-community/note-properties.git", - "commit": "3cb40141e792a8a9ba9f99553cd436f36411bf8d", - "installedAt": "2026-06-03T13:32:35.812Z" - }, - "obsidian-flavored-markdown": { - "source": "github:quartz-community/obsidian-flavored-markdown", - "resolved": "https://github.com/quartz-community/obsidian-flavored-markdown.git", - "commit": "07eaca7b31a537c7c4a0fd2848b1f00014c940af", - "installedAt": "2026-06-03T13:32:35.815Z" - }, - "obsidian-plugin-excalidraw": { - "source": "github:quartz-community/obsidian-plugin-excalidraw", - "resolved": "https://github.com/quartz-community/obsidian-plugin-excalidraw.git", - "commit": "dad0a4c0abdc8b3c2786277a2cbd67dc039c754c", - "installedAt": "2026-06-03T13:32:35.851Z" - }, - "og-image": { - "source": "github:quartz-community/og-image", - "resolved": "https://github.com/quartz-community/og-image.git", - "commit": "31343c612d02c5fd22ff27a1e6035b2486be75f5", - "installedAt": "2026-06-03T13:32:35.899Z" - }, - "ox-hugo": { - "source": "github:quartz-community/ox-hugo", - "resolved": "https://github.com/quartz-community/ox-hugo.git", - "commit": "832871da9ab33d52f904456c1a5e14f1b2057d83", - "installedAt": "2026-06-03T13:16:36.714Z" - }, - "page-title": { - "source": "github:quartz-community/page-title", - "resolved": "https://github.com/quartz-community/page-title.git", - "commit": "a1c1fe0a9c6a5ce1acf6efa01d473a7d9850e2a3", - "installedAt": "2026-06-03T13:32:36.002Z" - }, - "quartz-themes": { - "source": { - "name": "quartz-themes", - "repo": "github:saberzero1/quartz-themes", - "subdir": "plugin" - }, - "resolved": "https://github.com/saberzero1/quartz-themes.git", - "commit": "945135e8b70576753d0591e1713fe56553100b3d", - "subdir": "plugin", - "installedAt": "2026-06-11T15:50:25.576Z" - }, - "reader-mode": { - "source": "github:quartz-community/reader-mode", - "resolved": "https://github.com/quartz-community/reader-mode.git", - "commit": "73c8bce66df8835510ffac47e53b1ca0f7efd51e", - "installedAt": "2026-06-03T13:32:36.320Z" - }, - "recent-notes": { - "source": "github:quartz-community/recent-notes", - "resolved": "https://github.com/quartz-community/recent-notes.git", - "commit": "3c3d104335e2fc5ff62371ead157667adb79b046", - "installedAt": "2026-06-03T13:32:36.284Z" - }, - "remove-draft": { - "source": "github:quartz-community/remove-draft", - "resolved": "https://github.com/quartz-community/remove-draft.git", - "commit": "0a51a4c6abb3c86961a9bbf46f4538da87fcf9f8", - "installedAt": "2026-06-03T13:16:36.691Z" - }, - "roam": { - "source": "github:quartz-community/roam", - "resolved": "https://github.com/quartz-community/roam.git", - "commit": "b2aad70fdf548d07b8fd28df9edbdba7f256f166", - "installedAt": "2026-06-03T13:16:36.771Z" - }, - "search": { - "source": "github:quartz-community/search", - "resolved": "https://github.com/quartz-community/search.git", - "commit": "0f4c1a233cd03a0f562e13636b89b7708f8e2698", - "installedAt": "2026-06-03T13:32:36.597Z" - }, - "spacer": { - "source": "github:quartz-community/spacer", - "resolved": "https://github.com/quartz-community/spacer.git", - "commit": "64b135dcfb78c4911f8c42d942872d645cd2a456", - "installedAt": "2026-06-03T13:16:37.913Z" - }, - "stacked-pages": { - "source": "github:quartz-community/stacked-pages", - "resolved": "https://github.com/quartz-community/stacked-pages.git", - "commit": "e88fe063c68f74e6ba2dc7c54ddb353bb10c7982", - "installedAt": "2026-06-03T13:32:36.330Z" - }, - "syntax-highlighting": { - "source": "github:quartz-community/syntax-highlighting", - "resolved": "https://github.com/quartz-community/syntax-highlighting.git", - "commit": "5bfdc2c3f42d3d0326c4e777eb575f3fb68d51fb", - "installedAt": "2026-06-03T13:16:37.737Z" - }, - "table-of-contents": { - "source": "github:quartz-community/table-of-contents", - "resolved": "https://github.com/quartz-community/table-of-contents.git", - "commit": "6984305e5dae0830c025450e160f12610406f7a4", - "installedAt": "2026-06-03T13:32:36.265Z" - }, - "tag-list": { - "source": "github:quartz-community/tag-list", - "resolved": "https://github.com/quartz-community/tag-list.git", - "commit": "c48324e2ba768e2a0a5c4c17cd0661b190d075c5", - "installedAt": "2026-06-03T13:32:36.346Z" - }, - "tag-page": { - "source": "github:quartz-community/tag-page", - "resolved": "https://github.com/quartz-community/tag-page.git", - "commit": "eabf3eec55c0bab7f49e69957341f34d2ae3c5a1", - "installedAt": "2026-06-03T13:32:36.377Z" - }, - "unlisted-pages": { - "source": "github:quartz-community/unlisted-pages", - "resolved": "https://github.com/quartz-community/unlisted-pages.git", - "commit": "f512d8672862c5891e63d755ba04b66277e6d760", - "installedAt": "2026-06-03T13:32:36.647Z" - } - } -} diff --git a/quartz/bootstrap-cli.mjs b/quartz/bootstrap-cli.mjs index 34288c7..de90912 100755 --- a/quartz/bootstrap-cli.mjs +++ b/quartz/bootstrap-cli.mjs @@ -40,7 +40,7 @@ async function launchTui() { if (!existsSync(tuiPath)) { console.error( "TUI plugin not installed. Install with:\n" + - " npx quartz plugin add github:quartz-community/tui\n", + " npx quartz plugin add @quartz-community/tui\n", ) process.exit(1) } diff --git a/quartz/cli/templates/blog.yaml b/quartz/cli/templates/blog.yaml index 5ca9c0e..fc8b0b4 100644 --- a/quartz/cli/templates/blog.yaml +++ b/quartz/cli/templates/blog.yaml @@ -43,7 +43,7 @@ configuration: highlight: rgba(143, 159, 169, 0.15) textHighlight: "#b3aa0288" plugins: - - source: github:quartz-community/created-modified-date + - source: "@quartz-community/created-modified-date" enabled: true options: defaultDateType: modified @@ -52,7 +52,7 @@ plugins: - git - filesystem order: 10 - - source: github:quartz-community/syntax-highlighting + - source: "@quartz-community/syntax-highlighting" enabled: true options: theme: @@ -60,96 +60,96 @@ plugins: dark: github-dark keepBackground: false order: 20 - - source: github:quartz-community/obsidian-flavored-markdown + - source: "@quartz-community/obsidian-flavored-markdown" enabled: true options: enableInHtmlEmbed: false enableCheckbox: true order: 30 - - source: github:quartz-community/github-flavored-markdown + - source: "@quartz-community/github-flavored-markdown" enabled: true order: 40 - - source: github:quartz-community/table-of-contents + - source: "@quartz-community/table-of-contents" enabled: true order: 50 layout: position: right priority: 30 - - source: github:quartz-community/crawl-links + - source: "@quartz-community/crawl-links" enabled: true options: markdownLinkResolution: shortest order: 60 - - source: github:quartz-community/description + - source: "@quartz-community/description" enabled: true order: 70 - - source: github:quartz-community/latex + - source: "@quartz-community/latex" enabled: true options: renderEngine: katex order: 80 - - source: github:quartz-community/citations + - source: "@quartz-community/citations" enabled: false order: 85 - - source: github:quartz-community/hard-line-breaks + - source: "@quartz-community/hard-line-breaks" enabled: false order: 90 - - source: github:quartz-community/ox-hugo + - source: "@quartz-community/ox-hugo" enabled: false order: 91 - - source: github:quartz-community/roam + - source: "@quartz-community/roam" enabled: false order: 92 - - source: github:quartz-community/fonts + - source: "@quartz-community/fonts" enabled: true - - source: github:quartz-community/remove-draft + - source: "@quartz-community/remove-draft" enabled: true - - source: github:quartz-community/explicit-publish + - source: "@quartz-community/explicit-publish" enabled: false - - source: github:quartz-community/unlisted-pages + - source: "@quartz-community/unlisted-pages" enabled: true options: {} order: 45 - - source: github:quartz-community/encrypted-pages + - source: "@quartz-community/encrypted-pages" enabled: false - - source: github:quartz-community/stacked-pages + - source: "@quartz-community/stacked-pages" enabled: false layout: position: afterBody priority: 50 display: all - - source: github:quartz-community/alias-redirects + - source: "@quartz-community/alias-redirects" enabled: true - - source: github:quartz-community/content-index + - source: "@quartz-community/content-index" enabled: true options: enableSiteMap: true enableRSS: true - - source: github:quartz-community/favicon + - source: "@quartz-community/favicon" enabled: true - - source: github:quartz-community/og-image + - source: "@quartz-community/og-image" enabled: true - - source: github:quartz-community/cname + - source: "@quartz-community/cname" enabled: true - - source: github:quartz-community/canvas-page + - source: "@quartz-community/canvas-page" enabled: true - - source: github:quartz-community/content-page + - source: "@quartz-community/content-page" enabled: true - - source: github:quartz-community/folder-page + - source: "@quartz-community/folder-page" enabled: true - - source: github:quartz-community/tag-page + - source: "@quartz-community/tag-page" enabled: true - - source: github:quartz-community/explorer + - source: "@quartz-community/explorer" enabled: true layout: position: left priority: 50 - - source: github:quartz-community/graph + - source: "@quartz-community/graph" enabled: true layout: position: right priority: 10 - - source: github:quartz-community/search + - source: "@quartz-community/search" enabled: true layout: position: left @@ -157,50 +157,50 @@ plugins: group: toolbar groupOptions: grow: true - - source: github:quartz-community/backlinks + - source: "@quartz-community/backlinks" enabled: true layout: position: right priority: 50 - - source: github:quartz-community/article-title + - source: "@quartz-community/article-title" enabled: true layout: position: beforeBody priority: 10 - - source: github:quartz-community/content-meta + - source: "@quartz-community/content-meta" enabled: true layout: position: beforeBody priority: 20 - - source: github:quartz-community/tag-list + - source: "@quartz-community/tag-list" enabled: false layout: position: beforeBody priority: 30 - - source: github:quartz-community/page-title + - source: "@quartz-community/page-title" enabled: true layout: position: left priority: 10 - - source: github:quartz-community/darkmode + - source: "@quartz-community/darkmode" enabled: true layout: position: left priority: 30 group: toolbar - - source: github:quartz-community/reader-mode + - source: "@quartz-community/reader-mode" enabled: true layout: position: left priority: 35 group: toolbar - - source: github:quartz-community/breadcrumbs + - source: "@quartz-community/breadcrumbs" enabled: true layout: position: beforeBody priority: 5 condition: not-index - - source: github:quartz-community/comments + - source: "@quartz-community/comments" enabled: true options: provider: giscus @@ -219,13 +219,13 @@ plugins: layout: position: afterBody priority: 10 - - source: github:quartz-community/footer + - source: "@quartz-community/footer" enabled: true options: links: GitHub: https://github.com/jackyzha0/quartz Discord Community: https://discord.gg/cRFFHYye7t - - source: github:quartz-community/recent-notes + - source: "@quartz-community/recent-notes" enabled: true options: title: Recent Notes @@ -235,7 +235,7 @@ plugins: layout: position: left priority: 25 - - source: github:quartz-community/spacer + - source: "@quartz-community/spacer" enabled: true options: {} order: 25 @@ -243,11 +243,11 @@ plugins: position: left priority: 25 display: mobile-only - - source: github:quartz-community/bases-page + - source: "@quartz-community/bases-page" enabled: true options: {} order: 50 - - source: github:quartz-community/note-properties + - source: "@quartz-community/note-properties" enabled: true options: includeAll: false diff --git a/quartz/cli/templates/default.yaml b/quartz/cli/templates/default.yaml index 111654b..1e221f0 100644 --- a/quartz/cli/templates/default.yaml +++ b/quartz/cli/templates/default.yaml @@ -43,7 +43,7 @@ configuration: highlight: rgba(143, 159, 169, 0.15) textHighlight: "#b3aa0288" plugins: - - source: github:quartz-community/created-modified-date + - source: "@quartz-community/created-modified-date" enabled: true options: defaultDateType: modified @@ -52,7 +52,7 @@ plugins: - git - filesystem order: 10 - - source: github:quartz-community/syntax-highlighting + - source: "@quartz-community/syntax-highlighting" enabled: true options: theme: @@ -60,101 +60,101 @@ plugins: dark: github-dark keepBackground: false order: 20 - - source: github:quartz-community/obsidian-flavored-markdown + - source: "@quartz-community/obsidian-flavored-markdown" enabled: true options: enableInHtmlEmbed: false enableCheckbox: true order: 30 - - source: github:quartz-community/github-flavored-markdown + - source: "@quartz-community/github-flavored-markdown" enabled: true order: 40 - - source: github:quartz-community/table-of-contents + - source: "@quartz-community/table-of-contents" enabled: true order: 50 layout: position: right priority: 30 - - source: github:quartz-community/crawl-links + - source: "@quartz-community/crawl-links" enabled: true options: markdownLinkResolution: shortest order: 60 - - source: github:quartz-community/description + - source: "@quartz-community/description" enabled: true order: 70 - - source: github:quartz-community/latex + - source: "@quartz-community/latex" enabled: true options: renderEngine: katex order: 80 - - source: github:quartz-community/citations + - source: "@quartz-community/citations" enabled: false order: 85 - - source: github:quartz-community/hard-line-breaks + - source: "@quartz-community/hard-line-breaks" enabled: false order: 90 - - source: github:quartz-community/ox-hugo + - source: "@quartz-community/ox-hugo" enabled: false order: 91 - - source: github:quartz-community/roam + - source: "@quartz-community/roam" enabled: false order: 92 - - source: github:quartz-community/fonts + - source: "@quartz-community/fonts" enabled: true - - source: github:quartz-community/remove-draft + - source: "@quartz-community/remove-draft" enabled: true - - source: github:quartz-community/explicit-publish + - source: "@quartz-community/explicit-publish" enabled: false - - source: github:quartz-community/unlisted-pages + - source: "@quartz-community/unlisted-pages" enabled: true options: {} order: 45 - - source: github:quartz-community/encrypted-pages + - source: "@quartz-community/encrypted-pages" enabled: true options: iterations: 600000 passwordField: password unlistWhenEncrypted: false outputPath: static/encryptedContentIndex.json - - source: github:quartz-community/stacked-pages + - source: "@quartz-community/stacked-pages" enabled: false layout: position: afterBody priority: 50 display: all - - source: github:quartz-community/alias-redirects + - source: "@quartz-community/alias-redirects" enabled: true - - source: github:quartz-community/content-index + - source: "@quartz-community/content-index" enabled: true options: enableSiteMap: true enableRSS: true - - source: github:quartz-community/favicon + - source: "@quartz-community/favicon" enabled: true - - source: github:quartz-community/og-image + - source: "@quartz-community/og-image" enabled: true - - source: github:quartz-community/cname + - source: "@quartz-community/cname" enabled: true - - source: github:quartz-community/canvas-page + - source: "@quartz-community/canvas-page" enabled: true - - source: github:quartz-community/content-page + - source: "@quartz-community/content-page" enabled: true - - source: github:quartz-community/folder-page + - source: "@quartz-community/folder-page" enabled: true - - source: github:quartz-community/tag-page + - source: "@quartz-community/tag-page" enabled: true - - source: github:quartz-community/explorer + - source: "@quartz-community/explorer" enabled: true layout: position: left priority: 50 - - source: github:quartz-community/graph + - source: "@quartz-community/graph" enabled: true layout: position: right priority: 10 - - source: github:quartz-community/search + - source: "@quartz-community/search" enabled: true layout: position: left @@ -162,50 +162,50 @@ plugins: group: toolbar groupOptions: grow: true - - source: github:quartz-community/backlinks + - source: "@quartz-community/backlinks" enabled: true layout: position: right priority: 50 - - source: github:quartz-community/article-title + - source: "@quartz-community/article-title" enabled: true layout: position: beforeBody priority: 10 - - source: github:quartz-community/content-meta + - source: "@quartz-community/content-meta" enabled: true layout: position: beforeBody priority: 20 - - source: github:quartz-community/tag-list + - source: "@quartz-community/tag-list" enabled: false layout: position: beforeBody priority: 30 - - source: github:quartz-community/page-title + - source: "@quartz-community/page-title" enabled: true layout: position: left priority: 10 - - source: github:quartz-community/darkmode + - source: "@quartz-community/darkmode" enabled: true layout: position: left priority: 30 group: toolbar - - source: github:quartz-community/reader-mode + - source: "@quartz-community/reader-mode" enabled: true layout: position: left priority: 35 group: toolbar - - source: github:quartz-community/breadcrumbs + - source: "@quartz-community/breadcrumbs" enabled: true layout: position: beforeBody priority: 5 condition: not-index - - source: github:quartz-community/comments + - source: "@quartz-community/comments" enabled: false options: provider: giscus @@ -213,15 +213,15 @@ plugins: layout: position: afterBody priority: 10 - - source: github:quartz-community/footer + - source: "@quartz-community/footer" enabled: true options: links: GitHub: https://github.com/jackyzha0/quartz Discord Community: https://discord.gg/cRFFHYye7t - - source: github:quartz-community/recent-notes + - source: "@quartz-community/recent-notes" enabled: false - - source: github:quartz-community/spacer + - source: "@quartz-community/spacer" enabled: true options: {} order: 25 @@ -229,11 +229,11 @@ plugins: position: left priority: 25 display: mobile-only - - source: github:quartz-community/bases-page + - source: "@quartz-community/bases-page" enabled: true options: {} order: 50 - - source: github:quartz-community/note-properties + - source: "@quartz-community/note-properties" enabled: true options: includeAll: false diff --git a/quartz/cli/templates/obsidian.yaml b/quartz/cli/templates/obsidian.yaml index b45dfb3..c78cdd3 100644 --- a/quartz/cli/templates/obsidian.yaml +++ b/quartz/cli/templates/obsidian.yaml @@ -43,7 +43,7 @@ configuration: highlight: rgba(143, 159, 169, 0.15) textHighlight: "#b3aa0288" plugins: - - source: github:quartz-community/created-modified-date + - source: "@quartz-community/created-modified-date" enabled: true options: defaultDateType: modified @@ -52,7 +52,7 @@ plugins: - git - filesystem order: 10 - - source: github:quartz-community/syntax-highlighting + - source: "@quartz-community/syntax-highlighting" enabled: true options: theme: @@ -60,7 +60,7 @@ plugins: dark: github-dark keepBackground: false order: 20 - - source: github:quartz-community/obsidian-flavored-markdown + - source: "@quartz-community/obsidian-flavored-markdown" enabled: true options: comments: true @@ -76,96 +76,96 @@ plugins: enableVideoEmbed: true enableCheckbox: true order: 30 - - source: github:quartz-community/github-flavored-markdown + - source: "@quartz-community/github-flavored-markdown" enabled: true order: 40 - - source: github:quartz-community/table-of-contents + - source: "@quartz-community/table-of-contents" enabled: true order: 50 layout: position: right priority: 30 - - source: github:quartz-community/crawl-links + - source: "@quartz-community/crawl-links" enabled: true options: markdownLinkResolution: shortest # disableBrokenWikilinks: false # Set true to add a "broken" CSS class to internal links whose target is not in ctx.allSlugs. order: 60 - - source: github:quartz-community/description + - source: "@quartz-community/description" enabled: true order: 70 - - source: github:quartz-community/latex + - source: "@quartz-community/latex" enabled: true options: renderEngine: katex order: 80 - - source: github:quartz-community/citations + - source: "@quartz-community/citations" enabled: false order: 85 - - source: github:quartz-community/hard-line-breaks + - source: "@quartz-community/hard-line-breaks" enabled: true order: 90 - - source: github:quartz-community/ox-hugo + - source: "@quartz-community/ox-hugo" enabled: false order: 91 - - source: github:quartz-community/roam + - source: "@quartz-community/roam" enabled: false order: 92 - - source: github:quartz-community/fonts + - source: "@quartz-community/fonts" enabled: true - - source: github:quartz-community/remove-draft + - source: "@quartz-community/remove-draft" enabled: true - - source: github:quartz-community/explicit-publish + - source: "@quartz-community/explicit-publish" enabled: false - - source: github:quartz-community/unlisted-pages + - source: "@quartz-community/unlisted-pages" enabled: true options: {} order: 45 - - source: github:quartz-community/encrypted-pages + - source: "@quartz-community/encrypted-pages" enabled: true options: iterations: 600000 passwordField: password unlistWhenEncrypted: false outputPath: static/encryptedContentIndex.json - - source: github:quartz-community/stacked-pages + - source: "@quartz-community/stacked-pages" enabled: false layout: position: afterBody priority: 50 display: all - - source: github:quartz-community/alias-redirects + - source: "@quartz-community/alias-redirects" enabled: true - - source: github:quartz-community/content-index + - source: "@quartz-community/content-index" enabled: true options: enableSiteMap: true enableRSS: true - - source: github:quartz-community/favicon + - source: "@quartz-community/favicon" enabled: true - - source: github:quartz-community/og-image + - source: "@quartz-community/og-image" enabled: true - - source: github:quartz-community/cname + - source: "@quartz-community/cname" enabled: true - - source: github:quartz-community/canvas-page + - source: "@quartz-community/canvas-page" enabled: true - - source: github:quartz-community/content-page + - source: "@quartz-community/content-page" enabled: true - - source: github:quartz-community/folder-page + - source: "@quartz-community/folder-page" enabled: true - - source: github:quartz-community/tag-page + - source: "@quartz-community/tag-page" enabled: true - - source: github:quartz-community/explorer + - source: "@quartz-community/explorer" enabled: true layout: position: left priority: 50 - - source: github:quartz-community/graph + - source: "@quartz-community/graph" enabled: true layout: position: right priority: 10 - - source: github:quartz-community/search + - source: "@quartz-community/search" enabled: true layout: position: left @@ -173,50 +173,50 @@ plugins: group: toolbar groupOptions: grow: true - - source: github:quartz-community/backlinks + - source: "@quartz-community/backlinks" enabled: true layout: position: right priority: 50 - - source: github:quartz-community/article-title + - source: "@quartz-community/article-title" enabled: true layout: position: beforeBody priority: 10 - - source: github:quartz-community/content-meta + - source: "@quartz-community/content-meta" enabled: true layout: position: beforeBody priority: 20 - - source: github:quartz-community/tag-list + - source: "@quartz-community/tag-list" enabled: false layout: position: beforeBody priority: 30 - - source: github:quartz-community/page-title + - source: "@quartz-community/page-title" enabled: true layout: position: left priority: 10 - - source: github:quartz-community/darkmode + - source: "@quartz-community/darkmode" enabled: true layout: position: left priority: 30 group: toolbar - - source: github:quartz-community/reader-mode + - source: "@quartz-community/reader-mode" enabled: true layout: position: left priority: 35 group: toolbar - - source: github:quartz-community/breadcrumbs + - source: "@quartz-community/breadcrumbs" enabled: true layout: position: beforeBody priority: 5 condition: not-index - - source: github:quartz-community/comments + - source: "@quartz-community/comments" enabled: false options: provider: giscus @@ -224,15 +224,15 @@ plugins: layout: position: afterBody priority: 10 - - source: github:quartz-community/footer + - source: "@quartz-community/footer" enabled: true options: links: GitHub: https://github.com/jackyzha0/quartz Discord Community: https://discord.gg/cRFFHYye7t - - source: github:quartz-community/recent-notes + - source: "@quartz-community/recent-notes" enabled: false - - source: github:quartz-community/spacer + - source: "@quartz-community/spacer" enabled: true options: {} order: 25 @@ -240,11 +240,11 @@ plugins: position: left priority: 25 display: mobile-only - - source: github:quartz-community/bases-page + - source: "@quartz-community/bases-page" enabled: true options: {} order: 50 - - source: github:quartz-community/note-properties + - source: "@quartz-community/note-properties" enabled: true options: includeAll: false @@ -268,7 +268,7 @@ plugins: enabled: true options: theme: default - - source: github:quartz-community/obsidian-plugin-excalidraw + - source: "@quartz-community/obsidian-plugin-excalidraw" enabled: true options: enableInteraction: true diff --git a/quartz/cli/templates/ttrpg.yaml b/quartz/cli/templates/ttrpg.yaml index 2c06b76..d1e064a 100644 --- a/quartz/cli/templates/ttrpg.yaml +++ b/quartz/cli/templates/ttrpg.yaml @@ -43,7 +43,7 @@ configuration: highlight: rgba(143, 159, 169, 0.15) textHighlight: "#b3aa0288" plugins: - - source: github:quartz-community/created-modified-date + - source: "@quartz-community/created-modified-date" enabled: true options: defaultDateType: modified @@ -52,7 +52,7 @@ plugins: - git - filesystem order: 10 - - source: github:quartz-community/syntax-highlighting + - source: "@quartz-community/syntax-highlighting" enabled: true options: theme: @@ -60,7 +60,7 @@ plugins: dark: github-dark keepBackground: false order: 20 - - source: github:quartz-community/obsidian-flavored-markdown + - source: "@quartz-community/obsidian-flavored-markdown" enabled: true options: comments: true @@ -76,96 +76,96 @@ plugins: enableVideoEmbed: true enableCheckbox: true order: 30 - - source: github:quartz-community/github-flavored-markdown + - source: "@quartz-community/github-flavored-markdown" enabled: true order: 40 - - source: github:quartz-community/table-of-contents + - source: "@quartz-community/table-of-contents" enabled: true order: 50 layout: position: right priority: 30 - - source: github:quartz-community/crawl-links + - source: "@quartz-community/crawl-links" enabled: true options: markdownLinkResolution: shortest # disableBrokenWikilinks: false # Set true to add a "broken" CSS class to internal links whose target is not in ctx.allSlugs. order: 60 - - source: github:quartz-community/description + - source: "@quartz-community/description" enabled: true order: 70 - - source: github:quartz-community/latex + - source: "@quartz-community/latex" enabled: true options: renderEngine: katex order: 80 - - source: github:quartz-community/citations + - source: "@quartz-community/citations" enabled: false order: 85 - - source: github:quartz-community/hard-line-breaks + - source: "@quartz-community/hard-line-breaks" enabled: true order: 90 - - source: github:quartz-community/ox-hugo + - source: "@quartz-community/ox-hugo" enabled: false order: 91 - - source: github:quartz-community/roam + - source: "@quartz-community/roam" enabled: false order: 92 - - source: github:quartz-community/fonts + - source: "@quartz-community/fonts" enabled: true - - source: github:quartz-community/remove-draft + - source: "@quartz-community/remove-draft" enabled: true - - source: github:quartz-community/explicit-publish + - source: "@quartz-community/explicit-publish" enabled: false - - source: github:quartz-community/unlisted-pages + - source: "@quartz-community/unlisted-pages" enabled: true options: {} order: 45 - - source: github:quartz-community/encrypted-pages + - source: "@quartz-community/encrypted-pages" enabled: true options: iterations: 600000 passwordField: password unlistWhenEncrypted: false outputPath: static/encryptedContentIndex.json - - source: github:quartz-community/stacked-pages + - source: "@quartz-community/stacked-pages" enabled: false layout: position: afterBody priority: 50 display: all - - source: github:quartz-community/alias-redirects + - source: "@quartz-community/alias-redirects" enabled: true - - source: github:quartz-community/content-index + - source: "@quartz-community/content-index" enabled: true options: enableSiteMap: true enableRSS: true - - source: github:quartz-community/favicon + - source: "@quartz-community/favicon" enabled: true - - source: github:quartz-community/og-image + - source: "@quartz-community/og-image" enabled: true - - source: github:quartz-community/cname + - source: "@quartz-community/cname" enabled: true - - source: github:quartz-community/canvas-page + - source: "@quartz-community/canvas-page" enabled: true - - source: github:quartz-community/content-page + - source: "@quartz-community/content-page" enabled: true - - source: github:quartz-community/folder-page + - source: "@quartz-community/folder-page" enabled: true - - source: github:quartz-community/tag-page + - source: "@quartz-community/tag-page" enabled: true - - source: github:quartz-community/explorer + - source: "@quartz-community/explorer" enabled: true layout: position: left priority: 50 - - source: github:quartz-community/graph + - source: "@quartz-community/graph" enabled: true layout: position: right priority: 10 - - source: github:quartz-community/search + - source: "@quartz-community/search" enabled: true layout: position: left @@ -173,50 +173,50 @@ plugins: group: toolbar groupOptions: grow: true - - source: github:quartz-community/backlinks + - source: "@quartz-community/backlinks" enabled: true layout: position: right priority: 50 - - source: github:quartz-community/article-title + - source: "@quartz-community/article-title" enabled: true layout: position: beforeBody priority: 10 - - source: github:quartz-community/content-meta + - source: "@quartz-community/content-meta" enabled: true layout: position: beforeBody priority: 20 - - source: github:quartz-community/tag-list + - source: "@quartz-community/tag-list" enabled: false layout: position: beforeBody priority: 30 - - source: github:quartz-community/page-title + - source: "@quartz-community/page-title" enabled: true layout: position: left priority: 10 - - source: github:quartz-community/darkmode + - source: "@quartz-community/darkmode" enabled: true layout: position: left priority: 30 group: toolbar - - source: github:quartz-community/reader-mode + - source: "@quartz-community/reader-mode" enabled: true layout: position: left priority: 35 group: toolbar - - source: github:quartz-community/breadcrumbs + - source: "@quartz-community/breadcrumbs" enabled: true layout: position: beforeBody priority: 5 condition: not-index - - source: github:quartz-community/comments + - source: "@quartz-community/comments" enabled: false options: provider: giscus @@ -224,15 +224,15 @@ plugins: layout: position: afterBody priority: 10 - - source: github:quartz-community/footer + - source: "@quartz-community/footer" enabled: true options: links: GitHub: https://github.com/jackyzha0/quartz Discord Community: https://discord.gg/cRFFHYye7t - - source: github:quartz-community/recent-notes + - source: "@quartz-community/recent-notes" enabled: false - - source: github:quartz-community/spacer + - source: "@quartz-community/spacer" enabled: true options: {} order: 25 @@ -240,11 +240,11 @@ plugins: position: left priority: 25 display: mobile-only - - source: github:quartz-community/bases-page + - source: "@quartz-community/bases-page" enabled: true options: {} order: 50 - - source: github:quartz-community/note-properties + - source: "@quartz-community/note-properties" enabled: true options: includeAll: false @@ -274,7 +274,7 @@ plugins: options: theme: its-theme variation: ttrpg-dnd - - source: github:quartz-community/obsidian-plugin-excalidraw + - source: "@quartz-community/obsidian-plugin-excalidraw" enabled: true options: enableInteraction: true diff --git a/quartz/plugins/loader/gitLoader.ts b/quartz/plugins/loader/gitLoader.ts index dd79ac1..11f3727 100644 --- a/quartz/plugins/loader/gitLoader.ts +++ b/quartz/plugins/loader/gitLoader.ts @@ -4,6 +4,7 @@ import { execSync } from "child_process" import git from "isomorphic-git" import http from "isomorphic-git/http/node" import { styleText } from "util" +import { createRequire } from "module" import { pathToFileURL } from "url" import { PluginSource } from "./types" @@ -916,9 +917,11 @@ export function validatePluginExternals( } } -export async function regeneratePluginIndex(options: { verbose?: boolean } = {}): Promise { +export async function regeneratePluginIndex( + options: { verbose?: boolean; npmPackages?: string[] } = {}, +): Promise { if (!fs.existsSync(PLUGINS_CACHE_DIR)) { - return + fs.mkdirSync(PLUGINS_CACHE_DIR, { recursive: true }) } const pluginDirs = fs.readdirSync(PLUGINS_CACHE_DIR).filter((name) => { @@ -927,10 +930,12 @@ export async function regeneratePluginIndex(options: { verbose?: boolean } = {}) }) // Phase 1: Collect all exports per plugin, detect conflicts + // importPath maps plugin key → the import specifier used in generated index.ts const pluginExports = new Map< string, { overridable: string[]; passthrough: string[]; types: string[] } >() + const importPath = new Map() const nameCount = new Map() for (const pluginName of pluginDirs) { @@ -954,6 +959,45 @@ export async function regeneratePluginIndex(options: { verbose?: boolean } = {}) if (overridable.length > 0 || passthrough.length > 0 || types.length > 0) { pluginExports.set(pluginName, { overridable, passthrough, types }) + importPath.set(pluginName, `./${pluginName}`) + for (const n of [...overridable, ...passthrough]) { + nameCount.set(n, (nameCount.get(n) ?? 0) + 1) + } + } + } + + for (const npmPkg of options.npmPackages ?? []) { + let distIndex: string | undefined + try { + const esmRequire = createRequire(import.meta.url) + const pkgJsonPath = esmRequire.resolve(`${npmPkg}/package.json`) + distIndex = path.join(path.dirname(pkgJsonPath), "dist", "index.d.ts") + } catch { + if (options.verbose) { + console.log(styleText("yellow", `⚠`), `Skipping npm package ${npmPkg}: not found`) + } + continue + } + + if (!distIndex || !fs.existsSync(distIndex)) { + if (options.verbose) { + console.log(styleText("yellow", `⚠`), `Skipping npm package ${npmPkg}: no dist/index.d.ts`) + } + continue + } + + const dtsContent = fs.readFileSync(distIndex, "utf-8") + const exportedNames = parseExportsFromDts(dtsContent) + const named = exportedNames.filter((e) => !e.startsWith("type ")) + const types = exportedNames.filter((e) => e.startsWith("type ")).map((e) => e.slice(5)) + + const overridable = named.filter((n) => isOverridableExport(n, dtsContent)) + const passthrough = named.filter((n) => !isOverridableExport(n, dtsContent)) + + const key = npmPkg.replace(/^@/, "").replace(/\//g, "__") + if (overridable.length > 0 || passthrough.length > 0 || types.length > 0) { + pluginExports.set(key, { overridable, passthrough, types }) + importPath.set(key, npmPkg) for (const n of [...overridable, ...passthrough]) { nameCount.set(n, (nameCount.get(n) ?? 0) + 1) } @@ -966,19 +1010,17 @@ export async function regeneratePluginIndex(options: { verbose?: boolean } = {}) lines.push(`import { componentRegistry } from "../../quartz/components/registry"`) lines.push("") - // Type re-exports - for (const [pluginName, { types }] of pluginExports) { + for (const [pluginKey, { types }] of pluginExports) { if (types.length > 0) { - lines.push(`export type { ${types.join(", ")} } from "./${pluginName}"`) + lines.push(`export type { ${types.join(", ")} } from "${importPath.get(pluginKey)}"`) } } - // Direct re-exports for non-overridable values (constants, utility functions, etc.) - for (const [pluginName, { passthrough }] of pluginExports) { + for (const [pluginKey, { passthrough }] of pluginExports) { if (passthrough.length === 0) continue const unique = passthrough.filter((n) => (nameCount.get(n) ?? 0) === 1) if (unique.length > 0) { - lines.push(`export { ${unique.join(", ")} } from "./${pluginName}"`) + lines.push(`export { ${unique.join(", ")} } from "${importPath.get(pluginKey)}"`) } } lines.push("") diff --git a/quartz/plugins/loader/install-plugins.ts b/quartz/plugins/loader/install-plugins.ts index 1ab15e3..36ac269 100644 --- a/quartz/plugins/loader/install-plugins.ts +++ b/quartz/plugins/loader/install-plugins.ts @@ -2,7 +2,7 @@ import fs from "fs" import path from "path" import YAML from "yaml" -import { installPlugins, parsePluginSource } from "./gitLoader.js" +import { installPlugins, parsePluginSource, regeneratePluginIndex } from "./gitLoader.js" import type { PluginSource, QuartzPluginsJson } from "./types.js" function resolveConfigPath(): string { @@ -57,19 +57,30 @@ async function main() { .map((source: PluginSource) => parsePluginSource(source)) .filter((spec) => !spec.npmPackage) - if (specs.length === 0) { - console.log("No external Git plugins to install.") + const npmSpecs = externalPlugins + .map((source: PluginSource) => parsePluginSource(source)) + .filter((spec) => spec.npmPackage) + + if (specs.length === 0 && npmSpecs.length === 0) { + console.log("No external plugins to install.") return } - console.log(`Installing ${specs.length} plugin(s) from Git...`) - const installed = await installPlugins(specs, { verbose: true }) + if (specs.length > 0) { + console.log(`Installing ${specs.length} plugin(s) from Git...`) + const installed = await installPlugins(specs, { verbose: true }) - if (installed.size === externalPlugins.length) { - console.log("✓ All plugins installed successfully") - } else { - console.error(`✗ Only ${installed.size}/${externalPlugins.length} plugins installed`) - process.exit(1) + if (installed.size === specs.length) { + console.log("✓ All Git plugins installed successfully") + } else { + console.error(`✗ Only ${installed.size}/${specs.length} Git plugins installed`) + process.exit(1) + } + } + + if (npmSpecs.length > 0) { + console.log(`Found ${npmSpecs.length} npm plugin(s), regenerating plugin index...`) + await regeneratePluginIndex({ verbose: true, npmPackages: npmSpecs.map((s) => s.name) }) } } diff --git a/quartz/plugins/loader/types.ts b/quartz/plugins/loader/types.ts index 30ed00e..e47107d 100644 --- a/quartz/plugins/loader/types.ts +++ b/quartz/plugins/loader/types.ts @@ -51,7 +51,7 @@ export interface PluginManifest { keywords?: string[] category?: PluginCategory | PluginCategory[] quartzVersion?: string - /** Plugin sources this plugin depends on (e.g., "github:quartz-community/crawl-links") */ + /** Plugin sources this plugin depends on (e.g., "@quartz-community/crawl-links") */ dependencies?: string[] /** Default numeric execution order (0-100 convention, lower = runs first). Defaults to 50. */ defaultOrder?: number