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: ---
|
delimiters: ---
|
||||||
language: yaml
|
language: yaml
|
||||||
order: 5
|
order: 5
|
||||||
layout:
|
|
||||||
position: beforeBody
|
|
||||||
priority: 15
|
|
||||||
- source: github:quartz-community/created-modified-date
|
- source: github:quartz-community/created-modified-date
|
||||||
enabled: true
|
enabled: true
|
||||||
options:
|
options:
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { componentRegistry } from "../../components/registry"
|
import { componentRegistry } from "../../components/registry"
|
||||||
import { ComponentManifest, PluginManifest } from "./types"
|
import { ComponentManifest, PluginManifest } from "./types"
|
||||||
import { QuartzComponentConstructor } from "../../components/types"
|
import { QuartzComponentConstructor } from "../../components/types"
|
||||||
import { getPluginSubpathEntry } from "./gitLoader"
|
import { getPluginSubpathEntry, toFileUrl } from "./gitLoader"
|
||||||
|
|
||||||
export async function loadComponentsFromPackage(
|
export async function loadComponentsFromPackage(
|
||||||
pluginName: string,
|
pluginName: string,
|
||||||
@ -15,7 +15,7 @@ export async function loadComponentsFromPackage(
|
|||||||
|
|
||||||
let componentsModule: Record<string, unknown>
|
let componentsModule: Record<string, unknown>
|
||||||
if (componentsPath) {
|
if (componentsPath) {
|
||||||
componentsModule = await import(componentsPath)
|
componentsModule = await import(toFileUrl(componentsPath))
|
||||||
} else {
|
} else {
|
||||||
componentsModule = await import(`${pluginName}/components`)
|
componentsModule = await import(`${pluginName}/components`)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import {
|
|||||||
PluginLayoutDeclaration,
|
PluginLayoutDeclaration,
|
||||||
FlexGroupConfig,
|
FlexGroupConfig,
|
||||||
} from "./types"
|
} from "./types"
|
||||||
import { parsePluginSource, installPlugin, getPluginEntryPoint } from "./gitLoader"
|
import { parsePluginSource, installPlugin, getPluginEntryPoint, toFileUrl } from "./gitLoader"
|
||||||
import { loadComponentsFromPackage } from "./componentLoader"
|
import { loadComponentsFromPackage } from "./componentLoader"
|
||||||
import { componentRegistry } from "../../components/registry"
|
import { componentRegistry } from "../../components/registry"
|
||||||
import { getCondition } from "./conditions"
|
import { getCondition } from "./conditions"
|
||||||
@ -157,7 +157,7 @@ async function resolvePluginManifest(source: string): Promise<PluginManifest | n
|
|||||||
try {
|
try {
|
||||||
const gitSpec = parsePluginSource(source)
|
const gitSpec = parsePluginSource(source)
|
||||||
const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir)
|
const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir)
|
||||||
const module = await import(entryPoint)
|
const module = await import(toFileUrl(entryPoint))
|
||||||
return module.manifest ?? null
|
return module.manifest ?? null
|
||||||
} catch {
|
} catch {
|
||||||
return null
|
return null
|
||||||
@ -296,7 +296,7 @@ export async function loadQuartzConfig(): Promise<QuartzConfig> {
|
|||||||
}
|
}
|
||||||
const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir)
|
const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir)
|
||||||
try {
|
try {
|
||||||
const module = await import(entryPoint)
|
const module = await import(toFileUrl(entryPoint))
|
||||||
const detected = detectCategoryFromModule(module)
|
const detected = detectCategoryFromModule(module)
|
||||||
if (detected) {
|
if (detected) {
|
||||||
const target = {
|
const target = {
|
||||||
@ -353,7 +353,7 @@ export async function loadQuartzConfig(): Promise<QuartzConfig> {
|
|||||||
try {
|
try {
|
||||||
const gitSpec = parsePluginSource(entry.source)
|
const gitSpec = parsePluginSource(entry.source)
|
||||||
const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir)
|
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) {
|
if (manifest?.components && Object.keys(manifest.components).length > 0) {
|
||||||
await loadComponentsFromPackage(gitSpec.name, manifest, gitSpec.subdir)
|
await loadComponentsFromPackage(gitSpec.name, manifest, gitSpec.subdir)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,20 @@ import path from "path"
|
|||||||
import git from "isomorphic-git"
|
import git from "isomorphic-git"
|
||||||
import http from "isomorphic-git/http/node"
|
import http from "isomorphic-git/http/node"
|
||||||
import { styleText } from "util"
|
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 {
|
export interface GitPluginSpec {
|
||||||
/** Plugin name (used for directory) */
|
/** Plugin name (used for directory) */
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import {
|
|||||||
QuartzEmitterPlugin,
|
QuartzEmitterPlugin,
|
||||||
QuartzPageTypePlugin,
|
QuartzPageTypePlugin,
|
||||||
} from "../types"
|
} from "../types"
|
||||||
import { parsePluginSource, installPlugin, getPluginEntryPoint } from "./gitLoader"
|
import { parsePluginSource, installPlugin, getPluginEntryPoint, toFileUrl } from "./gitLoader"
|
||||||
|
|
||||||
const MINIMUM_QUARTZ_VERSION = "4.5.0"
|
const MINIMUM_QUARTZ_VERSION = "4.5.0"
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ async function resolveSinglePlugin(
|
|||||||
const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir)
|
const entryPoint = getPluginEntryPoint(gitSpec.name, gitSpec.subdir)
|
||||||
|
|
||||||
// Import the plugin
|
// Import the plugin
|
||||||
const module = await import(entryPoint)
|
const module = await import(toFileUrl(entryPoint))
|
||||||
const importedManifest: PluginManifest | null = module.manifest ?? null
|
const importedManifest: PluginManifest | null = module.manifest ?? null
|
||||||
|
|
||||||
manifest = importedManifest ?? {}
|
manifest = importedManifest ?? {}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user