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>
|
blocks: Record<string, Element>
|
||||||
htmlAst: HtmlRoot
|
htmlAst: HtmlRoot
|
||||||
hasMermaidDiagram: boolean | undefined
|
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
|
// from created-modified-date transformer
|
||||||
dates: {
|
dates: {
|
||||||
created: Date
|
created: Date
|
||||||
|
|||||||
@ -144,7 +144,8 @@ async function resolveSinglePlugin(
|
|||||||
pluginSource = "git"
|
pluginSource = "git"
|
||||||
}
|
}
|
||||||
} else if ("plugin" in specifier) {
|
} 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 {
|
return {
|
||||||
plugin: {
|
plugin: {
|
||||||
plugin: specifier.plugin as QuartzTransformerPlugin,
|
plugin: specifier.plugin as QuartzTransformerPlugin,
|
||||||
@ -153,10 +154,10 @@ async function resolveSinglePlugin(
|
|||||||
displayName: specifier.manifest?.displayName ?? "Inline Plugin",
|
displayName: specifier.manifest?.displayName ?? "Inline Plugin",
|
||||||
description: specifier.manifest?.description ?? "Inline plugin instance",
|
description: specifier.manifest?.description ?? "Inline plugin instance",
|
||||||
version: specifier.manifest?.version ?? "1.0.0",
|
version: specifier.manifest?.version ?? "1.0.0",
|
||||||
category: type as "transformer" | "filter" | "emitter",
|
category: rawType,
|
||||||
...specifier.manifest,
|
...specifier.manifest,
|
||||||
} as PluginManifest,
|
} as PluginManifest,
|
||||||
type: type as "transformer" | "filter" | "emitter",
|
type,
|
||||||
source: "inline",
|
source: "inline",
|
||||||
},
|
},
|
||||||
error: null,
|
error: null,
|
||||||
@ -184,9 +185,9 @@ async function resolveSinglePlugin(
|
|||||||
|
|
||||||
manifest = importedManifest ?? {}
|
manifest = importedManifest ?? {}
|
||||||
|
|
||||||
const detectedType = manifest.category ?? detectPluginType(module)
|
const categoryOrCategories = manifest.category ?? detectPluginType(module)
|
||||||
|
|
||||||
if (!detectedType) {
|
if (!categoryOrCategories) {
|
||||||
return {
|
return {
|
||||||
plugin: null,
|
plugin: null,
|
||||||
error: {
|
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)
|
const factory = extractPluginFactory(module, detectedType)
|
||||||
|
|
||||||
if (!factory) {
|
if (!factory) {
|
||||||
@ -263,9 +269,9 @@ async function resolveSinglePlugin(
|
|||||||
await loadComponentsFromPackage(packageName, manifest as PluginManifest)
|
await loadComponentsFromPackage(packageName, manifest as PluginManifest)
|
||||||
}
|
}
|
||||||
|
|
||||||
const detectedType = manifest.category ?? detectPluginType(importedModule)
|
const categoryOrCategories = manifest.category ?? detectPluginType(importedModule)
|
||||||
|
|
||||||
if (!detectedType) {
|
if (!categoryOrCategories) {
|
||||||
return {
|
return {
|
||||||
plugin: null,
|
plugin: null,
|
||||||
error: {
|
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 (
|
if (
|
||||||
manifest.quartzVersion &&
|
manifest.quartzVersion &&
|
||||||
!satisfiesVersion(manifest.quartzVersion, options.quartzVersion)
|
!satisfiesVersion(manifest.quartzVersion, options.quartzVersion)
|
||||||
@ -289,7 +300,6 @@ async function resolveSinglePlugin(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const factory = extractPluginFactory(importedModule, detectedType)
|
const factory = extractPluginFactory(importedModule, detectedType)
|
||||||
|
|
||||||
if (!factory) {
|
if (!factory) {
|
||||||
|
|||||||
@ -18,5 +18,11 @@
|
|||||||
"jsxImportSource": "preact"
|
"jsxImportSource": "preact"
|
||||||
},
|
},
|
||||||
"include": ["quartz/**/*.ts", "quartz/**/*.tsx", "*.ts", "*.tsx", "./package.json"],
|
"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