chore: fix types

pull/3017/head
Divyansh Singh 1 year ago
parent b5833f3de4
commit 6f2a2af1ff

@ -92,6 +92,7 @@
"dependencies": {
"@docsearch/css": "^3.5.2",
"@docsearch/js": "^3.5.2",
"@types/markdown-it": "^13.0.1",
"@vue/devtools-api": "^6.5.0",
"@vueuse/core": "^10.4.1",
"@vueuse/integrations": "^10.4.1",
@ -135,7 +136,6 @@
"@types/fs-extra": "^11.0.2",
"@types/lodash.template": "^4.5.1",
"@types/mark.js": "^8.11.8",
"@types/markdown-it": "^13.0.1",
"@types/markdown-it-attrs": "^4.1.0",
"@types/markdown-it-container": "^2.0.6",
"@types/markdown-it-emoji": "^2.0.2",

@ -17,6 +17,9 @@ importers:
'@docsearch/js':
specifier: ^3.5.2
version: 3.5.2(@algolia/client-search@4.20.0)(search-insights@2.8.2)
'@types/markdown-it':
specifier: ^13.0.1
version: 13.0.1
'@vue/devtools-api':
specifier: ^6.5.0
version: 6.5.0
@ -108,9 +111,6 @@ importers:
'@types/mark.js':
specifier: ^8.11.8
version: 8.11.8
'@types/markdown-it':
specifier: ^13.0.1
version: 13.0.1
'@types/markdown-it-attrs':
specifier: ^4.1.0
version: 4.1.0
@ -1258,7 +1258,6 @@ packages:
/@types/linkify-it@3.0.3:
resolution: {integrity: sha512-pTjcqY9E4nOI55Wgpz7eiI8+LzdYnw3qxXCfHyBDdPbYvbyLgWLJGh8EdPvqawwMK1Uo1794AUkkR38Fr0g+2g==}
dev: true
/@types/lodash.template@4.5.1:
resolution: {integrity: sha512-0y71S2dGgmwdkSsyW95JBp8HSZchgKCsjr6F0lsT3eSMtaT3Nn9rcMHU1U4UKu6XjQT3YC6/PNwgFI7k9f+ltw==}
@ -1299,11 +1298,9 @@ packages:
dependencies:
'@types/linkify-it': 3.0.3
'@types/mdurl': 1.0.2
dev: true
/@types/mdurl@1.0.2:
resolution: {integrity: sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==}
dev: true
/@types/micromatch@4.0.2:
resolution: {integrity: sha512-oqXqVb0ci19GtH0vOA/U2TmHTcRY9kuZl4mqUxe0QmJAlIW13kzhuK5pi1i9+ngav8FjpSb9FVS/GE00GLX1VA==}

@ -4,7 +4,10 @@ import glob from 'fast-glob'
import type { SiteConfig } from './config'
import matter from 'gray-matter'
import { normalizePath } from 'vite'
import { createMarkdownRenderer, type MarkdownRenderer } from './markdown'
import {
createMarkdownRenderer,
type MarkdownRenderer
} from './markdown/markdown'
export interface ContentOptions<T = ContentData[]> {
/**

@ -1,18 +1,18 @@
export * from './config'
export * from './server'
export * from './markdown'
export { loadEnv, type Plugin } from 'vite'
export * from './build/build'
export * from './serve/serve'
export * from './init/init'
export * from './config'
export * from './contentLoader'
export * from './postcss'
export * from './init/init'
export * from './markdown/markdown'
export { defineLoader, type LoaderModule } from './plugins/staticDataPlugin'
export { loadEnv, type Plugin } from 'vite'
export * from './postcss/isolateStyles'
export * from './serve/serve'
export * from './server'
// shared types
export type {
SiteData,
DefaultTheme,
HeadConfig,
Header,
DefaultTheme
SiteData
} from '../../types/shared'

@ -17,7 +17,7 @@ import {
type Processor
} from 'shiki-processor'
import type { Logger } from 'vite'
import type { ThemeOptions } from '..'
import type { ThemeOptions } from '../markdown'
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz', 10)

@ -8,7 +8,7 @@ import {
createMarkdownRenderer,
type MarkdownOptions,
type MarkdownRenderer
} from './markdown'
} from './markdown/markdown'
import {
EXTERNAL_URL_RE,
slash,

@ -4,7 +4,7 @@ import MiniSearch from 'minisearch'
import path from 'path'
import type { Plugin, ViteDevServer } from 'vite'
import type { SiteConfig } from '../config'
import { createMarkdownRenderer } from '../markdown'
import { createMarkdownRenderer } from '../markdown/markdown'
import {
resolveSiteDataByRoute,
slash,

@ -3,7 +3,7 @@ import type { UseDarkOptions } from '@vueuse/core'
import type { SitemapStreamOptions } from 'sitemap'
import type { Logger, UserConfig as ViteConfig } from 'vite'
import type { SitemapItem } from './build/generateSitemap'
import type { MarkdownOptions } from './markdown'
import type { MarkdownOptions } from './markdown/markdown'
import type {
Awaitable,
HeadConfig,

57
types/shared.d.ts vendored

@ -1,5 +1,4 @@
// types shared between server and client
import type { MarkdownSfcBlocks } from '@mdit-vue/plugin-sfc'
import type { UseDarkOptions } from '@vueuse/core'
import type { SSRContext } from 'vue/server-renderer'
export type { DefaultTheme } from './default-theme.js'
@ -19,6 +18,62 @@ export interface PageData {
lastUpdated?: number
}
/**
* SFC block extracted from markdown
*/
export interface SfcBlock {
/**
* The type of the block
*/
type: string
/**
* The content, including open-tag and close-tag
*/
content: string
/**
* The content that stripped open-tag and close-tag off
*/
contentStripped: string
/**
* The open-tag
*/
tagOpen: string
/**
* The close-tag
*/
tagClose: string
}
export interface MarkdownSfcBlocks {
/**
* The `<template>` block
*/
template: SfcBlock | null
/**
* The common `<script>` block
*/
script: SfcBlock | null
/**
* The `<script setup>` block
*/
scriptSetup: SfcBlock | null
/**
* All `<script>` blocks.
*
* By default, SFC only allows one `<script>` block and one `<script setup>` block.
* However, some tools may support different types of `<script>`s, so we keep all of them here.
*/
scripts: SfcBlock[]
/**
* All `<style>` blocks.
*/
styles: SfcBlock[]
/**
* All custom blocks.
*/
customBlocks: SfcBlock[]
}
export interface Header {
/**
* The level of the header

Loading…
Cancel
Save