mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 21:45:42 -05:00
fix: CI
This commit is contained in:
parent
603e8001bc
commit
7100a33807
@ -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:
|
||||
|
||||
@ -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<string, unknown>
|
||||
if (componentsPath) {
|
||||
componentsModule = await import(componentsPath)
|
||||
componentsModule = await import(toFileUrl(componentsPath))
|
||||
} else {
|
||||
componentsModule = await import(`${pluginName}/components`)
|
||||
}
|
||||
|
||||
@ -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<PluginManifest | n
|
||||
try {
|
||||
const gitSpec = parsePluginSource(source)
|
||||
const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir)
|
||||
const module = await import(entryPoint)
|
||||
const module = await import(toFileUrl(entryPoint))
|
||||
return module.manifest ?? null
|
||||
} catch {
|
||||
return null
|
||||
@ -296,7 +296,7 @@ export async function loadQuartzConfig(): Promise<QuartzConfig> {
|
||||
}
|
||||
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<QuartzConfig> {
|
||||
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)
|
||||
}
|
||||
|
||||
@ -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) */
|
||||
|
||||
@ -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 ?? {}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user