fix relative path resolution in router and link crawling
This commit is contained in:
		@@ -4,7 +4,7 @@ import {
 | 
			
		||||
  ServerSlug,
 | 
			
		||||
  canonicalizeServer,
 | 
			
		||||
  resolveRelative,
 | 
			
		||||
} from "../../path"
 | 
			
		||||
} from "../../util/path"
 | 
			
		||||
import { QuartzEmitterPlugin } from "../types"
 | 
			
		||||
import path from "path"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
import { FilePath, joinSegments, slugifyFilePath } from "../../path"
 | 
			
		||||
import { FilePath, joinSegments, slugifyFilePath } from "../../util/path"
 | 
			
		||||
import { QuartzEmitterPlugin } from "../types"
 | 
			
		||||
import path from "path"
 | 
			
		||||
import fs from "fs"
 | 
			
		||||
import { glob } from "../../glob"
 | 
			
		||||
import { glob } from "../../util/glob"
 | 
			
		||||
 | 
			
		||||
export const Assets: QuartzEmitterPlugin = () => {
 | 
			
		||||
  return {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { FilePath, ServerSlug } from "../../path"
 | 
			
		||||
import { FilePath, ServerSlug } from "../../util/path"
 | 
			
		||||
import { QuartzEmitterPlugin } from "../types"
 | 
			
		||||
 | 
			
		||||
// @ts-ignore
 | 
			
		||||
@@ -9,10 +9,10 @@ import plausibleScript from "../../components/scripts/plausible.inline"
 | 
			
		||||
import popoverScript from "../../components/scripts/popover.inline"
 | 
			
		||||
import styles from "../../styles/base.scss"
 | 
			
		||||
import popoverStyle from "../../components/styles/popover.scss"
 | 
			
		||||
import { BuildCtx } from "../../ctx"
 | 
			
		||||
import { StaticResources } from "../../resources"
 | 
			
		||||
import { BuildCtx } from "../../util/ctx"
 | 
			
		||||
import { StaticResources } from "../../util/resources"
 | 
			
		||||
import { QuartzComponent } from "../../components/types"
 | 
			
		||||
import { googleFontHref, joinStyles } from "../../theme"
 | 
			
		||||
import { googleFontHref, joinStyles } from "../../util/theme"
 | 
			
		||||
import { Features, transform } from "lightningcss"
 | 
			
		||||
 | 
			
		||||
type ComponentResources = {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,11 @@
 | 
			
		||||
import { GlobalConfiguration } from "../../cfg"
 | 
			
		||||
import { CanonicalSlug, ClientSlug, FilePath, ServerSlug, canonicalizeServer } from "../../path"
 | 
			
		||||
import {
 | 
			
		||||
  CanonicalSlug,
 | 
			
		||||
  ClientSlug,
 | 
			
		||||
  FilePath,
 | 
			
		||||
  ServerSlug,
 | 
			
		||||
  canonicalizeServer,
 | 
			
		||||
} from "../../util/path"
 | 
			
		||||
import { QuartzEmitterPlugin } from "../types"
 | 
			
		||||
import path from "path"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import HeaderConstructor from "../../components/Header"
 | 
			
		||||
import BodyConstructor from "../../components/Body"
 | 
			
		||||
import { pageResources, renderPage } from "../../components/renderPage"
 | 
			
		||||
import { FullPageLayout } from "../../cfg"
 | 
			
		||||
import { FilePath, canonicalizeServer } from "../../path"
 | 
			
		||||
import { FilePath, canonicalizeServer } from "../../util/path"
 | 
			
		||||
import { defaultContentPageLayout, sharedPageComponents } from "../../../quartz.layout"
 | 
			
		||||
import { Content } from "../../components"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,13 @@ import { pageResources, renderPage } from "../../components/renderPage"
 | 
			
		||||
import { ProcessedContent, defaultProcessedContent } from "../vfile"
 | 
			
		||||
import { FullPageLayout } from "../../cfg"
 | 
			
		||||
import path from "path"
 | 
			
		||||
import { CanonicalSlug, FilePath, ServerSlug, canonicalizeServer, joinSegments } from "../../path"
 | 
			
		||||
import {
 | 
			
		||||
  CanonicalSlug,
 | 
			
		||||
  FilePath,
 | 
			
		||||
  ServerSlug,
 | 
			
		||||
  canonicalizeServer,
 | 
			
		||||
  joinSegments,
 | 
			
		||||
} from "../../util/path"
 | 
			
		||||
import { defaultListPageLayout, sharedPageComponents } from "../../../quartz.layout"
 | 
			
		||||
import { FolderContent } from "../../components"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import { FilePath, QUARTZ, joinSegments } from "../../path"
 | 
			
		||||
import { FilePath, QUARTZ, joinSegments } from "../../util/path"
 | 
			
		||||
import { QuartzEmitterPlugin } from "../types"
 | 
			
		||||
import fs from "fs"
 | 
			
		||||
import { glob } from "../../glob"
 | 
			
		||||
import { glob } from "../../util/glob"
 | 
			
		||||
 | 
			
		||||
export const Static: QuartzEmitterPlugin = () => ({
 | 
			
		||||
  name: "Static",
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ import {
 | 
			
		||||
  ServerSlug,
 | 
			
		||||
  getAllSegmentPrefixes,
 | 
			
		||||
  joinSegments,
 | 
			
		||||
} from "../../path"
 | 
			
		||||
} from "../../util/path"
 | 
			
		||||
import { defaultListPageLayout, sharedPageComponents } from "../../../quartz.layout"
 | 
			
		||||
import { TagContent } from "../../components"
 | 
			
		||||
 | 
			
		||||
@@ -41,7 +41,7 @@ export const TagPage: QuartzEmitterPlugin<FullPageLayout> = (userOpts) => {
 | 
			
		||||
        allFiles.flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes),
 | 
			
		||||
      )
 | 
			
		||||
      // add base tag
 | 
			
		||||
      tags.add("")
 | 
			
		||||
      tags.add("index")
 | 
			
		||||
 | 
			
		||||
      const tagDescriptions: Record<string, ProcessedContent> = Object.fromEntries(
 | 
			
		||||
        [...tags].map((tag) => {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { StaticResources } from "../resources"
 | 
			
		||||
import { FilePath, ServerSlug } from "../path"
 | 
			
		||||
import { BuildCtx } from "../ctx"
 | 
			
		||||
import { StaticResources } from "../util/resources"
 | 
			
		||||
import { FilePath, ServerSlug } from "../util/path"
 | 
			
		||||
import { BuildCtx } from "../util/ctx"
 | 
			
		||||
 | 
			
		||||
export function getStaticResourcesFromPlugins(ctx: BuildCtx) {
 | 
			
		||||
  const staticResources: StaticResources = {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import matter from "gray-matter"
 | 
			
		||||
import remarkFrontmatter from "remark-frontmatter"
 | 
			
		||||
import { QuartzTransformerPlugin } from "../types"
 | 
			
		||||
import yaml from "js-yaml"
 | 
			
		||||
import { slugTag } from "../../path"
 | 
			
		||||
import { slugTag } from "../../util/path"
 | 
			
		||||
 | 
			
		||||
export interface Options {
 | 
			
		||||
  delims: string | string[]
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ import {
 | 
			
		||||
  joinSegments,
 | 
			
		||||
  splitAnchor,
 | 
			
		||||
  transformLink,
 | 
			
		||||
} from "../../path"
 | 
			
		||||
} from "../../util/path"
 | 
			
		||||
import path from "path"
 | 
			
		||||
import { visit } from "unist-util-visit"
 | 
			
		||||
import isAbsoluteUrl from "is-absolute-url"
 | 
			
		||||
 
 | 
			
		||||
@@ -6,10 +6,10 @@ import { slug as slugAnchor } from "github-slugger"
 | 
			
		||||
import rehypeRaw from "rehype-raw"
 | 
			
		||||
import { visit } from "unist-util-visit"
 | 
			
		||||
import path from "path"
 | 
			
		||||
import { JSResource } from "../../resources"
 | 
			
		||||
import { JSResource } from "../../util/resources"
 | 
			
		||||
// @ts-ignore
 | 
			
		||||
import calloutScript from "../../components/scripts/callout.inline.ts"
 | 
			
		||||
import { FilePath, canonicalizeServer, pathToRoot, slugTag, slugifyFilePath } from "../../path"
 | 
			
		||||
import { FilePath, canonicalizeServer, pathToRoot, slugTag, slugifyFilePath } from "../../util/path"
 | 
			
		||||
import { toHast } from "mdast-util-to-hast"
 | 
			
		||||
import { toHtml } from "hast-util-to-html"
 | 
			
		||||
import { PhrasingContent } from "mdast-util-find-and-replace/lib"
 | 
			
		||||
@@ -294,7 +294,7 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              const text = firstChild.children[0].value
 | 
			
		||||
              const restChildren = firstChild.children.splice(1)
 | 
			
		||||
              const restChildren = firstChild.children.slice(1)
 | 
			
		||||
              const [firstLine, ...remainingLines] = text.split("\n")
 | 
			
		||||
              const remainingText = remainingLines.join("\n")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
import { PluggableList } from "unified"
 | 
			
		||||
import { StaticResources } from "../resources"
 | 
			
		||||
import { StaticResources } from "../util/resources"
 | 
			
		||||
import { ProcessedContent } from "./vfile"
 | 
			
		||||
import { QuartzComponent } from "../components/types"
 | 
			
		||||
import { FilePath, ServerSlug } from "../path"
 | 
			
		||||
import { BuildCtx } from "../ctx"
 | 
			
		||||
import { FilePath, ServerSlug } from "../util/path"
 | 
			
		||||
import { BuildCtx } from "../util/ctx"
 | 
			
		||||
 | 
			
		||||
export interface PluginTypes {
 | 
			
		||||
  transformers: QuartzTransformerPluginInstance[]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user