提交 657d3412 编写于 作者: J Juan Eugenio Abadie 提交者: ULIVZ

refactor: avoid using regexp's lookbehind (#323)

上级 087467a2
......@@ -236,14 +236,14 @@ async function genComponentRegistrationFile ({ sourceDir }) {
return `import Vue from 'vue'\n` + components.map(genImport).join('\n')
}
const indexRE = /(?<=(^|\/))(index|readme)\.md$/i
const indexRE = /(^|.*\/)(index|readme)\.md$/i
const extRE = /\.(vue|md)$/
function fileToPath (file) {
if (isIndexFile(file)) {
// README.md -> /
// foo/README.md -> /foo/
return '/' + file.replace(indexRE, '')
return file.replace(indexRE, '/$1')
} else {
// foo.md -> /foo.html
// foo/bar.md -> /foo/bar.html
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册