mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 21:45:42 -05:00
fix: resolve type errors for CI checks
This commit is contained in:
parent
c5ce7ccaa2
commit
c53929b04d
@ -70,6 +70,15 @@ declare module "vfile" {
|
||||
blocks: Record<string, Element>
|
||||
htmlAst: HtmlRoot
|
||||
hasMermaidDiagram: boolean | undefined
|
||||
// from frontmatter transformer (e.g. note-properties)
|
||||
frontmatter: {
|
||||
title: string
|
||||
tags: string[]
|
||||
description?: string
|
||||
socialDescription?: string
|
||||
lang?: string
|
||||
[key: string]: unknown
|
||||
}
|
||||
// from created-modified-date transformer
|
||||
dates: {
|
||||
created: Date
|
||||
|
||||
@ -144,7 +144,8 @@ async function resolveSinglePlugin(
|
||||
pluginSource = "git"
|
||||
}
|
||||
} else if ("plugin" in specifier) {
|
||||
const type = specifier.manifest?.category ?? "transformer"
|
||||
const rawType = specifier.manifest?.category ?? "transformer"
|
||||
const type = Array.isArray(rawType) ? rawType[0] : rawType
|
||||
return {
|
||||
plugin: {
|
||||
plugin: specifier.plugin as QuartzTransformerPlugin,
|
||||
@ -153,10 +154,10 @@ async function resolveSinglePlugin(
|
||||
displayName: specifier.manifest?.displayName ?? "Inline Plugin",
|
||||
description: specifier.manifest?.description ?? "Inline plugin instance",
|
||||
version: specifier.manifest?.version ?? "1.0.0",
|
||||
category: type as "transformer" | "filter" | "emitter",
|
||||
category: rawType,
|
||||
...specifier.manifest,
|
||||
} as PluginManifest,
|
||||
type: type as "transformer" | "filter" | "emitter",
|
||||
type,
|
||||
source: "inline",
|
||||
},
|
||||
error: null,
|
||||
@ -184,9 +185,9 @@ async function resolveSinglePlugin(
|
||||
|
||||
manifest = importedManifest ?? {}
|
||||
|
||||
const detectedType = manifest.category ?? detectPluginType(module)
|
||||
const categoryOrCategories = manifest.category ?? detectPluginType(module)
|
||||
|
||||
if (!detectedType) {
|
||||
if (!categoryOrCategories) {
|
||||
return {
|
||||
plugin: null,
|
||||
error: {
|
||||
@ -197,6 +198,11 @@ async function resolveSinglePlugin(
|
||||
}
|
||||
}
|
||||
|
||||
// Normalize to single category for factory extraction (use primary/first category)
|
||||
const detectedType = Array.isArray(categoryOrCategories)
|
||||
? categoryOrCategories[0]
|
||||
: categoryOrCategories
|
||||
|
||||
const factory = extractPluginFactory(module, detectedType)
|
||||
|
||||
if (!factory) {
|
||||
@ -263,9 +269,9 @@ async function resolveSinglePlugin(
|
||||
await loadComponentsFromPackage(packageName, manifest as PluginManifest)
|
||||
}
|
||||
|
||||
const detectedType = manifest.category ?? detectPluginType(importedModule)
|
||||
const categoryOrCategories = manifest.category ?? detectPluginType(importedModule)
|
||||
|
||||
if (!detectedType) {
|
||||
if (!categoryOrCategories) {
|
||||
return {
|
||||
plugin: null,
|
||||
error: {
|
||||
@ -276,6 +282,11 @@ async function resolveSinglePlugin(
|
||||
}
|
||||
}
|
||||
|
||||
// Normalize to single category for factory extraction (use primary/first category)
|
||||
const detectedType = Array.isArray(categoryOrCategories)
|
||||
? categoryOrCategories[0]
|
||||
: categoryOrCategories
|
||||
|
||||
if (
|
||||
manifest.quartzVersion &&
|
||||
!satisfiesVersion(manifest.quartzVersion, options.quartzVersion)
|
||||
@ -289,7 +300,6 @@ async function resolveSinglePlugin(
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const factory = extractPluginFactory(importedModule, detectedType)
|
||||
|
||||
if (!factory) {
|
||||
|
||||
@ -18,5 +18,11 @@
|
||||
"jsxImportSource": "preact"
|
||||
},
|
||||
"include": ["quartz/**/*.ts", "quartz/**/*.tsx", "*.ts", "*.tsx", "./package.json"],
|
||||
"exclude": ["build/**/*.d.ts", ".quartz/**/src/**", ".quartz/**/test/**", "node_modules/**"]
|
||||
"exclude": [
|
||||
"build/**/*.d.ts",
|
||||
".quartz/**/src/**",
|
||||
".quartz/**/test/**",
|
||||
"node_modules/**",
|
||||
"quartz/cli/tui/**"
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user