Skip to content

Commit c014083

Browse files
authoredSep 2, 2021
fix: code match regexp (#129)
1 parent fe50fc5 commit c014083

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed
 

‎examples/vite-vue3/components.d.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// generated by unplugin-vue-components
2-
// read more https://github.com/vuejs/vue-next/pull/3399
2+
// We suggest you to commit this file into source control
3+
// Read more: https://github.com/vuejs/vue-next/pull/3399
34

45
declare module 'vue' {
56
export interface GlobalComponents {

‎src/core/declaration.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { notNullish, slash } from '@antfu/utils'
44
import { Context } from './context'
55

66
export function parseDeclaration(code: string): Record<string, string> {
7-
return Object.fromEntries(Array.from(code.matchAll(/\s+['"]?(.+?)['"]?:\s(.+?)\n/g)).map(i => [i[1], i[2]]))
7+
return Object.fromEntries(Array.from(code.matchAll(/(?<!\/\/)\s+\s+['"]?(.+?)['"]?:\s(.+?)\n/g)).map(i => [i[1], i[2]]))
88
}
99

1010
export async function generateDeclaration(ctx: Context, root: string, filepath: string) {

0 commit comments

Comments
 (0)
Please sign in to comment.