The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix relative path resolution in router and link crawling

+160 -106
-2
content/features/upcoming features.md
··· 8 8 - debounce cfg rebuild on large repos 9 9 - investigate content rebuild triggering multiple times even when debounced, causing an esbuild deadlock 10 10 - dereference symlink for npx quartz sync 11 - - test/fix with subpath 12 - - fix docs with deploy from github 13 11 14 12 ## high priority backlog 15 13
+4 -1
content/hosting.md
··· 80 80 uses: actions/deploy-pages@v2 81 81 ``` 82 82 83 - Then, commit these changes by doing `npx quartz sync`. This should deploy your site to `<github-username>.github.io/<repository-name>`. 83 + Then: 84 + 85 + 1. Head to "Settings" tab of your forked repository and in the sidebar, click "Pages". Under "Source", select "GitHub Actions". 86 + 2. Commit these changes by doing `npx quartz sync`. This should deploy your site to `<github-username>.github.io/<repository-name>`. 84 87 85 88 ### Custom Domain 86 89
-10
package-lock.json
··· 72 72 "@types/js-yaml": "^4.0.5", 73 73 "@types/node": "^20.1.2", 74 74 "@types/pretty-time": "^1.1.2", 75 - "@types/serve-handler": "^6.1.1", 76 75 "@types/source-map-support": "^0.5.6", 77 76 "@types/workerpool": "^6.4.0", 78 77 "@types/ws": "^8.5.5", ··· 1477 1476 "resolved": "https://registry.npmjs.org/@types/pretty-time/-/pretty-time-1.1.2.tgz", 1478 1477 "integrity": "sha512-4i+Y+O5H80Rh01lY/3Z0hB/UWc4R64ReE83joEpVsIG3iQWpYx66k6pQh1amJNZquKtJQyu/RcfkTtvL0KwssA==", 1479 1478 "dev": true 1480 - }, 1481 - "node_modules/@types/serve-handler": { 1482 - "version": "6.1.1", 1483 - "resolved": "https://registry.npmjs.org/@types/serve-handler/-/serve-handler-6.1.1.tgz", 1484 - "integrity": "sha512-bIwSmD+OV8w0t2e7EWsuQYlGoS1o5aEdVktgkXaa43Zm0qVWi21xaSRb3DQA1UXD+DJ5bRq1Rgu14ZczB+CjIQ==", 1485 - "dev": true, 1486 - "dependencies": { 1487 - "@types/node": "*" 1488 - } 1489 1479 }, 1490 1480 "node_modules/@types/source-map-support": { 1491 1481 "version": "0.5.6",
+1 -2
package.json
··· 14 14 "scripts": { 15 15 "check": "tsc --noEmit && npx prettier . --check", 16 16 "format": "npx prettier . --write", 17 - "test": "tsx ./quartz/path.test.ts", 17 + "test": "tsx ./quartz/util/path.test.ts", 18 18 "profile": "0x -D prof ./quartz/bootstrap-cli.mjs build --concurrency=1" 19 19 }, 20 20 "keywords": [ ··· 89 89 "@types/js-yaml": "^4.0.5", 90 90 "@types/node": "^20.1.2", 91 91 "@types/pretty-time": "^1.1.2", 92 - "@types/serve-handler": "^6.1.1", 93 92 "@types/source-map-support": "^0.5.6", 94 93 "@types/workerpool": "^6.4.0", 95 94 "@types/ws": "^8.5.5",
+61 -13
quartz/bootstrap-cli.mjs
··· 74 74 default: false, 75 75 describe: "run a local server to live-preview your Quartz", 76 76 }, 77 + baseDir: { 78 + string: true, 79 + describe: "base path to serve your local server on", 80 + }, 77 81 port: { 78 82 number: true, 79 83 default: 8080, ··· 384 388 385 389 await build(clientRefresh) 386 390 const server = http.createServer(async (req, res) => { 387 - await serveHandler(req, res, { 388 - public: argv.output, 389 - directoryListing: false, 390 - trailingSlash: true, 391 - }) 392 - const status = res.statusCode 393 - const statusString = 394 - status >= 200 && status < 300 395 - ? chalk.green(`[${status}]`) 396 - : status >= 300 && status < 400 397 - ? chalk.yellow(`[${status}]`) 398 - : chalk.red(`[${status}]`) 399 - console.log(statusString + chalk.grey(` ${req.url}`)) 391 + const serve = async (fp) => { 392 + await serveHandler(req, res, { 393 + public: argv.output, 394 + directoryListing: false, 395 + }) 396 + const status = res.statusCode 397 + const statusString = 398 + status >= 200 && status < 300 ? chalk.green(`[${status}]`) : chalk.red(`[${status}]`) 399 + console.log(statusString + chalk.grey(` ${req.url}`)) 400 + } 401 + 402 + const redirect = (newFp) => { 403 + res.writeHead(301, { 404 + Location: newFp, 405 + }) 406 + console.log(chalk.yellow("[301]") + chalk.grey(` ${req.url} -> ${newFp}`)) 407 + return res.end() 408 + } 409 + 410 + let fp = req.url?.split("?")[0] ?? "/" 411 + 412 + // handle redirects 413 + if (fp.endsWith("/")) { 414 + // /trailing/ 415 + // does /trailing/index.html exist? if so, serve it 416 + const indexFp = path.posix.join(fp, "index.html") 417 + if (fs.existsSync(path.posix.join(argv.output, indexFp))) { 418 + return serve(indexFp) 419 + } 420 + 421 + // does /trailing.html exist? if so, redirect to /trailing 422 + let base = fp.slice(0, -1) 423 + if (path.extname(base) === "") { 424 + base += ".html" 425 + } 426 + if (fs.existsSync(path.posix.join(argv.output, base))) { 427 + return redirect(base) 428 + } 429 + } else { 430 + // /regular 431 + // does /regular.html exist? if so, serve it 432 + let base = fp 433 + if (path.extname(base) === "") { 434 + base += ".html" 435 + } 436 + if (fs.existsSync(path.posix.join(argv.output, base))) { 437 + return serve(base) 438 + } 439 + 440 + // does /regular/index.html exist? if so, redirect to /regular/ 441 + let indexFp = path.posix.join(fp, "index.html") 442 + if (fs.existsSync(path.posix.join(argv.output, indexFp))) { 443 + return redirect(fp + "/") 444 + } 445 + } 446 + 447 + return serve(fp) 400 448 }) 401 449 server.listen(argv.port) 402 450 console.log(chalk.cyan(`Started a Quartz server listening at http://localhost:${argv.port}`))
+6 -6
quartz/build.ts
··· 1 1 import sourceMapSupport from "source-map-support" 2 2 sourceMapSupport.install(options) 3 3 import path from "path" 4 - import { PerfTimer } from "./perf" 4 + import { PerfTimer } from "./util/perf" 5 5 import { rimraf } from "rimraf" 6 6 import { isGitIgnored } from "globby" 7 7 import chalk from "chalk" ··· 9 9 import { filterContent } from "./processors/filter" 10 10 import { emitContent } from "./processors/emit" 11 11 import cfg from "../quartz.config" 12 - import { FilePath, joinSegments, slugifyFilePath } from "./path" 12 + import { FilePath, joinSegments, slugifyFilePath } from "./util/path" 13 13 import chokidar from "chokidar" 14 14 import { ProcessedContent } from "./plugins/vfile" 15 - import { Argv, BuildCtx } from "./ctx" 16 - import { glob, toPosixPath } from "./glob" 17 - import { trace } from "./trace" 18 - import { options } from "./sourcemap" 15 + import { Argv, BuildCtx } from "./util/ctx" 16 + import { glob, toPosixPath } from "./util/glob" 17 + import { trace } from "./util/trace" 18 + import { options } from "./util/sourcemap" 19 19 20 20 async function buildQuartz(argv: Argv, clientRefresh: () => void) { 21 21 const ctx: BuildCtx = {
+1 -1
quartz/components/Backlinks.tsx
··· 1 1 import { QuartzComponentConstructor, QuartzComponentProps } from "./types" 2 2 import style from "./styles/backlinks.scss" 3 - import { canonicalizeServer, resolveRelative } from "../path" 3 + import { canonicalizeServer, resolveRelative } from "../util/path" 4 4 5 5 function Backlinks({ fileData, allFiles }: QuartzComponentProps) { 6 6 const slug = canonicalizeServer(fileData.slug!)
+2 -2
quartz/components/Head.tsx
··· 1 - import { canonicalizeServer, pathToRoot } from "../path" 2 - import { JSResourceToScriptElement } from "../resources" 1 + import { canonicalizeServer, pathToRoot } from "../util/path" 2 + import { JSResourceToScriptElement } from "../util/resources" 3 3 import { QuartzComponentConstructor, QuartzComponentProps } from "./types" 4 4 5 5 export default (() => {
+1 -1
quartz/components/PageList.tsx
··· 1 - import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../path" 1 + import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../util/path" 2 2 import { QuartzPluginData } from "../plugins/vfile" 3 3 import { Date } from "./Date" 4 4 import { QuartzComponentProps } from "./types"
+1 -1
quartz/components/PageTitle.tsx
··· 1 - import { canonicalizeServer, pathToRoot } from "../path" 1 + import { canonicalizeServer, pathToRoot } from "../util/path" 2 2 import { QuartzComponentConstructor, QuartzComponentProps } from "./types" 3 3 4 4 function PageTitle({ fileData, cfg }: QuartzComponentProps) {
+1 -1
quartz/components/TagList.tsx
··· 1 - import { canonicalizeServer, pathToRoot, slugTag } from "../path" 1 + import { canonicalizeServer, pathToRoot, slugTag } from "../util/path" 2 2 import { QuartzComponentConstructor, QuartzComponentProps } from "./types" 3 3 4 4 function TagList({ fileData }: QuartzComponentProps) {
+1 -1
quartz/components/pages/FolderContent.tsx
··· 5 5 6 6 import style from "../styles/listPage.scss" 7 7 import { PageList } from "../PageList" 8 - import { canonicalizeServer } from "../../path" 8 + import { canonicalizeServer } from "../../util/path" 9 9 10 10 function FolderContent(props: QuartzComponentProps) { 11 11 const { tree, fileData, allFiles } = props
+1 -1
quartz/components/pages/TagContent.tsx
··· 3 3 import { toJsxRuntime } from "hast-util-to-jsx-runtime" 4 4 import style from "../styles/listPage.scss" 5 5 import { PageList } from "../PageList" 6 - import { ServerSlug, canonicalizeServer, getAllSegmentPrefixes } from "../../path" 6 + import { ServerSlug, canonicalizeServer, getAllSegmentPrefixes } from "../../util/path" 7 7 import { QuartzPluginData } from "../../plugins/vfile" 8 8 9 9 const numPages = 10
+2 -2
quartz/components/renderPage.tsx
··· 2 2 import { QuartzComponent, QuartzComponentProps } from "./types" 3 3 import HeaderConstructor from "./Header" 4 4 import BodyConstructor from "./Body" 5 - import { JSResourceToScriptElement, StaticResources } from "../resources" 6 - import { CanonicalSlug, pathToRoot } from "../path" 5 + import { JSResourceToScriptElement, StaticResources } from "../util/resources" 6 + import { CanonicalSlug, pathToRoot } from "../util/path" 7 7 8 8 interface RenderComponents { 9 9 head: QuartzComponent
+1 -1
quartz/components/scripts/graph.inline.ts
··· 1 1 import type { ContentDetails } from "../../plugins/emitters/contentIndex" 2 2 import * as d3 from "d3" 3 3 import { registerEscapeHandler, removeAllChildren } from "./util" 4 - import { CanonicalSlug, getCanonicalSlug, getClientSlug, resolveRelative } from "../../path" 4 + import { CanonicalSlug, getCanonicalSlug, getClientSlug, resolveRelative } from "../../util/path" 5 5 6 6 type NodeData = { 7 7 id: CanonicalSlug
+1 -1
quartz/components/scripts/search.inline.ts
··· 1 1 import { Document } from "flexsearch" 2 2 import { ContentDetails } from "../../plugins/emitters/contentIndex" 3 3 import { registerEscapeHandler, removeAllChildren } from "./util" 4 - import { CanonicalSlug, getClientSlug, resolveRelative } from "../../path" 4 + import { CanonicalSlug, getClientSlug, resolveRelative } from "../../util/path" 5 5 6 6 interface Item { 7 7 id: number
+1 -1
quartz/components/scripts/spa.inline.ts
··· 1 1 import micromorph from "micromorph" 2 - import { CanonicalSlug, RelativeURL, getCanonicalSlug } from "../../path" 2 + import { CanonicalSlug, RelativeURL, getCanonicalSlug } from "../../util/path" 3 3 4 4 // adapted from `micromorph` 5 5 // https://github.com/natemoo-re/micromorph
+1 -1
quartz/ctx.ts quartz/util/ctx.ts
··· 1 - import { QuartzConfig } from "./cfg" 1 + import { QuartzConfig } from "../cfg" 2 2 import { ServerSlug } from "./path" 3 3 4 4 export interface Argv {
quartz/glob.ts quartz/util/glob.ts
quartz/log.ts quartz/util/log.ts
+13 -14
quartz/path.test.ts quartz/util/path.test.ts
··· 53 53 assert(!path.isRelativeURL("abc")) 54 54 assert(!path.isRelativeURL("/abc/def")) 55 55 assert(!path.isRelativeURL("")) 56 - assert(!path.isRelativeURL("../")) 57 - assert(!path.isRelativeURL("./")) 58 56 assert(!path.isRelativeURL("./abc/def.html")) 59 57 assert(!path.isRelativeURL("./abc/def.md")) 60 58 }) ··· 160 158 [ 161 159 ["", "."], 162 160 [".", "."], 163 - ["./", "."], 164 - ["./index", "."], 165 - ["./index.html", "."], 166 - ["./index.md", "."], 161 + ["./", "./"], 162 + ["./index", "./"], 163 + ["./index.html", "./"], 164 + ["./index.md", "./"], 167 165 ["content", "./content"], 168 166 ["content/test.md", "./content/test"], 169 167 ["./content/test.md", "./content/test"], 170 168 ["../content/test.md", "../content/test"], 171 - ["tags/", "./tags"], 172 - ["/tags/", "./tags"], 169 + ["tags/", "./tags/"], 170 + ["/tags/", "./tags/"], 173 171 ["content/with spaces", "./content/with-spaces"], 172 + ["content/with spaces/index", "./content/with-spaces/"], 174 173 ["content/with spaces#and Anchor!", "./content/with-spaces#and-anchor"], 175 174 ], 176 175 path.transformInternalLink, ··· 269 268 test("from a/b/c", () => { 270 269 const cur = "a/b/c" as CanonicalSlug 271 270 assert.strictEqual(path.transformLink(cur, "d", opts), "./d") 272 - assert.strictEqual(path.transformLink(cur, "index", opts), ".") 273 - assert.strictEqual(path.transformLink(cur, "../../index", opts), "../..") 274 - assert.strictEqual(path.transformLink(cur, "../../", opts), "../..") 271 + assert.strictEqual(path.transformLink(cur, "index", opts), "./") 272 + assert.strictEqual(path.transformLink(cur, "../../index", opts), "../../") 273 + assert.strictEqual(path.transformLink(cur, "../../", opts), "../../") 275 274 assert.strictEqual(path.transformLink(cur, "../../e/g/h", opts), "../../e/g/h") 276 275 }) 277 276 278 277 test("from a/b/index", () => { 279 278 const cur = "a/b" as CanonicalSlug 280 - assert.strictEqual(path.transformLink(cur, "../../index", opts), "../..") 281 - assert.strictEqual(path.transformLink(cur, "../../", opts), "../..") 279 + assert.strictEqual(path.transformLink(cur, "../../index", opts), "../../") 280 + assert.strictEqual(path.transformLink(cur, "../../", opts), "../../") 282 281 assert.strictEqual(path.transformLink(cur, "../../e/g/h", opts), "../../e/g/h") 283 282 assert.strictEqual(path.transformLink(cur, "c", opts), "./c") 284 283 }) ··· 286 285 test("from index", () => { 287 286 const cur = "" as CanonicalSlug 288 287 assert.strictEqual(path.transformLink(cur, "e/g/h", opts), "./e/g/h") 289 - assert.strictEqual(path.transformLink(cur, "a/b/index", opts), "./a/b") 288 + assert.strictEqual(path.transformLink(cur, "a/b/index", opts), "./a/b/") 290 289 }) 291 290 }) 292 291 })
+11 -6
quartz/path.ts quartz/util/path.ts
··· 71 71 export type RelativeURL = SlugLike<"relative"> 72 72 export function isRelativeURL(s: string): s is RelativeURL { 73 73 const validStart = /^\.{1,2}/.test(s) 74 - const validEnding = !(s.endsWith("/") || s.endsWith("/index") || s === "index") 74 + const validEnding = !(s.endsWith("/index") || s === "index") 75 75 return validStart && validEnding && !_hasFileExtension(s) 76 76 } 77 77 ··· 133 133 134 134 export function transformInternalLink(link: string): RelativeURL { 135 135 let [fplike, anchor] = splitAnchor(decodeURI(link)) 136 + 137 + const folderPath = 138 + fplike.endsWith("index") || 139 + fplike.endsWith("index.md") || 140 + fplike.endsWith("index.html") || 141 + fplike.endsWith("/") 136 142 let segments = fplike.split("/").filter((x) => x.length > 0) 137 143 let prefix = segments.filter(_isRelativeSegment).join("/") 138 144 let fp = segments.filter((seg) => !_isRelativeSegment(seg)).join("/") ··· 143 149 } 144 150 145 151 fp = canonicalizeServer(slugifyFilePath(fp as FilePath)) 146 - fp = _trimSuffix(fp, "index") 147 - 148 - let joined = joinSegments(_stripSlashes(prefix), _stripSlashes(fp)) 149 - const res = (_addRelativeToStart(joined) + anchor) as RelativeURL 152 + const joined = joinSegments(_stripSlashes(prefix), _stripSlashes(fp)) 153 + const trail = folderPath ? "/" : "" 154 + const res = (_addRelativeToStart(joined) + anchor + trail) as RelativeURL 150 155 return res 151 156 } 152 157 153 - // resolve /a/b/c to ../../ 158 + // resolve /a/b/c to ../../.. 154 159 export function pathToRoot(slug: CanonicalSlug): RelativeURL { 155 160 let rootPath = slug 156 161 .split("/")
quartz/perf.ts quartz/util/perf.ts
+1 -1
quartz/plugins/emitters/aliases.ts
··· 4 4 ServerSlug, 5 5 canonicalizeServer, 6 6 resolveRelative, 7 - } from "../../path" 7 + } from "../../util/path" 8 8 import { QuartzEmitterPlugin } from "../types" 9 9 import path from "path" 10 10
+2 -2
quartz/plugins/emitters/assets.ts
··· 1 - import { FilePath, joinSegments, slugifyFilePath } from "../../path" 1 + import { FilePath, joinSegments, slugifyFilePath } from "../../util/path" 2 2 import { QuartzEmitterPlugin } from "../types" 3 3 import path from "path" 4 4 import fs from "fs" 5 - import { glob } from "../../glob" 5 + import { glob } from "../../util/glob" 6 6 7 7 export const Assets: QuartzEmitterPlugin = () => { 8 8 return {
+4 -4
quartz/plugins/emitters/componentResources.ts
··· 1 - import { FilePath, ServerSlug } from "../../path" 1 + import { FilePath, ServerSlug } from "../../util/path" 2 2 import { QuartzEmitterPlugin } from "../types" 3 3 4 4 // @ts-ignore ··· 9 9 import popoverScript from "../../components/scripts/popover.inline" 10 10 import styles from "../../styles/base.scss" 11 11 import popoverStyle from "../../components/styles/popover.scss" 12 - import { BuildCtx } from "../../ctx" 13 - import { StaticResources } from "../../resources" 12 + import { BuildCtx } from "../../util/ctx" 13 + import { StaticResources } from "../../util/resources" 14 14 import { QuartzComponent } from "../../components/types" 15 - import { googleFontHref, joinStyles } from "../../theme" 15 + import { googleFontHref, joinStyles } from "../../util/theme" 16 16 import { Features, transform } from "lightningcss" 17 17 18 18 type ComponentResources = {
+7 -1
quartz/plugins/emitters/contentIndex.ts
··· 1 1 import { GlobalConfiguration } from "../../cfg" 2 - import { CanonicalSlug, ClientSlug, FilePath, ServerSlug, canonicalizeServer } from "../../path" 2 + import { 3 + CanonicalSlug, 4 + ClientSlug, 5 + FilePath, 6 + ServerSlug, 7 + canonicalizeServer, 8 + } from "../../util/path" 3 9 import { QuartzEmitterPlugin } from "../types" 4 10 import path from "path" 5 11
+1 -1
quartz/plugins/emitters/contentPage.tsx
··· 4 4 import BodyConstructor from "../../components/Body" 5 5 import { pageResources, renderPage } from "../../components/renderPage" 6 6 import { FullPageLayout } from "../../cfg" 7 - import { FilePath, canonicalizeServer } from "../../path" 7 + import { FilePath, canonicalizeServer } from "../../util/path" 8 8 import { defaultContentPageLayout, sharedPageComponents } from "../../../quartz.layout" 9 9 import { Content } from "../../components" 10 10
+7 -1
quartz/plugins/emitters/folderPage.tsx
··· 6 6 import { ProcessedContent, defaultProcessedContent } from "../vfile" 7 7 import { FullPageLayout } from "../../cfg" 8 8 import path from "path" 9 - import { CanonicalSlug, FilePath, ServerSlug, canonicalizeServer, joinSegments } from "../../path" 9 + import { 10 + CanonicalSlug, 11 + FilePath, 12 + ServerSlug, 13 + canonicalizeServer, 14 + joinSegments, 15 + } from "../../util/path" 10 16 import { defaultListPageLayout, sharedPageComponents } from "../../../quartz.layout" 11 17 import { FolderContent } from "../../components" 12 18
+2 -2
quartz/plugins/emitters/static.ts
··· 1 - import { FilePath, QUARTZ, joinSegments } from "../../path" 1 + import { FilePath, QUARTZ, joinSegments } from "../../util/path" 2 2 import { QuartzEmitterPlugin } from "../types" 3 3 import fs from "fs" 4 - import { glob } from "../../glob" 4 + import { glob } from "../../util/glob" 5 5 6 6 export const Static: QuartzEmitterPlugin = () => ({ 7 7 name: "Static",
+2 -2
quartz/plugins/emitters/tagPage.tsx
··· 11 11 ServerSlug, 12 12 getAllSegmentPrefixes, 13 13 joinSegments, 14 - } from "../../path" 14 + } from "../../util/path" 15 15 import { defaultListPageLayout, sharedPageComponents } from "../../../quartz.layout" 16 16 import { TagContent } from "../../components" 17 17 ··· 41 41 allFiles.flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes), 42 42 ) 43 43 // add base tag 44 - tags.add("") 44 + tags.add("index") 45 45 46 46 const tagDescriptions: Record<string, ProcessedContent> = Object.fromEntries( 47 47 [...tags].map((tag) => {
+3 -3
quartz/plugins/index.ts
··· 1 - import { StaticResources } from "../resources" 2 - import { FilePath, ServerSlug } from "../path" 3 - import { BuildCtx } from "../ctx" 1 + import { StaticResources } from "../util/resources" 2 + import { FilePath, ServerSlug } from "../util/path" 3 + import { BuildCtx } from "../util/ctx" 4 4 5 5 export function getStaticResourcesFromPlugins(ctx: BuildCtx) { 6 6 const staticResources: StaticResources = {
+1 -1
quartz/plugins/transformers/frontmatter.ts
··· 2 2 import remarkFrontmatter from "remark-frontmatter" 3 3 import { QuartzTransformerPlugin } from "../types" 4 4 import yaml from "js-yaml" 5 - import { slugTag } from "../../path" 5 + import { slugTag } from "../../util/path" 6 6 7 7 export interface Options { 8 8 delims: string | string[]
+1 -1
quartz/plugins/transformers/links.ts
··· 8 8 joinSegments, 9 9 splitAnchor, 10 10 transformLink, 11 - } from "../../path" 11 + } from "../../util/path" 12 12 import path from "path" 13 13 import { visit } from "unist-util-visit" 14 14 import isAbsoluteUrl from "is-absolute-url"
+3 -3
quartz/plugins/transformers/ofm.ts
··· 6 6 import rehypeRaw from "rehype-raw" 7 7 import { visit } from "unist-util-visit" 8 8 import path from "path" 9 - import { JSResource } from "../../resources" 9 + import { JSResource } from "../../util/resources" 10 10 // @ts-ignore 11 11 import calloutScript from "../../components/scripts/callout.inline.ts" 12 - import { FilePath, canonicalizeServer, pathToRoot, slugTag, slugifyFilePath } from "../../path" 12 + import { FilePath, canonicalizeServer, pathToRoot, slugTag, slugifyFilePath } from "../../util/path" 13 13 import { toHast } from "mdast-util-to-hast" 14 14 import { toHtml } from "hast-util-to-html" 15 15 import { PhrasingContent } from "mdast-util-find-and-replace/lib" ··· 294 294 } 295 295 296 296 const text = firstChild.children[0].value 297 - const restChildren = firstChild.children.splice(1) 297 + const restChildren = firstChild.children.slice(1) 298 298 const [firstLine, ...remainingLines] = text.split("\n") 299 299 const remainingText = remainingLines.join("\n") 300 300
+3 -3
quartz/plugins/types.ts
··· 1 1 import { PluggableList } from "unified" 2 - import { StaticResources } from "../resources" 2 + import { StaticResources } from "../util/resources" 3 3 import { ProcessedContent } from "./vfile" 4 4 import { QuartzComponent } from "../components/types" 5 - import { FilePath, ServerSlug } from "../path" 6 - import { BuildCtx } from "../ctx" 5 + import { FilePath, ServerSlug } from "../util/path" 6 + import { BuildCtx } from "../util/ctx" 7 7 8 8 export interface PluginTypes { 9 9 transformers: QuartzTransformerPluginInstance[]
+5 -5
quartz/processors/emit.ts
··· 1 1 import path from "path" 2 2 import fs from "fs" 3 - import { PerfTimer } from "../perf" 3 + import { PerfTimer } from "../util/perf" 4 4 import { getStaticResourcesFromPlugins } from "../plugins" 5 5 import { EmitCallback } from "../plugins/types" 6 6 import { ProcessedContent } from "../plugins/vfile" 7 - import { FilePath, joinSegments } from "../path" 8 - import { QuartzLogger } from "../log" 9 - import { trace } from "../trace" 10 - import { BuildCtx } from "../ctx" 7 + import { FilePath, joinSegments } from "../util/path" 8 + import { QuartzLogger } from "../util/log" 9 + import { trace } from "../util/trace" 10 + import { BuildCtx } from "../util/ctx" 11 11 12 12 export async function emitContent(ctx: BuildCtx, content: ProcessedContent[]) { 13 13 const { argv, cfg } = ctx
+2 -2
quartz/processors/filter.ts
··· 1 - import { BuildCtx } from "../ctx" 2 - import { PerfTimer } from "../perf" 1 + import { BuildCtx } from "../util/ctx" 2 + import { PerfTimer } from "../util/perf" 3 3 import { ProcessedContent } from "../plugins/vfile" 4 4 5 5 export function filterContent(ctx: BuildCtx, content: ProcessedContent[]): ProcessedContent[] {
+5 -5
quartz/processors/parse.ts
··· 5 5 import { Root as MDRoot } from "remark-parse/lib" 6 6 import { Root as HTMLRoot } from "hast" 7 7 import { ProcessedContent } from "../plugins/vfile" 8 - import { PerfTimer } from "../perf" 8 + import { PerfTimer } from "../util/perf" 9 9 import { read } from "to-vfile" 10 - import { FilePath, QUARTZ, slugifyFilePath } from "../path" 10 + import { FilePath, QUARTZ, slugifyFilePath } from "../util/path" 11 11 import path from "path" 12 12 import workerpool, { Promise as WorkerPromise } from "workerpool" 13 - import { QuartzLogger } from "../log" 14 - import { trace } from "../trace" 15 - import { BuildCtx } from "../ctx" 13 + import { QuartzLogger } from "../util/log" 14 + import { trace } from "../util/trace" 15 + import { BuildCtx } from "../util/ctx" 16 16 17 17 export type QuartzProcessor = Processor<MDRoot, HTMLRoot, void> 18 18 export function createProcessor(ctx: BuildCtx): QuartzProcessor {
quartz/resources.tsx quartz/util/resources.tsx
quartz/sourcemap.ts quartz/util/sourcemap.ts
quartz/theme.ts quartz/util/theme.ts
quartz/trace.ts quartz/util/trace.ts
+1 -1
quartz/worker.ts
··· 1 1 import sourceMapSupport from "source-map-support" 2 2 sourceMapSupport.install(options) 3 3 import cfg from "../quartz.config" 4 - import { Argv, BuildCtx } from "./ctx" 4 + import { Argv, BuildCtx } from "./util/ctx" 5 5 import { FilePath, ServerSlug } from "./path" 6 6 import { createFileParser, createProcessor } from "./processors/parse" 7 7 import { options } from "./sourcemap"