///
import * as vite from 'vite';
import { Logger, UserConfig as UserConfig$1, ConfigEnv, BuildOptions, ServerOptions } from 'vite';
export { ConfigEnv, Plugin, loadEnv } from 'vite';
import MarkdownIt, { Options as Options$2, PresetName, PluginSimple as PluginSimple$1, PluginWithOptions as PluginWithOptions$1, PluginWithParams as PluginWithParams$1 } from 'markdown-it';
import { PageSplitSection } from '../../types/local-search.js';
import { SiteData, MarkdownEnv, Awaitable, LocaleSpecificConfig, LocaleConfig, SSGContext, PageData, HeadConfig, AdditionalConfigDict, AdditionalConfigLoader, AdditionalConfig } from '../../types/shared.js';
export { HeadConfig, Header, SiteData } from '../../types/shared.js';
import { Options as Options$3 } from '@vitejs/plugin-vue';
import { UseDarkOptions } from '@vueuse/core';
import { TransformOptions } from 'stream';
import { ThemeRegistrationAny, LanguageInput, ShikiTransformer } from '@shikijs/types';
import Token from 'markdown-it/lib/token.mjs';
import State from 'markdown-it/lib/rules_core/state_core.mjs';
import { BuiltinTheme, BuiltinLanguage, Highlighter } from 'shiki';
import { DefaultTheme } from '../../types/default-theme.js';
export { DefaultTheme } from '../../types/default-theme.js';
import { Plugin } from 'postcss';
import { IncomingMessage, ServerResponse } from 'http';
import { Server, ListenOptions } from 'net';
type PluginSimple = ((md: MarkdownItAsync) => void);
type PluginWithOptions = ((md: MarkdownItAsync, options?: T) => void);
type PluginWithParams = ((md: MarkdownItAsync, ...params: any[]) => void);
interface MarkdownItAsyncOptions extends Omit {
/**
* Highlighter function for fenced code blocks.
* Highlighter `function (str, lang, attrs)` should return escaped HTML. It can
* also return empty string if the source was not changed and should be escaped
* externally. If result starts with string | Promise) | null | undefined;
/**
* Emit warning when calling `md.render` instead of `md.renderAsync`.
*
* @default false
*/
warnOnSyncRender?: boolean;
}
type MarkdownItAsyncPlaceholderMap = Map, str: string, lang: string, attrs: string]>;
declare class MarkdownItAsync extends MarkdownIt {
// @ts-ignore
options: MarkdownItAsyncOptions
placeholderMap: MarkdownItAsyncPlaceholderMap;
private disableWarn;
constructor(presetName: PresetName, options?: MarkdownItAsyncOptions);
constructor(options?: MarkdownItAsyncOptions);
use(plugin: PluginSimple): this;
use(plugin: PluginSimple$1): this;
use(plugin: PluginWithOptions, options?: T): this;
use(plugin: PluginWithOptions$1, options?: T): this;
use(plugin: PluginWithParams, ...params: any[]): this;
use(plugin: PluginWithParams$1, ...params: any[]): this;
render(src: string, env?: any): string;
renderAsync(src: string, env?: any): Promise;
}
/**
* this merges the locales data to the main data by the route
*/
declare function resolveSiteDataByRoute(siteData: SiteData, relativePath: string): SiteData;
declare module '../../types/default-theme.js' {
namespace DefaultTheme {
interface LocalSearchOptions {
/**
* Allows transformation of content before indexing (node only)
* Return empty string to skip indexing
*/
_render?: (src: string, env: MarkdownEnv, md: MarkdownItAsync) => Awaitable;
}
interface MiniSearchOptions {
/**
* Overrides the default regex based page splitter.
* Supports async generator, making it possible to run in true parallel
* (when used along with `node:child_process` or `worker_threads`)
* ---
* This should be especially useful for scalability reasons.
* ---
* @param {string} path - absolute path to the markdown source file
* @param {string} html - document page rendered as html
*/
_splitIntoSections?: (path: string, html: string) => AsyncGenerator | Generator | Awaitable;
}
}
}
/**
* How frequently the page is likely to change. This value provides general
* information to search engines and may not correlate exactly to how often they crawl the page. Please note that the
* value of this tag is considered a hint and not a command. See
* for the acceptable
* values
*/
declare enum EnumChangefreq {
DAILY = "daily",
MONTHLY = "monthly",
ALWAYS = "always",
HOURLY = "hourly",
WEEKLY = "weekly",
YEARLY = "yearly",
NEVER = "never"
}
/**
* https://support.google.com/webmasters/answer/74288?hl=en&ref_topic=4581190
*/
interface NewsItem {
access?: 'Registration' | 'Subscription';
publication: {
name: string;
/**
* The `` is the language of your publication. Use an ISO 639
* language code (2 or 3 letters).
*/
language: string;
};
/**
* @example 'PressRelease, Blog'
*/
genres?: string;
/**
* Article publication date in W3C format, using either the "complete date" (YYYY-MM-DD) format or the "complete date
* plus hours, minutes, and seconds"
*/
publication_date: string;
/**
* The title of the news article
* @example 'Companies A, B in Merger Talks'
*/
title: string;
/**
* @example 'business, merger, acquisition'
*/
keywords?: string;
/**
* @example 'NASDAQ:A, NASDAQ:B'
*/
stock_tickers?: string;
}
/**
* Sitemap Image
* https://support.google.com/webmasters/answer/178636?hl=en&ref_topic=4581190
*/
interface Img {
/**
* The URL of the image
* @example 'https://example.com/image.jpg'
*/
url: string;
/**
* The caption of the image
* @example 'Thanksgiving dinner'
*/
caption?: string;
/**
* The title of the image
* @example 'Star Wars EP IV'
*/
title?: string;
/**
* The geographic location of the image.
* @example 'Limerick, Ireland'
*/
geoLocation?: string;
/**
* A URL to the license of the image.
* @example 'https://example.com/license.txt'
*/
license?: string;
}
/**
* https://support.google.com/webmasters/answer/189077
*/
interface LinkItem {
/**
* @example 'en'
*/
lang: string;
/**
* @example 'en-us'
*/
hreflang?: string;
url: string;
}
/**
* How to handle errors in passed in urls
*/
declare enum ErrorLevel {
/**
* Validation will be skipped and nothing logged or thrown.
*/
SILENT = "silent",
/**
* If an invalid value is encountered, a console.warn will be called with details
*/
WARN = "warn",
/**
* An Error will be thrown on encountering invalid data.
*/
THROW = "throw"
}
declare type ErrorHandler$1 = (error: Error, level: ErrorLevel) => void;
interface NSArgs {
news: boolean;
video: boolean;
xhtml: boolean;
image: boolean;
custom?: string[];
}
interface SitemapStreamOptions extends TransformOptions {
hostname?: string;
level?: ErrorLevel;
lastmodDateOnly?: boolean;
xmlns?: NSArgs;
xslUrl?: string;
errorHandler?: ErrorHandler$1;
}
interface SitemapItem {
lastmod?: string | number | Date;
changefreq?: `${EnumChangefreq}`;
fullPrecisionPriority?: boolean;
priority?: number;
news?: NewsItem;
expires?: string;
androidLink?: string;
ampLink?: string;
url: string;
video?: any;
img?: string | Img | (string | Img)[];
links?: LinkItem[];
lastmodfile?: string | Buffer | URL;
lastmodISO?: string;
lastmodrealtime?: boolean;
}
//#region src/types.d.ts
/**
* Options of @mdit-vue/plugin-component
*/
interface ComponentPluginOptions {
/**
* Extra tags to be treated as block tags.
*
* @default []
*/
blockTags?: string[];
/**
* Extra tags to be treated as inline tags.
*
* @default []
*/
inlineTags?: string[];
}
/**
* Takes a string or object with `content` property, extracts
* and parses front-matter from the string, then returns an object
* with `data`, `content` and other [useful properties](#returned-object).
*
* ```js
* var matter = require('gray-matter');
* console.log(matter('---\ntitle: Home\n---\nOther stuff'));
* //=> { data: { title: 'Home'}, content: 'Other stuff' }
* ```
* @param {Object|String} `input` String, or object with `content` string
* @param {Object} `options`
* @return {Object}
* @api public
*/
declare function matter<
I extends matter.Input,
O extends matter.GrayMatterOption
>(input: I | { content: I }, options?: O): matter.GrayMatterFile
declare namespace matter {
type Input = string | Buffer
interface GrayMatterOption<
I extends Input,
O extends GrayMatterOption
> {
parser?: () => void
eval?: boolean
excerpt?: boolean | ((input: I, options: O) => string)
excerpt_separator?: string
engines?: {
[index: string]:
| ((input: string) => object)
| { parse: (input: string) => object; stringify?: (data: object) => string }
}
language?: string
delimiters?: string | [string, string]
}
interface GrayMatterFile {
data: { [key: string]: any }
content: string
excerpt?: string
orig: Buffer | I
language: string
matter: string
stringify(lang: string): string
}
/**
* Stringify an object to YAML or the specified language, and
* append it to the given string. By default, only YAML and JSON
* can be stringified. See the [engines](#engines) section to learn
* how to stringify other languages.
*
* ```js
* console.log(matter.stringify('foo bar baz', {title: 'Home'}));
* // results in:
* // ---
* // title: Home
* // ---
* // foo bar baz
* ```
* @param {String|Object} `file` The content string to append to stringified front-matter, or a file object with `file.content` string.
* @param {Object} `data` Front matter to stringify.
* @param {Object} `options` [Options](#options) to pass to gray-matter and [js-yaml].
* @return {String} Returns a string created by wrapping stringified yaml with delimiters, and appending that to the given string.
*/
export function stringify>(
file: string | { content: string },
data: object,
options?: GrayMatterOption
): string
/**
* Synchronously read a file from the file system and parse
* front matter. Returns the same object as the [main function](#matter).
*
* ```js
* var file = matter.read('./content/blog-post.md');
* ```
* @param {String} `filepath` file path of the file to read.
* @param {Object} `options` [Options](#options) to pass to gray-matter.
* @return {Object} Returns [an object](#returned-object) with `data` and `content`
*/
export function read>(
fp: string,
options?: GrayMatterOption
): matter.GrayMatterFile
/**
* Returns true if the given `string` has front matter.
* @param {String} `string`
* @param {Object} `options`
* @return {Boolean} True if front matter exists.
*/
export function test>(
str: string,
options?: GrayMatterOption
): boolean
/**
* Detect the language to use, if one is defined after the
* first front-matter delimiter.
* @param {String} `string`
* @param {Object} `options`
* @return {Object} Object with `raw` (actual language string), and `name`, the language with whitespace trimmed
*/
export function language>(
str: string,
options?: GrayMatterOption
): { name: string; raw: string }
}
//#region src/types.d.ts
type GrayMatterOptions = matter.GrayMatterOption;
/**
* Options of @mdit-vue/plugin-frontmatter
*/
interface FrontmatterPluginOptions {
/**
* Options of gray-matter
*
* @see https://github.com/jonschlinkert/gray-matter#options
*/
grayMatterOptions?: GrayMatterOptions;
/**
* Render the excerpt or not
*
* @default true
*/
renderExcerpt?: boolean;
}
declare module '@mdit-vue/types' {
interface MarkdownItEnv {
/**
* The raw Markdown content without frontmatter
*/
content?: string;
/**
* The excerpt that extracted by `@mdit-vue/plugin-frontmatter`
*
* - Would be the rendered HTML when `renderExcerpt` is enabled
* - Would be the raw Markdown when `renderExcerpt` is disabled
*/
excerpt?: string;
/**
* The frontmatter that extracted by `@mdit-vue/plugin-frontmatter`
*/
frontmatter?: Record;
}
}
interface MarkdownItHeader {
/**
* The level of the header
*
* `1` to `6` for `` to ``
*/
level: number;
/**
* The title of the header
*/
title: string;
/**
* The slug of the header
*
* Typically the `id` attr of the header anchor
*/
slug: string;
/**
* Link of the header
*
* Typically using `#${slug}` as the anchor hash
*/
link: string;
/**
* The children of the header
*/
children: MarkdownItHeader[];
}
//#region src/types.d.ts
/**
* Options of @mdit-vue/plugin-headers
*/
interface HeadersPluginOptions {
/**
* A custom slugification function
*
* Should use the same slugify function with markdown-it-anchor
* to ensure the link is matched
*/
slugify?: (str: string) => string;
/**
* A function for formatting header title
*/
format?: (str: string) => string;
/**
* Heading level that going to be extracted
*
* Should be a subset of markdown-it-anchor's `level` option
* to ensure the slug is existed
*
* @default [2,3]
*/
level?: number[];
/**
* Should allow headers inside nested blocks or not
*
* If set to `true`, headers inside blockquote, list, etc. would also be extracted.
*
* @default false
*/
shouldAllowNested?: boolean;
}
declare module '@mdit-vue/types' {
interface MarkdownItEnv {
/**
* The headers that extracted by `@mdit-vue/plugin-headers`
*/
headers?: MarkdownItHeader[];
}
}
//#endregion
//#region src/types.d.ts
/**
* Options of @mdit-vue/plugin-sfc
*/
interface SfcPluginOptions {
/**
* Custom blocks to be extracted
*
* @default []
*/
customBlocks?: string[];
}
/**
* SFC block that extracted from markdown
*/
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;
}
interface MarkdownSfcBlocks {
/**
* The `` block
*/
template: SfcBlock | null;
/**
* The common `