fix relative path resolution in router and link crawling

This commit is contained in:
Jacky Zhao
2023-08-16 22:04:15 -07:00
parent 53732b901d
commit b5ab38cb7e
44 changed files with 160 additions and 106 deletions

View File

@ -1,6 +1,6 @@
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
import style from "./styles/backlinks.scss"
import { canonicalizeServer, resolveRelative } from "../path"
import { canonicalizeServer, resolveRelative } from "../util/path"
function Backlinks({ fileData, allFiles }: QuartzComponentProps) {
const slug = canonicalizeServer(fileData.slug!)

View File

@ -1,5 +1,5 @@
import { canonicalizeServer, pathToRoot } from "../path"
import { JSResourceToScriptElement } from "../resources"
import { canonicalizeServer, pathToRoot } from "../util/path"
import { JSResourceToScriptElement } from "../util/resources"
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
export default (() => {

View File

@ -1,4 +1,4 @@
import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../path"
import { CanonicalSlug, canonicalizeServer, resolveRelative } from "../util/path"
import { QuartzPluginData } from "../plugins/vfile"
import { Date } from "./Date"
import { QuartzComponentProps } from "./types"

View File

@ -1,4 +1,4 @@
import { canonicalizeServer, pathToRoot } from "../path"
import { canonicalizeServer, pathToRoot } from "../util/path"
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
function PageTitle({ fileData, cfg }: QuartzComponentProps) {

View File

@ -1,4 +1,4 @@
import { canonicalizeServer, pathToRoot, slugTag } from "../path"
import { canonicalizeServer, pathToRoot, slugTag } from "../util/path"
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
function TagList({ fileData }: QuartzComponentProps) {

View File

@ -5,7 +5,7 @@ import path from "path"
import style from "../styles/listPage.scss"
import { PageList } from "../PageList"
import { canonicalizeServer } from "../../path"
import { canonicalizeServer } from "../../util/path"
function FolderContent(props: QuartzComponentProps) {
const { tree, fileData, allFiles } = props

View File

@ -3,7 +3,7 @@ import { Fragment, jsx, jsxs } from "preact/jsx-runtime"
import { toJsxRuntime } from "hast-util-to-jsx-runtime"
import style from "../styles/listPage.scss"
import { PageList } from "../PageList"
import { ServerSlug, canonicalizeServer, getAllSegmentPrefixes } from "../../path"
import { ServerSlug, canonicalizeServer, getAllSegmentPrefixes } from "../../util/path"
import { QuartzPluginData } from "../../plugins/vfile"
const numPages = 10

View File

@ -2,8 +2,8 @@ import { render } from "preact-render-to-string"
import { QuartzComponent, QuartzComponentProps } from "./types"
import HeaderConstructor from "./Header"
import BodyConstructor from "./Body"
import { JSResourceToScriptElement, StaticResources } from "../resources"
import { CanonicalSlug, pathToRoot } from "../path"
import { JSResourceToScriptElement, StaticResources } from "../util/resources"
import { CanonicalSlug, pathToRoot } from "../util/path"
interface RenderComponents {
head: QuartzComponent

View File

@ -1,7 +1,7 @@
import type { ContentDetails } from "../../plugins/emitters/contentIndex"
import * as d3 from "d3"
import { registerEscapeHandler, removeAllChildren } from "./util"
import { CanonicalSlug, getCanonicalSlug, getClientSlug, resolveRelative } from "../../path"
import { CanonicalSlug, getCanonicalSlug, getClientSlug, resolveRelative } from "../../util/path"
type NodeData = {
id: CanonicalSlug

View File

@ -1,7 +1,7 @@
import { Document } from "flexsearch"
import { ContentDetails } from "../../plugins/emitters/contentIndex"
import { registerEscapeHandler, removeAllChildren } from "./util"
import { CanonicalSlug, getClientSlug, resolveRelative } from "../../path"
import { CanonicalSlug, getClientSlug, resolveRelative } from "../../util/path"
interface Item {
id: number

View File

@ -1,5 +1,5 @@
import micromorph from "micromorph"
import { CanonicalSlug, RelativeURL, getCanonicalSlug } from "../../path"
import { CanonicalSlug, RelativeURL, getCanonicalSlug } from "../../util/path"
// adapted from `micromorph`
// https://github.com/natemoo-re/micromorph