Compare commits

..
Author SHA1 Message Date
saberzero1 ac8cc4b045 fix(plugins): dependencies on plugins built into core are satisfied by the built-in 2026-11-09 19:28:04 +01:00
Emile Bangma 0770178fa5 Merge pull request #2619 from jackyzha0/dev-mode/lockfile-path-fixes
chore: lockfile for alias-redirects 1.0.3 and created-modified-date 1.0.3
2026-11-09 18:44:49 +01:00
saberzero1 8854aebf7d chore: lockfile for alias-redirects 1.0.3 and created-modified-date 1.0.3 (Windows path fixes) 2026-11-09 18:39:22 +01:00
Emile Bangma bebabb1445 Merge pull request #2618 from jackyzha0/dev-mode/windows-local-sources
fix: Windows spellings of local plugin sources; pretty links cut only at /
2026-11-09 18:19:30 +01:00
saberzero1 7d255c3a0b fix(links): shorten pretty link text with path.posix (Windows also cut at a backslash) 2026-11-09 18:14:28 +01:00
saberzero1 f5ef8f738d fix(plugins): recognise .\ and ..\ local plugin sources (Windows spelling) 2026-11-09 18:11:49 +01:00
Emile Bangma e7da9cebf4 Merge pull request #2616 from WhoAmI-WhereAmI/fix/npm-plugin-index-windows
fix: npm plugin index generation on Windows
2026-11-09 18:08:19 +01:00
saberzero1 28581e8e54 test: npm plugins are found through import.meta.resolve; changeset for the Windows plugin index fix 2026-11-09 18:01:48 +01:00
Emile Bangma 4ff86a7809 Merge pull request #2617 from jackyzha0/dev-mode/link-facts
fix(links): link facts as in Obsidian 1.15.0
2026-11-09 16:37:27 +01:00
WhoAmI-WhereAmI 0f294f7139 Fix npm plugin index generation on Windows 2026-11-09 15:51:42 +09:00
17 changed files with 223 additions and 20 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@jackyzha0/quartz": patch
---
A plugin that lists a plugin now built into Quartz in `quartz.dependencies` (`@quartz-community/crawl-links`, `remove-draft` or `content-index`) no longer fails the build with "requires crawl-links. Run: npx quartz plugin add …". The built-in (`configuration.links`, `drafts`, `contentIndex`) satisfies the dependency. A warning is shown when that built-in is disabled. `npx quartz plugin doctor` checks the same way.
+5
View File
@@ -0,0 +1,5 @@
---
"@jackyzha0/quartz": patch
---
On Windows, regenerating `.quartz/plugins/index.ts` (`npm run install-plugins`, which also runs before every `npm run build`) no longer skips npm plugins with "dist/index.d.ts could not be found", which left exports such as `ExternalPlugin.Explorer` undefined. The package's location was read from a `file:` URL's pathname (`/C:/…`), which is not a Windows path.
+5
View File
@@ -0,0 +1,5 @@
---
"@jackyzha0/quartz": patch
---
Plugin fixes for Windows: relative aliases (`./old`, `../x`) redirect to the right page (alias-redirects 1.0.3), and git dates of notes in folders are read from git instead of the filesystem (created-modified-date 1.0.3).
@@ -0,0 +1,7 @@
---
"@jackyzha0/quartz": patch
---
A local plugin source written with Windows separators (`.\my-plugin`, `..\plugins\my-plugin`) is recognised as a local path. Before, it was read as a git or npm source and failed with "Expected github:owner/repo".
Pretty links shorten link text the same way on every OS: Windows also cut it at a backslash (`[[a\b]]` showed `b`).
+8 -8
View File
@@ -13,7 +13,7 @@
"@floating-ui/dom": "^1.7.4",
"@myriaddreamin/rehype-typst": "^0.7.0",
"@napi-rs/simple-git": "1.1.0",
"@quartz-community/alias-redirects": "^1.0.2",
"@quartz-community/alias-redirects": "^1.0.3",
"@quartz-community/article-title": "^1.0.2",
"@quartz-community/backlinks": "^1.0.3",
"@quartz-community/bases-page": "^1.2.1",
@@ -24,7 +24,7 @@
"@quartz-community/comments": "^1.0.2",
"@quartz-community/content-meta": "^1.0.2",
"@quartz-community/content-page": "^1.0.3",
"@quartz-community/created-modified-date": "^1.0.2",
"@quartz-community/created-modified-date": "^1.0.3",
"@quartz-community/darkmode": "^1.0.2",
"@quartz-community/description": "^1.0.2",
"@quartz-community/encrypted-pages": "^1.1.1",
@@ -2354,9 +2354,9 @@
}
},
"node_modules/@quartz-community/alias-redirects": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@quartz-community/alias-redirects/-/alias-redirects-1.0.2.tgz",
"integrity": "sha512-QdcaorfE0UVqy4EnZel0minOHODybU+6v0ZlK4knFFV6QT8ISi8WlL79RnOV51jxRJkRBR3E7CED8kCa3l/RCA==",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@quartz-community/alias-redirects/-/alias-redirects-1.0.3.tgz",
"integrity": "sha512-kA3MiAneoHlC09uQJxF1ex1GktkUf9Rm53b0ybeJrtNEcteRoqBCELHB+pf6hUj9i/k2Epx0J8RyTSe/zwTg2A==",
"license": "MIT",
"dependencies": {
"@quartz-community/types": "^1.0.0",
@@ -2602,9 +2602,9 @@
}
},
"node_modules/@quartz-community/created-modified-date": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@quartz-community/created-modified-date/-/created-modified-date-1.0.2.tgz",
"integrity": "sha512-XMfFV4hwBVrRxtMO8QjWhXqarOHaip483oW3YHfqqcCfInlVCrDHRzAgpurOvTcLrlc60p6S7sZfRXwQYko/Sw==",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@quartz-community/created-modified-date/-/created-modified-date-1.0.3.tgz",
"integrity": "sha512-oSFR4oK5ELG/Ya2Z1ah51P8p7q9dDaNTSg1cA4Op4c1xETfCmwIfS0wx6gF62MsypSR9uRavr+cfDJXxsujjWg==",
"license": "MIT",
"dependencies": {
"@quartz-community/types": "^1.0.0"
+2 -2
View File
@@ -43,7 +43,7 @@
"@floating-ui/dom": "^1.7.4",
"@myriaddreamin/rehype-typst": "^0.7.0",
"@napi-rs/simple-git": "1.1.0",
"@quartz-community/alias-redirects": "^1.0.2",
"@quartz-community/alias-redirects": "^1.0.3",
"@quartz-community/article-title": "^1.0.2",
"@quartz-community/backlinks": "^1.0.3",
"@quartz-community/bases-page": "^1.2.1",
@@ -54,7 +54,7 @@
"@quartz-community/comments": "^1.0.2",
"@quartz-community/content-meta": "^1.0.2",
"@quartz-community/content-page": "^1.0.3",
"@quartz-community/created-modified-date": "^1.0.2",
"@quartz-community/created-modified-date": "^1.0.3",
"@quartz-community/darkmode": "^1.0.2",
"@quartz-community/description": "^1.0.2",
"@quartz-community/encrypted-pages": "^1.1.1",
+4
View File
@@ -264,6 +264,10 @@ export function isLocalSource(source) {
if (url.startsWith("./") || url.startsWith("../") || url.startsWith("/")) {
return true
}
// Windows relative paths (.\plugin, ..\plugin)
if (url.startsWith(".\\") || url.startsWith("..\\")) {
return true
}
// Windows absolute paths (e.g. C:\ or D:/)
if (/^[A-Za-z]:[\\/]/.test(url)) {
return true
+26 -1
View File
@@ -1,7 +1,12 @@
import test, { describe } from "node:test"
import assert from "node:assert"
import YAML from "yaml"
import { stringifyConfigYaml, parseGitSource, extractPluginName } from "./plugin-data.js"
import {
stringifyConfigYaml,
parseGitSource,
extractPluginName,
isLocalSource,
} from "./plugin-data.js"
const ORIGINAL = `# yaml-language-server: $schema=./quartz/plugins/quartz-plugins.schema.json
configuration:
@@ -92,3 +97,23 @@ describe("parseGitSource", () => {
assert.throws(() => parseGitSource("github:onlyowner"), /Expected github:owner\/repo/)
})
})
describe("isLocalSource", () => {
test("recognises local paths in POSIX and Windows spellings", () => {
for (const source of [
"./p",
"../p",
"/p",
".\\p",
"..\\a\\p",
"C:\\a\\p",
"D:/p",
{ repo: ".\\p" },
]) {
assert.ok(isLocalSource(source), JSON.stringify(source))
}
for (const source of ["github:a/b", "a/b", "https://github.com/a/b.git"]) {
assert.ok(!isLocalSource(source), source)
}
})
})
+18
View File
@@ -52,6 +52,7 @@ import {
} from "./subprocess.js"
import { writePluginIndex } from "./plugin-index.js"
import {
builtinKeyFor,
builtinMessage,
describeBuiltins,
findBuiltinMigrations,
@@ -2662,6 +2663,23 @@ export async function handlePluginDoctor({ verbose = false, fix = false } = {})
if (deprecation) report("warning", null, deprecation.message, deprecation.hint)
if (enabled) {
for (const dep of manifest.dependencies ?? []) {
// A plugin that is built into core now (crawl-links → configuration.links, …) is
// satisfied by the built-in: its entries were absorbed above.
const builtinKey = builtinKeyFor(dep)
if (builtinKey) {
const builtin = describeBuiltins(config.data.configuration).find(
(b) => b.key === builtinKey,
)
if (builtin && !builtin.enabled) {
report(
"warning",
label,
`depends on ${dep}, which is built into Quartz now as configuration.${builtinKey} and is disabled`,
`Enable configuration.${builtinKey} in quartz.config.yaml.`,
)
}
continue
}
const depEntry =
enabledSources.get(dep) ??
plugins.find((e) => {
+3 -2
View File
@@ -12,6 +12,7 @@
*/
import fs from "node:fs"
import path from "node:path"
import { fileURLToPath } from "node:url"
import { styleText } from "node:util"
import { isIdentifier, jsString } from "./subprocess.js"
@@ -135,8 +136,8 @@ export function collectPluginExports({ pluginsDir, npmPackages = [], verbose = f
for (const pkg of npmPackages) {
let distIndex
try {
const pkgJson = new URL(import.meta.resolve(`${pkg}/package.json`)).pathname
distIndex = path.join(path.dirname(decodeURIComponent(pkgJson)), "dist", "index.d.ts")
const pkgJson = fileURLToPath(import.meta.resolve(`${pkg}/package.json`))
distIndex = path.join(path.dirname(pkgJson), "dist", "index.d.ts")
} catch {
if (verbose) console.log(styleText("yellow", `⚠`), `Skipping npm package ${pkg}: not found`)
continue
+14
View File
@@ -46,6 +46,20 @@ function fakeSite() {
}
describe("plugin index", () => {
// npm plugins are found through import.meta.resolve, which returns a file: URL. Its pathname
// is not a path on Windows (`/C:/…`), so every npm plugin was skipped there (#2616).
test("npm plugins are found through their package.json", () => {
const pluginsDir = fs.mkdtempSync(path.join(os.tmpdir(), "quartz-plugin-index-npm-"))
const entry = collectPluginExports({
pluginsDir,
npmPackages: ["@quartz-community/explorer"],
}).get("quartz-community__explorer")
assert.ok(entry, "@quartz-community/explorer was skipped")
assert.ok(entry.overridable.includes("Explorer"))
assert.strictEqual(entry.importPath, "@quartz-community/explorer")
fs.rmSync(pluginsDir, { recursive: true, force: true })
})
test("component constructors re-exported from a sub-module are wrapped (#2565)", () => {
const { root, pluginsDir } = fakeSite()
const entry = collectPluginExports({ pluginsDir }).get("my-widget")!
+12 -1
View File
@@ -4,7 +4,7 @@ import { unified } from "unified"
import remarkParse from "remark-parse"
import remarkRehype from "remark-rehype"
import { VFile } from "vfile"
import { Element, Root } from "hast"
import { Element, Root, Text } from "hast"
import { visit } from "unist-util-visit"
import { BUILTINS, instantiateBuiltins, officialPluginName, planBuiltins, PlanInput } from "."
import {
@@ -396,6 +396,17 @@ describe("links built-in", () => {
)
})
test("pretty links keep the last /-separated part of the link text, on every OS", () => {
const { els } = run([a("folder/note"), a("a\\b")], "page", { prettyLinks: true }, [
"folder/note",
"a\\b",
])
assert.deepStrictEqual(
els.filter((e) => e.tagName === "a").map((e) => (e.children[0] as Text).value),
["note", "a\\b"],
)
})
test("disableBrokenWikilinks adds a broken class to missing targets", () => {
const { els } = run([a("missing")], "page", { disableBrokenWikilinks: true }, ["page"])
assert.ok((els[0].properties.className as string[]).includes("broken"))
+2 -1
View File
@@ -166,7 +166,8 @@ export const Links: QuartzTransformerPlugin<LinksConfig> = (userOpts) => {
!textChild.value.startsWith("#") &&
!classes.includes("alias")
) {
textChild.value = path.basename(textChild.value)
// link text is not an OS path: path.posix, or Windows would also cut at a backslash
textChild.value = path.posix.basename(textChild.value)
}
}
}
+53 -1
View File
@@ -1,6 +1,13 @@
import test, { describe, afterEach } from "node:test"
import assert from "node:assert"
import { buildLayoutForEntries, isExcluded, resolveGroups } from "./config-loader"
import {
buildLayoutForEntries,
isExcluded,
resolveGroups,
validateDependencies,
} from "./config-loader"
import { planBuiltins } from "../builtins"
import type { PluginManifest } from "./types"
import { componentRegistry } from "../../components/registry"
import type { QuartzComponent, QuartzComponentConstructor } from "../../components/types"
import { PluginJsonEntry, LayoutPosition } from "./types"
@@ -321,3 +328,48 @@ describe("isExcluded", () => {
assert.ok(!isExcluded("@quartz-community/explorer", ["reader-mode"]))
})
})
// crawl-links, remove-draft and content-index are built into core in 5.1: their entries are
// absorbed before dependencies are checked, so a plugin depending on one must be satisfied by the
// built-in (a community plugin depending on crawl-links failed every 5.1 build).
describe("dependencies on plugins that are built in now", () => {
const source = "github:someone/cloudflare-media"
const check = (configuration: Record<string, unknown>, order?: number) => {
const entry: PluginJsonEntry = { source, enabled: true, options: {}, order }
const manifest = {
name: "cloudflare-media",
category: "transformer",
defaultOrder: 65,
dependencies: ["@quartz-community/crawl-links"],
} as unknown as PluginManifest
const plan = planBuiltins({
configuration,
entries: [],
nameOf: () => "",
providesOf: () => undefined,
})
return validateDependencies([entry], new Map([[source, manifest]]), plan.builtins)
}
test("are satisfied by the enabled built-in", () => {
assert.deepStrictEqual(check({}), { errors: [], warnings: [] })
})
test("warn when the built-in is disabled", () => {
const { errors, warnings } = check({ links: false })
assert.deepStrictEqual(errors, [])
assert.match(warnings[0], /built into Quartz now as configuration\.links and is disabled/)
})
test("must still run after the built-in in the same stage", () => {
const { errors } = check({}, 50)
assert.match(errors[0], /order: 50.*configuration\.links, order: 60/)
})
test("other missing dependencies still fail", () => {
const entry: PluginJsonEntry = { source, enabled: true, options: {} }
const manifest = { dependencies: ["@quartz-community/explorer"] } as unknown as PluginManifest
const { errors } = validateDependencies([entry], new Map([[source, manifest]]), [])
assert.match(errors[0], /requires "@quartz-community\/explorer"/)
})
})
+35 -3
View File
@@ -41,7 +41,13 @@ import {
parseCapabilities,
CapabilityPlugin,
} from "./capabilities"
import { absorbingBuiltin, BuiltinPlan, instantiateBuiltins, planBuiltins } from "../builtins"
import {
absorbingBuiltin,
BuiltinPlan,
instantiateBuiltins,
PlannedBuiltin,
planBuiltins,
} from "../builtins"
import { registerPluginOrigin, reportError, warn } from "../../util/diagnostics"
import { firstPluginFrame } from "../../util/trace"
import {
@@ -146,9 +152,10 @@ interface DependencyValidationResult {
warnings: string[]
}
function validateDependencies(
export function validateDependencies(
entries: PluginJsonEntry[],
manifests: Map<string, PluginManifest>,
builtins: PlannedBuiltin[] = [],
): DependencyValidationResult {
const errors: string[] = []
const warnings: string[] = []
@@ -172,6 +179,31 @@ function validateDependencies(
const depEntry = sourceToEntry.get(dep)
const depName = extractPluginName(dep)
// A plugin that is built into core now (crawl-links → configuration.links, …) has no entry
// to find: its entries are absorbed before this check. The built-in satisfies it.
const builtin = depEntry
? undefined
: builtins.find((b) => b.spec === absorbingBuiltin({ source: dep } as PluginJsonEntry))
if (builtin) {
if (!builtin.enabled) {
warnings.push(
`Plugin "${pluginName}" depends on "${depName}", which is built into Quartz now as ` +
`configuration.${builtin.spec.configKey} and is disabled. "${pluginName}" may not function correctly.`,
)
} else if (
pluginOrder < builtin.order &&
[manifest.category].flat().includes(builtin.spec.category)
) {
// order only decides between plugins of the same stage (a transformer after links)
errors.push(
`Plugin "${pluginName}" (order: ${pluginOrder}) depends on "${depName}" (built in as ` +
`configuration.${builtin.spec.configKey}, order: ${builtin.order}), but "${pluginName}" is ` +
`configured to run first. Increase "${pluginName}"'s order above ${builtin.order}.`,
)
}
continue
}
if (!depEntry) {
errors.push(
`Plugin "${pluginName}" requires "${depName}". Run: npx quartz plugin add ${dep}`,
@@ -473,7 +505,7 @@ export async function loadQuartzConfig(
)
// Validate dependencies
const validation = validateDependencies(enabledEntries, manifests)
const validation = validateDependencies(enabledEntries, manifests, builtinPlan.builtins)
for (const warning of validation.warnings) {
console.warn(styleText("yellow", `⚠`) + ` ${warning}`)
}
+20 -1
View File
@@ -3,7 +3,7 @@ import assert from "node:assert"
import fs from "fs"
import os from "os"
import path from "path"
import { parsePluginSource, readLockedCommit } from "./gitLoader"
import { isLocalSource, parsePluginSource, readLockedCommit } from "./gitLoader"
describe("parsePluginSource", () => {
test("owner/repo shorthand supports #ref", () => {
@@ -13,6 +13,25 @@ describe("parsePluginSource", () => {
assert.strictEqual(spec.ref, "dev")
})
test("local sources are recognised in POSIX and Windows spellings", () => {
for (const source of [
"./plugin",
"../plugin",
"/abs/plugin",
".\\plugin",
"..\\plugins\\x",
"C:\\sites\\plugin",
"D:/plugin",
{ repo: ".\\plugin" },
]) {
assert.ok(isLocalSource(source), JSON.stringify(source))
}
for (const source of ["github:a/b", "a/b", "https://github.com/a/b.git", "@scope/pkg"]) {
assert.ok(!isLocalSource(source), source)
}
assert.strictEqual(parsePluginSource(".\\plugin").local, true)
})
test("unknown sources get an explanatory error", () => {
assert.throws(() => parsePluginSource("explorer"), /Expected github:owner\/repo/)
})
+4
View File
@@ -111,6 +111,10 @@ export function isLocalSource(source: PluginSource): boolean {
if (source.startsWith("./") || source.startsWith("../") || source.startsWith("/")) {
return true
}
// Windows relative paths (.\plugin, ..\plugin)
if (source.startsWith(".\\") || source.startsWith("..\\")) {
return true
}
// Windows absolute paths (e.g. C:\ or D:/)
if (/^[A-Za-z]:[\\/]/.test(source)) {
return true