From eb9bbd1666345e011da410ff7af67ede9fd00f47 Mon Sep 17 00:00:00 2001 From: bfahrenfort <59982409+bfahrenfort@users.noreply.github.com> Date: Sun, 15 Sep 2024 03:10:01 +1000 Subject: [PATCH 01/11] fix: constrain link icon size (#1409) --- quartz/plugins/transformers/links.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/quartz/plugins/transformers/links.ts b/quartz/plugins/transformers/links.ts index 38bc0dc..3e8dbde 100644 --- a/quartz/plugins/transformers/links.ts +++ b/quartz/plugins/transformers/links.ts @@ -67,6 +67,7 @@ export const CrawlLinks: QuartzTransformerPlugin> = (userOpts) properties: { "aria-hidden": "true", class: "external-icon", + style: "max-width:0.8em;max-height:0.8em", viewBox: "0 0 512 512", }, children: [ From cd3bb25626beca6e7e2149320773628f39d31af0 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Sun, 15 Sep 2024 17:25:31 +0200 Subject: [PATCH 02/11] fix: account for subtags in numerical tags (closes #1408) (#1410) --- quartz/plugins/transformers/ofm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index 0dea893..dd743b6 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -324,8 +324,8 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin> replacements.push([ tagRegex, (_value: string, tag: string) => { - // Check if the tag only includes numbers - if (/^\d+$/.test(tag)) { + // Check if the tag only includes numbers and slashes + if (/^[\/\d]+$/.test(tag)) { return false } From 6ea359e55ee6333f27b0a8d59caebdb17b9acbf0 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 15 Sep 2024 16:42:07 -0700 Subject: [PATCH 03/11] perf: have more than 1ms granularity for rebuild detection --- quartz/build.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/quartz/build.ts b/quartz/build.ts index 342a27c..38efe36 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -39,7 +39,7 @@ type BuildData = { type FileEvent = "add" | "change" | "delete" function newBuildId() { - return new Date().toISOString() + return Math.random().toString(36).substring(2, 8) } async function buildQuartz(argv: Argv, mut: Mutex, clientRefresh: () => void) { @@ -162,17 +162,19 @@ async function partialRebuildFromEntrypoint( return } - const buildStart = new Date().getTime() - buildData.lastBuildMs = buildStart + const buildId = newBuildId() + ctx.buildId = buildId + buildData.lastBuildMs = new Date().getTime() const release = await mut.acquire() - if (buildData.lastBuildMs > buildStart) { + + // if there's another build after us, release and let them do it + if (ctx.buildId !== buildId) { release() return } const perf = new PerfTimer() console.log(chalk.yellow("Detected change, rebuilding...")) - ctx.buildId = newBuildId() // UPDATE DEP GRAPH const fp = joinSegments(argv.directory, toPosixPath(filepath)) as FilePath @@ -357,19 +359,19 @@ async function rebuildFromEntrypoint( toRemove.add(filePath) } - const buildStart = new Date().getTime() - buildData.lastBuildMs = buildStart + const buildId = newBuildId() + ctx.buildId = buildId + buildData.lastBuildMs = new Date().getTime() const release = await mut.acquire() // there's another build after us, release and let them do it - if (buildData.lastBuildMs > buildStart) { + if (ctx.buildId !== buildId) { release() return } const perf = new PerfTimer() console.log(chalk.yellow("Detected change, rebuilding...")) - ctx.buildId = newBuildId() try { const filesToRebuild = [...toRebuild].filter((fp) => !toRemove.has(fp)) @@ -405,10 +407,10 @@ async function rebuildFromEntrypoint( } } - release() clientRefresh() toRebuild.clear() toRemove.clear() + release() } export default async (argv: Argv, mut: Mutex, clientRefresh: () => void) => { From 50a78bafa53a6f99aa28911beb2d73e74c4127dd Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 15 Sep 2024 16:47:11 -0700 Subject: [PATCH 04/11] docs: clarify prod hosting --- docs/build.md | 4 ++++ quartz/build.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/build.md b/docs/build.md index 1447687..6005770 100644 --- a/docs/build.md +++ b/docs/build.md @@ -21,3 +21,7 @@ This will start a local web server to run your Quartz on your computer. Open a w > - `--serve`: run a local hot-reloading server to preview your Quartz > - `--port`: what port to run the local preview server on > - `--concurrency`: how many threads to use to parse notes + +> [!warning] Not to be used for production +> Serve mode is intended for local previews only. +> For production workloads, see the page on [[hosting]]. diff --git a/quartz/build.ts b/quartz/build.ts index 38efe36..67ec0da 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -163,7 +163,7 @@ async function partialRebuildFromEntrypoint( } const buildId = newBuildId() - ctx.buildId = buildId + ctx.buildId = buildId buildData.lastBuildMs = new Date().getTime() const release = await mut.acquire() @@ -360,7 +360,7 @@ async function rebuildFromEntrypoint( } const buildId = newBuildId() - ctx.buildId = buildId + ctx.buildId = buildId buildData.lastBuildMs = new Date().getTime() const release = await mut.acquire() From b1c60b8833840229adf18b6e6c1507cfeff2527a Mon Sep 17 00:00:00 2001 From: Alexander Weichart <55558407+AlexW00@users.noreply.github.com> Date: Mon, 16 Sep 2024 02:03:22 +0200 Subject: [PATCH 05/11] Add alexanderweichart.de to showcase.md (#1378) Added my own website ^^ Co-authored-by: Jacky Zhao From 16a9caa555a2d63b7ff8af0731fbfd3231d6225c Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Sun, 15 Sep 2024 18:05:02 -0700 Subject: [PATCH 06/11] perf: eagerly compute explorer nodes to avoid re-render in memoized value --- quartz/components/Explorer.tsx | 76 ++++++++++++++++-------------- quartz/components/ExplorerNode.tsx | 13 ++--- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/quartz/components/Explorer.tsx b/quartz/components/Explorer.tsx index ec7c48e..df876ab 100644 --- a/quartz/components/Explorer.tsx +++ b/quartz/components/Explorer.tsx @@ -7,6 +7,7 @@ import { ExplorerNode, FileNode, Options } from "./ExplorerNode" import { QuartzPluginData } from "../plugins/vfile" import { classNames } from "../util/lang" import { i18n } from "../i18n" +import { VNode } from "preact" // Options interface defined in `ExplorerNode` to avoid circular dependency const defaultOptions = { @@ -44,6 +45,7 @@ export default ((userOpts?: Partial) => { // memoized let fileTree: FileNode let jsonTree: string + let component: VNode let lastBuildId: string = "" function constructFileTree(allFiles: QuartzPluginData[]) { @@ -82,44 +84,46 @@ export default ((userOpts?: Partial) => { if (ctx.buildId !== lastBuildId) { lastBuildId = ctx.buildId constructFileTree(allFiles) + const tree = ExplorerNode({ node: fileTree, opts, fileData }) + component = ( +
+ +
+
    + {tree} +
  • +
+
+
+ ) } - return ( -
- -
-
    - -
  • -
-
-
- ) + return component } Explorer.css = explorerStyle diff --git a/quartz/components/ExplorerNode.tsx b/quartz/components/ExplorerNode.tsx index e57d677..3137a3f 100644 --- a/quartz/components/ExplorerNode.tsx +++ b/quartz/components/ExplorerNode.tsx @@ -224,15 +224,10 @@ export function ExplorerNode({ node, opts, fullPath, fileData }: ExplorerNodePro class="content" data-folderul={folderPath} > - {node.children.map((childNode, i) => ( - - ))} + {node.children.map((childNode) => + // eagerly render children so we can memoize properly + ExplorerNode({ node: childNode, opts, fileData, fullPath: folderPath }), + )} From 9c060f3cf2f95f371b15967997d74486d6941051 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:55:23 -0400 Subject: [PATCH 07/11] chore(deps): bump vfile from 6.0.2 to 6.0.3 (#1421) Bumps [vfile](https://github.com/vfile/vfile) from 6.0.2 to 6.0.3. - [Release notes](https://github.com/vfile/vfile/releases) - [Changelog](https://github.com/vfile/vfile/blob/main/changelog.md) - [Commits](https://github.com/vfile/vfile/compare/6.0.2...6.0.3) --- updated-dependencies: - dependency-name: vfile dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 9 ++++----- package.json | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 98809c6..12614b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,7 +63,7 @@ "toml": "^3.0.0", "unified": "^11.0.5", "unist-util-visit": "^5.0.0", - "vfile": "^6.0.2", + "vfile": "^6.0.3", "workerpool": "^9.1.3", "ws": "^8.18.0", "yargs": "^17.7.2" @@ -6549,12 +6549,11 @@ } }, "node_modules/vfile": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.2.tgz", - "integrity": "sha512-zND7NlS8rJYb/sPqkb13ZvbbUoExdbi4w3SfRrMq6R3FvnLQmmfpajJNITuuYm6AZ5uao9vy4BAos3EXBPf2rg==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", "dependencies": { "@types/unist": "^3.0.0", - "unist-util-stringify-position": "^4.0.0", "vfile-message": "^4.0.0" }, "funding": { diff --git a/package.json b/package.json index 52c87dd..4608deb 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "toml": "^3.0.0", "unified": "^11.0.5", "unist-util-visit": "^5.0.0", - "vfile": "^6.0.2", + "vfile": "^6.0.3", "workerpool": "^9.1.3", "ws": "^8.18.0", "yargs": "^17.7.2" From dad0ae4e3f08288d1d9b36daa37f983e248507d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:55:42 -0400 Subject: [PATCH 08/11] chore(deps-dev): bump @types/node from 22.5.4 to 22.5.5 (#1420) Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.5.4 to 22.5.5. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 12614b6..daac613 100644 --- a/package-lock.json +++ b/package-lock.json @@ -76,7 +76,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^22.5.4", + "@types/node": "^22.5.5", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.12", @@ -1263,9 +1263,9 @@ } }, "node_modules/@types/node": { - "version": "22.5.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz", - "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", + "version": "22.5.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.5.tgz", + "integrity": "sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==", "dev": true, "dependencies": { "undici-types": "~6.19.2" diff --git a/package.json b/package.json index 4608deb..37460b8 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "@types/d3": "^7.4.3", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", - "@types/node": "^22.5.4", + "@types/node": "^22.5.5", "@types/pretty-time": "^1.1.5", "@types/source-map-support": "^0.5.10", "@types/ws": "^8.5.12", From 14cb50de9b77c6d508ef7489b6318f589cce321e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:56:00 -0400 Subject: [PATCH 09/11] chore(deps): bump preact from 10.23.2 to 10.24.0 (#1419) Bumps [preact](https://github.com/preactjs/preact) from 10.23.2 to 10.24.0. - [Release notes](https://github.com/preactjs/preact/releases) - [Commits](https://github.com/preactjs/preact/compare/10.23.2...10.24.0) --- updated-dependencies: - dependency-name: preact dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index daac613..bc0e63c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", "pixi.js": "^8.3.4", - "preact": "^10.23.2", + "preact": "^10.24.0", "preact-render-to-string": "^6.5.10", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", @@ -4855,9 +4855,9 @@ } }, "node_modules/preact": { - "version": "10.23.2", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.23.2.tgz", - "integrity": "sha512-kKYfePf9rzKnxOAKDpsWhg/ysrHPqT+yQ7UW4JjdnqjFIeNUnNcEJvhuA8fDenxAGWzUqtd51DfVg7xp/8T9NA==", + "version": "10.24.0", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.24.0.tgz", + "integrity": "sha512-aK8Cf+jkfyuZ0ZZRG9FbYqwmEiGQ4y/PUO4SuTWoyWL244nZZh7bd5h2APd4rSNDYTBNghg1L+5iJN3Skxtbsw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/preact" diff --git a/package.json b/package.json index 37460b8..5d7c1c9 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "mdast-util-to-string": "^4.0.0", "micromorph": "^0.4.5", "pixi.js": "^8.3.4", - "preact": "^10.23.2", + "preact": "^10.24.0", "preact-render-to-string": "^6.5.10", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", From 9a6e4e2f8022894ee84077950e95ba01ff79b6b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:56:14 -0400 Subject: [PATCH 10/11] chore(deps-dev): bump typescript from 5.5.4 to 5.6.2 (#1418) Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.5.4 to 5.6.2. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml) - [Commits](https://github.com/microsoft/TypeScript/compare/v5.5.4...v5.6.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index bc0e63c..dc1ad97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -84,7 +84,7 @@ "esbuild": "^0.19.9", "prettier": "^3.3.3", "tsx": "^4.19.0", - "typescript": "^5.5.4" + "typescript": "^5.6.2" }, "engines": { "node": "20 || >=22", @@ -6335,9 +6335,9 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/package.json b/package.json index 5d7c1c9..40772ff 100644 --- a/package.json +++ b/package.json @@ -107,6 +107,6 @@ "esbuild": "^0.19.9", "prettier": "^3.3.3", "tsx": "^4.19.0", - "typescript": "^5.5.4" + "typescript": "^5.6.2" } } From 743ef712d514e857549ed67219ad20675d165e4a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:24:03 -0400 Subject: [PATCH 11/11] chore(deps): bump preact-render-to-string from 6.5.10 to 6.5.11 (#1417) Bumps [preact-render-to-string](https://github.com/preactjs/preact-render-to-string) from 6.5.10 to 6.5.11. - [Release notes](https://github.com/preactjs/preact-render-to-string/releases) - [Changelog](https://github.com/preactjs/preact-render-to-string/blob/main/CHANGELOG.md) - [Commits](https://github.com/preactjs/preact-render-to-string/compare/v6.5.10...v6.5.11) --- updated-dependencies: - dependency-name: preact-render-to-string dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index dc1ad97..89287e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "micromorph": "^0.4.5", "pixi.js": "^8.3.4", "preact": "^10.24.0", - "preact-render-to-string": "^6.5.10", + "preact-render-to-string": "^6.5.11", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", "reading-time": "^1.5.0", @@ -4864,9 +4864,9 @@ } }, "node_modules/preact-render-to-string": { - "version": "6.5.10", - "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.5.10.tgz", - "integrity": "sha512-BJdypTQaBA5UbTF9NKZS3zP93Sw33tZOxNXIfuHofqOZFoMdsquNkVebs/HkEw0in/Qbi6Ep/Anngnj+VsHeBQ==", + "version": "6.5.11", + "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-6.5.11.tgz", + "integrity": "sha512-ubnauqoGczeGISiOh6RjX0/cdaF8v/oDXIjO85XALCQjwQP+SB4RDXXtvZ6yTYSjG+PC1QRP2AhPgCEsM2EvUw==", "peerDependencies": { "preact": ">=10" } diff --git a/package.json b/package.json index 40772ff..b24f667 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "micromorph": "^0.4.5", "pixi.js": "^8.3.4", "preact": "^10.24.0", - "preact-render-to-string": "^6.5.10", + "preact-render-to-string": "^6.5.11", "pretty-bytes": "^6.1.1", "pretty-time": "^1.1.0", "reading-time": "^1.5.0",