Skip to content

Commit 211b1f7

Browse files
authored
chore: migrate from minimatch to picomatch (#5499)
1 parent 7462fa9 commit 211b1f7

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

packages/language-core/lib/codegen/template/elementProps.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as CompilerDOM from '@vue/compiler-dom';
22
import { camelize } from '@vue/shared';
3-
import { minimatch } from 'minimatch';
43
import { toString } from 'muggle-string';
4+
import { isMatch } from 'picomatch';
55
import type { Code, VueCodeInformation, VueCompilerOptions } from '../../types';
66
import { hyphenateAttr, hyphenateTag } from '../../utils/shared';
77
import { codeFeatures } from '../codeFeatures';
@@ -92,7 +92,7 @@ export function* generateElementProps(
9292

9393
if (
9494
propName === undefined
95-
|| options.vueCompilerOptions.dataAttributes.some(pattern => minimatch(propName!, pattern))
95+
|| options.vueCompilerOptions.dataAttributes.some(pattern => isMatch(propName!, pattern))
9696
) {
9797
if (prop.exp && prop.exp.constType !== CompilerDOM.ConstantTypes.CAN_STRINGIFY) {
9898
failedPropExps?.push({ node: prop.exp, prefix: `(`, suffix: `)` });
@@ -180,7 +180,7 @@ export function* generateElementProps(
180180
}
181181
} else if (prop.type === CompilerDOM.NodeTypes.ATTRIBUTE) {
182182
if (
183-
options.vueCompilerOptions.dataAttributes.some(pattern => minimatch(prop.name, pattern))
183+
options.vueCompilerOptions.dataAttributes.some(pattern => isMatch(prop.name, pattern))
184184
// Vue 2 Transition doesn't support "persisted" property but `@vue/compiler-dom` always adds it (#3881)
185185
|| (
186186
options.vueCompilerOptions.target < 3
@@ -354,7 +354,7 @@ function getShouldCamelize(
354354
|| (prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic)
355355
)
356356
&& hyphenateAttr(propName) === propName
357-
&& !options.vueCompilerOptions.htmlAttributes.some(pattern => minimatch(propName, pattern));
357+
&& !options.vueCompilerOptions.htmlAttributes.some(pattern => isMatch(propName, pattern));
358358
}
359359

360360
function getPropsCodeInfo(

packages/language-core/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
"@vue/compiler-vue2": "^2.7.16",
1919
"@vue/shared": "^3.5.0",
2020
"alien-signals": "^2.0.5",
21-
"minimatch": "^10.0.1",
2221
"muggle-string": "^0.4.1",
23-
"path-browserify": "^1.0.1"
22+
"path-browserify": "^1.0.1",
23+
"picomatch": "^4.0.2"
2424
},
2525
"devDependencies": {
2626
"@types/node": "^22.10.4",
2727
"@types/path-browserify": "^1.0.1",
28+
"@types/picomatch": "^4.0.0",
2829
"@volar/typescript": "2.4.18",
2930
"@vue/compiler-sfc": "^3.5.0"
3031
},

pnpm-lock.yaml

Lines changed: 16 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)