style: format

pull/672/head
Kia King Ishii 3 years ago
parent d447e198d2
commit b853910c32

@ -1,14 +1,14 @@
import { RollupOptions, defineConfig } from 'rollup'
import { promises as fs } from 'fs'
import { resolve } from 'path'
import { fileURLToPath } from 'url'
import { RollupOptions, defineConfig } from 'rollup'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import esbuild from 'rollup-plugin-esbuild'
import json from '@rollup/plugin-json'
import replace from '@rollup/plugin-replace'
import dts from 'rollup-plugin-dts'
import alias from '@rollup/plugin-alias'
import { resolve } from 'path'
import { fileURLToPath } from 'url'
import dts from 'rollup-plugin-dts'
import pkg from './package.json'
const DEV = !!process.env.DEV

@ -5,13 +5,13 @@ import { Alias, AliasOptions } from 'vite'
const require = createRequire(import.meta.url)
const PKG_ROOT = resolve(fileURLToPath(import.meta.url), '../..')
export const DIST_CLIENT_PATH = resolve(PKG_ROOT, 'client')
export const APP_PATH = join(DIST_CLIENT_PATH, 'app')
export const SHARED_PATH = join(DIST_CLIENT_PATH, 'shared')
export const DEFAULT_THEME_PATH = join(DIST_CLIENT_PATH, 'theme-default')
// special virtual file
// we can't directly import '/@siteData' because
// special virtual file. we can't directly import '/@siteData' because
// - it's not an actual file so we can't use tsconfig paths to redirect it
// - TS doesn't allow shimming a module that starts with '/'
export const SITE_DATA_ID = '@siteData'
@ -49,9 +49,12 @@ export function resolveAliases(root: string, themeDir: string): AliasOptions {
replacement: join(DIST_CLIENT_PATH, '/theme-default/index')
},
// alias for local linked development
{ find: /^vitepress\//, replacement: PKG_ROOT + '/' },
// make sure it always use the same vue dependency that comes with
// vitepress itself
{
find: /^vitepress\//,
replacement: PKG_ROOT + '/'
},
// make sure it always use the same vue dependency that comes
// with vitepress itself
{
find: /^vue$/,
replacement: vuePath

@ -1,11 +1,11 @@
import fs from 'fs-extra'
import { bundle, okMark, failMark } from './bundle'
import path from 'path'
import ora from 'ora'
import { BuildOptions } from 'vite'
import { OutputChunk, OutputAsset } from 'rollup'
import { resolveConfig } from '../config'
import { renderPage } from './render'
import { OutputChunk, OutputAsset } from 'rollup'
import ora from 'ora'
import path from 'path'
import { bundle, okMark, failMark } from './bundle'
export async function build(
root: string,

@ -1,6 +1,6 @@
import { build } from 'vite'
import { SiteConfig } from '..'
import { RollupOutput } from 'rollup'
import { SiteConfig } from '..'
const virtualEntry = 'client.js'

@ -1,11 +1,11 @@
import ora from 'ora'
import path from 'path'
import fs from 'fs-extra'
import { build, BuildOptions, UserConfig as ViteUserConfig } from 'vite'
import { RollupOutput } from 'rollup'
import { slash } from '../utils/slash'
import { APP_PATH } from '../alias'
import { SiteConfig } from '../config'
import { RollupOutput } from 'rollup'
import { build, BuildOptions, UserConfig as ViteUserConfig } from 'vite'
import { APP_PATH } from '../alias'
import { createVitePressPlugin } from '../plugin'
import { buildMPAClient } from './buildMPAClient'

@ -1,12 +1,12 @@
import path from 'path'
import { createRequire } from 'module'
import fs from 'fs-extra'
import { SiteConfig, resolveSiteDataByRoute } from '../config'
import { HeadConfig, createTitle } from '../shared'
import path from 'path'
import escape from 'escape-html'
import { normalizePath, transformWithEsbuild } from 'vite'
import { RollupOutput, OutputChunk, OutputAsset } from 'rollup'
import { HeadConfig, createTitle } from '../shared'
import { slash } from '../utils/slash'
import escape from 'escape-html'
import { createRequire } from 'module'
import { SiteConfig, resolveSiteDataByRoute } from '../config'
const require = createRequire(import.meta.url)

@ -1,8 +1,8 @@
export * from './config'
export * from './server'
export * from './markdown/markdown'
export * from './build/build'
export * from './serve/serve'
export * from './config'
export * from './markdown/markdown'
// shared types
export type {

@ -1,14 +1,14 @@
import fs from 'fs'
import path from 'path'
import c from 'picocolors'
import matter from 'gray-matter'
import LRUCache from 'lru-cache'
import { createMarkdownRenderer, MarkdownOptions } from './markdown/markdown'
import { deeplyParseHeader } from './utils/parseHeader'
import { PageData, HeadConfig, EXTERNAL_URL_RE } from './shared'
import { slash } from './utils/slash'
import c from 'picocolors'
import _debug from 'debug'
import { deeplyParseHeader } from './utils/parseHeader'
import { getGitTimestamp } from './utils/getGitTimestamp'
import { createMarkdownRenderer, MarkdownOptions } from './markdown/markdown'
import _debug from 'debug'
const debug = _debug('vitepress:md')
const cache = new LRUCache<string, MarkdownCompileResult>({ max: 1024 })

@ -1,7 +1,7 @@
import sirv from 'sirv'
import compression from 'compression'
import { resolveConfig } from '../config'
import polka from 'polka'
import { resolveConfig } from '../config'
function trimChar(str: string, char: string) {
while (str.charAt(0) === char) {
@ -33,8 +33,8 @@ export async function serve(options: ServeOptions = {}) {
immutable: true,
setHeaders(res, pathname) {
if (!pathname.includes('/assets/')) {
// force server validation for non-asset files since they are not
// fingerprinted.
// force server validation for non-asset files since they
// are not fingerprinted
res.setHeader('cache-control', 'no-cache')
}
}

Loading…
Cancel
Save