From b3d28def426524053447bdbd7401db3e86f94162 Mon Sep 17 00:00:00 2001 From: Misode Date: Sat, 4 Jan 2025 00:12:02 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Switch=20to=20picomatch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 70 ++++++++++++++-------------- packages/core/package.json | 4 +- packages/core/src/service/Config.ts | 6 ++- packages/core/src/service/Project.ts | 4 +- 4 files changed, 44 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index 61698cd45..54b22a591 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1959,12 +1959,6 @@ "integrity": "sha512-EDKtLYNMKrig22jEvhXq8TBFyFgVNSPmDF2b9UzJ7+eylPqdZVo17PCUMkn1jP6/1A/0u78VqYC6VrX6b8pDWA==", "dev": true }, - "node_modules/@types/braces": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/braces/-/braces-3.0.4.tgz", - "integrity": "sha512-0WR3b8eaISjEW7RpZnclONaLFDf7buaowRHdqLp4vLj54AsSAYWfh3DRbfiYJY9XDxMgx1B4sE1Afw2PGpuHOA==", - "dev": true - }, "node_modules/@types/decompress": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/@types/decompress/-/decompress-4.2.3.tgz", @@ -2041,15 +2035,6 @@ "integrity": "sha512-wbw+IDRw/xY/RGy+BL6f4Eey4jsUgHQrMuA4Qj0CSG3x/7C2Oc57pmRoM2z3M4DkylWRz+G1pfX06sCXQm0J+w==", "dev": true }, - "node_modules/@types/micromatch": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@types/micromatch/-/micromatch-4.0.9.tgz", - "integrity": "sha512-7V+8ncr22h4UoYRLnLXSpTxjQrNUXtWHGeMPRJt1nULXI57G9bIcpyrHlmrQ7QK24EyyuXvYcSSWAM8GA9nqCg==", - "dev": true, - "dependencies": { - "@types/braces": "*" - } - }, "node_modules/@types/mocha": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", @@ -2067,6 +2052,12 @@ "integrity": "sha512-10+iaz93qR5WYxTo+PMifD5TSxiOtdRaxBf7INGGXMQgTCu8Z/7GYWYFUOS3q/G0nE5boj1r4FEB+WSy7s5gbA==", "dev": true }, + "node_modules/@types/picomatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/picomatch/-/picomatch-3.0.1.tgz", + "integrity": "sha512-1MRgzpzY0hOp9pW/kLRxeQhUWwil6gnrUYd3oEpeYBqp/FexhaCPv3F8LsYr47gtUU45fO2cm1dbwkSrHEo8Uw==", + "dev": true + }, "node_modules/@types/snap-shot-core": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/@types/snap-shot-core/-/snap-shot-core-10.2.0.tgz", @@ -9200,6 +9191,7 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -13790,8 +13782,8 @@ "chokidar": "^3.5.2", "decompress": "^4.2.1", "follow-redirects": "^1.14.8", - "micromatch": "^4.0.8", "pako": "^2.0.4", + "picomatch": "^4.0.2", "rfdc": "^1.3.0", "vscode-languageserver-textdocument": "^1.0.4", "whatwg-url": "^14.0.0" @@ -13799,11 +13791,22 @@ "devDependencies": { "@types/decompress": "^4.2.3", "@types/follow-redirects": "^1.14.1", - "@types/micromatch": "^4.0.9", "@types/pako": "^2.0.0", + "@types/picomatch": "^3.0.1", "@types/whatwg-url": "^11.0.4" } }, + "packages/core/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "packages/core/node_modules/tr46": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz", @@ -13843,7 +13846,7 @@ "discord.js": "^14.16.3" }, "bin": { - "spyglassmc-discord-bot": "lib/index.js" + "spyglassmc-discord-bot": "bin/bot.js" }, "devDependencies": {}, "engines": { @@ -15308,21 +15311,26 @@ "requires": { "@types/decompress": "^4.2.3", "@types/follow-redirects": "^1.14.1", - "@types/micromatch": "^4.0.9", "@types/pako": "^2.0.0", + "@types/picomatch": "^3.0.1", "@types/whatwg-url": "^11.0.4", "base64-arraybuffer": "^1.0.2", "binary-search": "^1.3.6", "chokidar": "^3.5.2", "decompress": "^4.2.1", "follow-redirects": "^1.14.8", - "micromatch": "^4.0.8", "pako": "^2.0.4", + "picomatch": "^4.0.2", "rfdc": "^1.3.0", "vscode-languageserver-textdocument": "^1.0.4", "whatwg-url": "^14.0.0" }, "dependencies": { + "picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==" + }, "tr46": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz", @@ -15489,12 +15497,6 @@ "integrity": "sha512-EDKtLYNMKrig22jEvhXq8TBFyFgVNSPmDF2b9UzJ7+eylPqdZVo17PCUMkn1jP6/1A/0u78VqYC6VrX6b8pDWA==", "dev": true }, - "@types/braces": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/braces/-/braces-3.0.4.tgz", - "integrity": "sha512-0WR3b8eaISjEW7RpZnclONaLFDf7buaowRHdqLp4vLj54AsSAYWfh3DRbfiYJY9XDxMgx1B4sE1Afw2PGpuHOA==", - "dev": true - }, "@types/decompress": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/@types/decompress/-/decompress-4.2.3.tgz", @@ -15571,15 +15573,6 @@ "integrity": "sha512-wbw+IDRw/xY/RGy+BL6f4Eey4jsUgHQrMuA4Qj0CSG3x/7C2Oc57pmRoM2z3M4DkylWRz+G1pfX06sCXQm0J+w==", "dev": true }, - "@types/micromatch": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@types/micromatch/-/micromatch-4.0.9.tgz", - "integrity": "sha512-7V+8ncr22h4UoYRLnLXSpTxjQrNUXtWHGeMPRJt1nULXI57G9bIcpyrHlmrQ7QK24EyyuXvYcSSWAM8GA9nqCg==", - "dev": true, - "requires": { - "@types/braces": "*" - } - }, "@types/mocha": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz", @@ -15597,6 +15590,12 @@ "integrity": "sha512-10+iaz93qR5WYxTo+PMifD5TSxiOtdRaxBf7INGGXMQgTCu8Z/7GYWYFUOS3q/G0nE5boj1r4FEB+WSy7s5gbA==", "dev": true }, + "@types/picomatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/picomatch/-/picomatch-3.0.1.tgz", + "integrity": "sha512-1MRgzpzY0hOp9pW/kLRxeQhUWwil6gnrUYd3oEpeYBqp/FexhaCPv3F8LsYr47gtUU45fO2cm1dbwkSrHEo8Uw==", + "dev": true + }, "@types/snap-shot-core": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/@types/snap-shot-core/-/snap-shot-core-10.2.0.tgz", @@ -20807,6 +20806,7 @@ "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, "requires": { "braces": "^3.0.3", "picomatch": "^2.3.1" diff --git a/packages/core/package.json b/packages/core/package.json index cc6c43634..44e7ea8ba 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -19,7 +19,7 @@ "chokidar": "^3.5.2", "decompress": "^4.2.1", "follow-redirects": "^1.14.8", - "micromatch": "^4.0.8", + "picomatch": "^4.0.2", "pako": "^2.0.4", "rfdc": "^1.3.0", "vscode-languageserver-textdocument": "^1.0.4", @@ -28,7 +28,7 @@ "devDependencies": { "@types/decompress": "^4.2.3", "@types/follow-redirects": "^1.14.1", - "@types/micromatch": "^4.0.9", + "@types/picomatch": "^3.0.1", "@types/pako": "^2.0.0", "@types/whatwg-url": "^11.0.4" }, diff --git a/packages/core/src/service/Config.ts b/packages/core/src/service/Config.ts index 3c10bcfa9..a79dbd938 100644 --- a/packages/core/src/service/Config.ts +++ b/packages/core/src/service/Config.ts @@ -336,7 +336,11 @@ export const VanillaConfig: Config = { env: { dataSource: 'GitHub', dependencies: ['@vanilla-datapack', '@vanilla-resourcepack', '@vanilla-mcdoc'], - exclude: ['.*/**'], + exclude: [ + '.*/**', + '**/node_modules/**', + '**/__pycache__/**', + ], customResources: {}, feature: { codeActions: true, diff --git a/packages/core/src/service/Project.ts b/packages/core/src/service/Project.ts index 4f9680219..9643ee7f9 100644 --- a/packages/core/src/service/Project.ts +++ b/packages/core/src/service/Project.ts @@ -1,4 +1,4 @@ -import * as micromatch from 'micromatch' +import picomatch from 'picomatch' import type { TextDocumentContentChangeEvent } from 'vscode-languageserver-textdocument' import { TextDocument } from 'vscode-languageserver-textdocument' import type { ExternalEventEmitter, Externals, FsWatcher, IntervalId } from '../common/index.js' @@ -972,7 +972,7 @@ export class Project implements ExternalEventEmitter { return false } for (const rel of fileUtil.getRels(uri, this.projectRoots)) { - if (micromatch.any(rel, this.config.env.exclude)) { + if (picomatch(this.config.env.exclude, { dot: true, posixSlashes: false })(rel)) { return true } }