mirror of https://github.com/vuejs/vitepress
parent
8bc14e6366
commit
a7688c85f2
@ -1,10 +1,11 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import {defineConfig} from 'vite'
|
||||||
|
|
||||||
export default {
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
node: path.resolve(__dirname, '../src/node'),
|
node: path.resolve(__dirname, '../src/node'),
|
||||||
client: path.resolve(__dirname, '../src/client')
|
client: path.resolve(__dirname, '../src/client')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
||||||
|
|
||||||
"projectFolder": "./src/client",
|
|
||||||
|
|
||||||
"mainEntryPointFilePath": "./dist/temp/index.d.ts",
|
|
||||||
|
|
||||||
"dtsRollup": {
|
|
||||||
"enabled": true,
|
|
||||||
"publicTrimmedFilePath": "./dist/client/index.d.ts"
|
|
||||||
},
|
|
||||||
|
|
||||||
"apiReport": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
|
|
||||||
"docModel": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
|
|
||||||
"tsdocMetadata": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
|
|
||||||
"messages": {
|
|
||||||
"compilerMessageReporting": {
|
|
||||||
"default": {
|
|
||||||
"logLevel": "warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"extractorMessageReporting": {
|
|
||||||
"default": {
|
|
||||||
"logLevel": "warning",
|
|
||||||
"addToApiReportFile": true
|
|
||||||
},
|
|
||||||
|
|
||||||
"ae-missing-release-tag": {
|
|
||||||
"logLevel": "none"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"tsdocMessageReporting": {
|
|
||||||
"default": {
|
|
||||||
"logLevel": "warning"
|
|
||||||
},
|
|
||||||
|
|
||||||
"tsdoc-undefined-tag": {
|
|
||||||
"logLevel": "none"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
||||||
|
|
||||||
"projectFolder": "./src/node",
|
|
||||||
|
|
||||||
"mainEntryPointFilePath": "./dist/temp/index.d.ts",
|
|
||||||
|
|
||||||
"dtsRollup": {
|
|
||||||
"enabled": true,
|
|
||||||
"publicTrimmedFilePath": "./dist/node/index.d.ts"
|
|
||||||
},
|
|
||||||
|
|
||||||
"apiReport": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
|
|
||||||
"docModel": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
|
|
||||||
"tsdocMetadata": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
|
|
||||||
"messages": {
|
|
||||||
"compilerMessageReporting": {
|
|
||||||
"default": {
|
|
||||||
"logLevel": "warning"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"extractorMessageReporting": {
|
|
||||||
"default": {
|
|
||||||
"logLevel": "warning",
|
|
||||||
"addToApiReportFile": true
|
|
||||||
},
|
|
||||||
|
|
||||||
"ae-missing-release-tag": {
|
|
||||||
"logLevel": "none"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"tsdocMessageReporting": {
|
|
||||||
"default": {
|
|
||||||
"logLevel": "warning"
|
|
||||||
},
|
|
||||||
|
|
||||||
"tsdoc-undefined-tag": {
|
|
||||||
"logLevel": "none"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,2 +1,2 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
require('../dist/node/cli')
|
import('../dist/node/cli.js')
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
import { 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 dts from 'rollup-plugin-dts'
|
||||||
|
import alias from '@rollup/plugin-alias'
|
||||||
|
import { resolve } from 'path'
|
||||||
|
import { fileURLToPath } from 'url'
|
||||||
|
import pkg from './package.json'
|
||||||
|
|
||||||
|
const ROOT = fileURLToPath(import.meta.url)
|
||||||
|
const r = (p:string) => resolve(ROOT, '..', p)
|
||||||
|
|
||||||
|
const external =[
|
||||||
|
...Object.keys(pkg.dependencies),
|
||||||
|
'buffer',
|
||||||
|
'punycode',
|
||||||
|
'prismjs/components/index.js'
|
||||||
|
]
|
||||||
|
|
||||||
|
export default defineConfig([
|
||||||
|
{
|
||||||
|
input: [r('src/node/index.ts'), r('src/node/cli.ts')],
|
||||||
|
output: {
|
||||||
|
format: 'esm',
|
||||||
|
dir: r('dist/node')
|
||||||
|
},
|
||||||
|
external,
|
||||||
|
plugins: [
|
||||||
|
alias({
|
||||||
|
entries: {
|
||||||
|
'readable-stream': 'stream'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
nodeResolve(),
|
||||||
|
esbuild({
|
||||||
|
target: 'node14'
|
||||||
|
}),
|
||||||
|
json()
|
||||||
|
],
|
||||||
|
onwarn(warning, warn) {
|
||||||
|
if (warning.code !== 'EVAL') warn(warning)
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
input: r('src/node/index.ts'),
|
||||||
|
output: {
|
||||||
|
format: 'esm',
|
||||||
|
file: 'dist/node/index.d.ts'
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
dts()
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: r('src/client/index.ts'),
|
||||||
|
output: {
|
||||||
|
format: 'esm',
|
||||||
|
file: 'dist/client/index.d.ts'
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
dts({
|
||||||
|
compilerOptions: {
|
||||||
|
"skipLibCheck": true,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
@ -1,11 +1,12 @@
|
|||||||
const fs = require('fs-extra')
|
import { copy } from 'fs-extra'
|
||||||
const glob = require('globby')
|
import { sync } from 'globby'
|
||||||
|
|
||||||
function toDest(file) {
|
function toDest(file) {
|
||||||
return file.replace(/^src\//, 'dist/')
|
return file.replace(/^src\//, 'dist/')
|
||||||
}
|
}
|
||||||
|
|
||||||
glob.sync('src/client/**').forEach((file) => {
|
sync('src/client/**').forEach((file) => {
|
||||||
if (/(\.ts|tsconfig\.json)$/.test(file)) return
|
if (/(\.ts|tsconfig\.json)$/.test(file))
|
||||||
fs.copy(file, toDest(file))
|
return
|
||||||
|
copy(file, toDest(file))
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
const fs = require('fs-extra')
|
import { copy } from 'fs-extra'
|
||||||
const glob = require('globby')
|
import { sync } from 'globby'
|
||||||
|
|
||||||
glob.sync('src/shared/**/*.ts').forEach((file) => {
|
sync('src/shared/**/*.ts')
|
||||||
fs.copy(file, file.replace(/^src\/shared\//, 'src/node/'))
|
.map(async (file) => {
|
||||||
fs.copy(file, file.replace(/^src\/shared\//, 'src/client/'))
|
await copy(file, file.replace(/^src\/shared\//, 'src/node/'))
|
||||||
|
await copy(file, file.replace(/^src\/shared\//, 'src/client/'))
|
||||||
})
|
})
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
import { 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 alias from '@rollup/plugin-alias'
|
|
||||||
import { resolve } from 'path'
|
|
||||||
|
|
||||||
const r = (p) => resolve(__dirname, '../', p)
|
|
||||||
const pkg = require('../package.json')
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
input: [r('src/node/index.ts'), r('src/node/cli.ts')],
|
|
||||||
output: {
|
|
||||||
format: 'cjs',
|
|
||||||
dir: r('dist/node')
|
|
||||||
},
|
|
||||||
external: [...Object.keys(pkg.dependencies), 'buffer', 'punycode'],
|
|
||||||
plugins: [
|
|
||||||
alias({
|
|
||||||
entries: {
|
|
||||||
'readable-stream': 'stream'
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
nodeResolve(),
|
|
||||||
esbuild({
|
|
||||||
target: 'node12'
|
|
||||||
}),
|
|
||||||
json()
|
|
||||||
],
|
|
||||||
onwarn(warning, warn) {
|
|
||||||
if (warning.code !== 'EVAL') warn(warning)
|
|
||||||
}
|
|
||||||
})
|
|
@ -1,12 +1,17 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
|
"target": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["ESNext"]
|
"resolveJsonModule": true,
|
||||||
|
"lib": ["ESNext", "DOM"],
|
||||||
},
|
},
|
||||||
"include": ["../types/shared.d.ts"]
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist"
|
||||||
|
]
|
||||||
}
|
}
|
Loading…
Reference in new issue