From 7100a33807d80726c829b12a49c487a0d27747ad Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Tue, 24 Feb 2026 01:41:51 +0100 Subject: [PATCH] fix: CI --- quartz.config.yaml | 3 --- quartz/plugins/loader/componentLoader.ts | 4 ++-- quartz/plugins/loader/config-loader.ts | 8 ++++---- quartz/plugins/loader/gitLoader.ts | 14 ++++++++++++++ quartz/plugins/loader/index.ts | 4 ++-- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/quartz.config.yaml b/quartz.config.yaml index 71e19d939..06c8ec502 100644 --- a/quartz.config.yaml +++ b/quartz.config.yaml @@ -55,9 +55,6 @@ plugins: delimiters: --- language: yaml order: 5 - layout: - position: beforeBody - priority: 15 - source: github:quartz-community/created-modified-date enabled: true options: diff --git a/quartz/plugins/loader/componentLoader.ts b/quartz/plugins/loader/componentLoader.ts index 65b7816f4..f7034b9ac 100644 --- a/quartz/plugins/loader/componentLoader.ts +++ b/quartz/plugins/loader/componentLoader.ts @@ -1,7 +1,7 @@ import { componentRegistry } from "../../components/registry" import { ComponentManifest, PluginManifest } from "./types" import { QuartzComponentConstructor } from "../../components/types" -import { getPluginSubpathEntry } from "./gitLoader" +import { getPluginSubpathEntry, toFileUrl } from "./gitLoader" export async function loadComponentsFromPackage( pluginName: string, @@ -15,7 +15,7 @@ export async function loadComponentsFromPackage( let componentsModule: Record if (componentsPath) { - componentsModule = await import(componentsPath) + componentsModule = await import(toFileUrl(componentsPath)) } else { componentsModule = await import(`${pluginName}/components`) } diff --git a/quartz/plugins/loader/config-loader.ts b/quartz/plugins/loader/config-loader.ts index fd46938b4..891056509 100644 --- a/quartz/plugins/loader/config-loader.ts +++ b/quartz/plugins/loader/config-loader.ts @@ -13,7 +13,7 @@ import { PluginLayoutDeclaration, FlexGroupConfig, } from "./types" -import { parsePluginSource, installPlugin, getPluginEntryPoint } from "./gitLoader" +import { parsePluginSource, installPlugin, getPluginEntryPoint, toFileUrl } from "./gitLoader" import { loadComponentsFromPackage } from "./componentLoader" import { componentRegistry } from "../../components/registry" import { getCondition } from "./conditions" @@ -157,7 +157,7 @@ async function resolvePluginManifest(source: string): Promise { } const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir) try { - const module = await import(entryPoint) + const module = await import(toFileUrl(entryPoint)) const detected = detectCategoryFromModule(module) if (detected) { const target = { @@ -353,7 +353,7 @@ export async function loadQuartzConfig(): Promise { try { const gitSpec = parsePluginSource(entry.source) const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir) - const module = await import(entryPoint) + const module = await import(toFileUrl(entryPoint)) if (manifest?.components && Object.keys(manifest.components).length > 0) { await loadComponentsFromPackage(gitSpec.name, manifest, gitSpec.subdir) } diff --git a/quartz/plugins/loader/gitLoader.ts b/quartz/plugins/loader/gitLoader.ts index 1c709a59c..92c09410c 100644 --- a/quartz/plugins/loader/gitLoader.ts +++ b/quartz/plugins/loader/gitLoader.ts @@ -3,6 +3,20 @@ import path from "path" import git from "isomorphic-git" import http from "isomorphic-git/http/node" import { styleText } from "util" +import { pathToFileURL } from "url" + +/** + * Convert an absolute filesystem path to a file:// URL string for use with dynamic import(). + * On Windows, absolute paths like D:\path\file.js have "D:" interpreted as a URL protocol + * by Node ESM, so they must be converted to file:// URLs. + * Non-absolute paths (e.g. npm package names) are returned as-is. + */ +export function toFileUrl(filePath: string): string { + if (path.isAbsolute(filePath)) { + return pathToFileURL(filePath).href + } + return filePath +} export interface GitPluginSpec { /** Plugin name (used for directory) */ diff --git a/quartz/plugins/loader/index.ts b/quartz/plugins/loader/index.ts index e12cd5d7e..dad4a0cea 100644 --- a/quartz/plugins/loader/index.ts +++ b/quartz/plugins/loader/index.ts @@ -14,7 +14,7 @@ import { QuartzEmitterPlugin, QuartzPageTypePlugin, } from "../types" -import { parsePluginSource, installPlugin, getPluginEntryPoint } from "./gitLoader" +import { parsePluginSource, installPlugin, getPluginEntryPoint, toFileUrl } from "./gitLoader" const MINIMUM_QUARTZ_VERSION = "4.5.0" @@ -181,7 +181,7 @@ async function resolveSinglePlugin( const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir) // Import the plugin - const module = await import(entryPoint) + const module = await import(toFileUrl(entryPoint)) const importedManifest: PluginManifest | null = module.manifest ?? null manifest = importedManifest ?? {}