diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index 4084d922c..d4fd5aacd 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -286,6 +286,9 @@ "watchTriggerable": true, "watchWithFilter": true, "whenever": true, - "toValue": true + "toValue": true, + "injectLocal": true, + "provideLocal": true, + "useClipboardItems": true } } diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 186963f1d..35bda1137 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -36,6 +36,7 @@ declare global { const h: typeof import('vue')['h'] const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch'] const inject: typeof import('vue')['inject'] + const injectLocal: typeof import('@vueuse/core')['injectLocal'] const isDefined: typeof import('@vueuse/core')['isDefined'] const isProxy: typeof import('vue')['isProxy'] const isReactive: typeof import('vue')['isReactive'] @@ -65,6 +66,7 @@ declare global { const onUpdated: typeof import('vue')['onUpdated'] const pausableWatch: typeof import('@vueuse/core')['pausableWatch'] const provide: typeof import('vue')['provide'] + const provideLocal: typeof import('@vueuse/core')['provideLocal'] const reactify: typeof import('@vueuse/core')['reactify'] const reactifyObject: typeof import('@vueuse/core')['reactifyObject'] const reactive: typeof import('vue')['reactive'] @@ -128,6 +130,7 @@ declare global { const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation'] const useCached: typeof import('@vueuse/core')['useCached'] const useClipboard: typeof import('@vueuse/core')['useClipboard'] + const useClipboardItems: typeof import('@vueuse/core')['useClipboardItems'] const useCloned: typeof import('@vueuse/core')['useCloned'] const useColorMode: typeof import('@vueuse/core')['useColorMode'] const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog'] @@ -326,6 +329,7 @@ declare module 'vue' { readonly h: UnwrapRef readonly ignorableWatch: UnwrapRef readonly inject: UnwrapRef + readonly injectLocal: UnwrapRef readonly isDefined: UnwrapRef readonly isProxy: UnwrapRef readonly isReactive: UnwrapRef @@ -355,6 +359,7 @@ declare module 'vue' { readonly onUpdated: UnwrapRef readonly pausableWatch: UnwrapRef readonly provide: UnwrapRef + readonly provideLocal: UnwrapRef readonly reactify: UnwrapRef readonly reactifyObject: UnwrapRef readonly reactive: UnwrapRef @@ -418,6 +423,7 @@ declare module 'vue' { readonly useBrowserLocation: UnwrapRef readonly useCached: UnwrapRef readonly useClipboard: UnwrapRef + readonly useClipboardItems: UnwrapRef readonly useCloned: UnwrapRef readonly useColorMode: UnwrapRef readonly useConfirmDialog: UnwrapRef @@ -610,6 +616,7 @@ declare module '@vue/runtime-core' { readonly h: UnwrapRef readonly ignorableWatch: UnwrapRef readonly inject: UnwrapRef + readonly injectLocal: UnwrapRef readonly isDefined: UnwrapRef readonly isProxy: UnwrapRef readonly isReactive: UnwrapRef @@ -639,6 +646,7 @@ declare module '@vue/runtime-core' { readonly onUpdated: UnwrapRef readonly pausableWatch: UnwrapRef readonly provide: UnwrapRef + readonly provideLocal: UnwrapRef readonly reactify: UnwrapRef readonly reactifyObject: UnwrapRef readonly reactive: UnwrapRef @@ -702,6 +710,7 @@ declare module '@vue/runtime-core' { readonly useBrowserLocation: UnwrapRef readonly useCached: UnwrapRef readonly useClipboard: UnwrapRef + readonly useClipboardItems: UnwrapRef readonly useCloned: UnwrapRef readonly useColorMode: UnwrapRef readonly useConfirmDialog: UnwrapRef diff --git a/src/tools/regex-tester/regex-tester.service.test.ts b/src/tools/regex-tester/regex-tester.service.test.ts index bd4efbbc8..2928dc779 100644 --- a/src/tools/regex-tester/regex-tester.service.test.ts +++ b/src/tools/regex-tester/regex-tester.service.test.ts @@ -92,6 +92,51 @@ const regexesData = [ }, ], }, + { + regex: '\\s([^\\s\\[]+)(?:\\[(\\d+)\\])?:\\s', + text: 'Nov 11 21:03:26 abc2 def.sh[1]: \nNov 11 21:03:26 abc2 def.sh: ', + flags: 'gm', + result: [ + { + captures: [ + { + end: 27, + name: '1', + start: 21, + value: 'def.sh', + }, + { + end: 29, + name: '2', + start: 28, + value: '1', + }, + ], + groups: [], + index: 20, + value: ' def.sh[1]: ', + }, + { + captures: [ + { + end: 60, + name: '1', + start: 54, + value: 'def.sh', + }, + { + end: -1, + name: '2', + start: -1, + value: undefined, + }, + ], + groups: [], + index: 53, + value: ' def.sh: ', + }, + ], + }, ]; describe('regex-tester', () => { diff --git a/src/tools/regex-tester/regex-tester.service.ts b/src/tools/regex-tester/regex-tester.service.ts index ec8682c5c..757ea54d4 100644 --- a/src/tools/regex-tester/regex-tester.service.ts +++ b/src/tools/regex-tester/regex-tester.service.ts @@ -31,21 +31,23 @@ export function matchRegex(regex: string, text: string, flags: string) { const captures: Array = []; Object.entries(match).forEach(([captureName, captureValue]) => { if (captureName !== '0' && captureName.match(/\d+/)) { + const captureIndices = indices[Number(captureName)] || [-1, -1]; captures.push({ name: captureName, value: captureValue, - start: indices[Number(captureName)][0], - end: indices[Number(captureName)][1], + start: captureIndices[0], + end: captureIndices[1], }); } }); const groups: Array = []; Object.entries(match.groups || {}).forEach(([groupName, groupValue]) => { + const groupIndices = indices.groups[groupName] || [-1, -1]; groups.push({ name: groupName, value: groupValue, - start: indices.groups[groupName][0], - end: indices.groups[groupName][1], + start: groupIndices[0], + end: groupIndices[1], }); }); results.push({