File tree Expand file tree Collapse file tree 4 files changed +840
-559
lines changed Expand file tree Collapse file tree 4 files changed +840
-559
lines changed Original file line number Diff line number Diff line change 1- const path = require ( 'path' )
2- const fsp = require ( 'fs' ) . promises
3- const matterService = require ( '../utils/frontmatter-service' )
1+ import path from 'node:path'
2+ import fsp from 'node:fs/promises'
3+ import matterService from '../utils/frontmatter-service.js'
4+ import { fileURLToPath } from 'node:url'
5+ const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
46const workspacePath = path . resolve ( __dirname , '..' , '..' )
57
68const h1MdRegExp = / ^ # \s + ( .+ ) \s + ( \{ # ( [ \w - ] + ) \} ) $ /
@@ -41,4 +43,4 @@ const ergodicDirectory = async (dirPath) => {
4143 }
4244}
4345
44- module . exports = ( ) => ergodicDirectory ( workspacePath )
46+ export default ( ) => ergodicDirectory ( workspacePath )
Original file line number Diff line number Diff line change 1- const fs = require ( 'fs' )
2- const matter = require ( 'gray-matter' )
3- const { extend, isEmpty : _isEmpty } = require ( 'lodash' )
1+ import fs from 'node:fs'
2+ import matter from 'gray-matter'
3+ import _ from 'lodash'
4+
45// gray-matter is a dep for vitepress,
56// no need to specify that in package.json
67
@@ -21,7 +22,7 @@ class FrontMatterService {
2122 }
2223
2324 isEmpty ( ) {
24- return _isEmpty ( this . matter . data )
25+ return _ . _isEmpty ( this . matter . data )
2526 }
2627
2728 /** @param {(data: string) => void } callback */
@@ -48,7 +49,7 @@ class FrontMatterService {
4849
4950 /** @param {Record<string, any> } src */
5051 extend ( src ) {
51- extend ( this . matter . data , src )
52+ _ . extend ( this . matter . data , src )
5253 return this
5354 }
5455
@@ -63,4 +64,4 @@ class FrontMatterService {
6364 }
6465}
6566
66- module . exports = new FrontMatterService ( )
67+ export default new FrontMatterService ( )
Original file line number Diff line number Diff line change 33 "version" : " 1.0.0" ,
44 "description" : " Vite.js documentation Chinese translation." ,
55 "repository" : " https://github.com/vitejs/docs-cn" ,
6+ "type" : " module" ,
67 "author" : " Evan You" ,
78 "private" : true ,
89 "license" : " CC BY-NC-SA 4.0" ,
910 "devDependencies" : {
10- "chalk" : " ^4.1.0 " ,
11+ "chalk" : " ^4.1.2 " ,
1112 "gray-matter" : " ^4.0.3" ,
1213 "lodash" : " ^4.17.21" ,
13- "vite" : " ^2.9.12 " ,
14- "vitepress" : " ^1.0.0-alpha.43 " ,
14+ "vite" : " ^4.5.0 " ,
15+ "vitepress" : " ^1.0.0-rc.29 " ,
1516 "yorkie" : " ^2.0.0"
1617 },
1718 "scripts" : {
You can’t perform that action at this time.
0 commit comments