diff --git a/ThirdPartyNotices.txt b/ThirdPartyNotices.txt index de26a4ca..00abddb7 100644 --- a/ThirdPartyNotices.txt +++ b/ThirdPartyNotices.txt @@ -467,21 +467,61 @@ END OF ide/await-lock NOTICES AND INFORMATION %% isaacs/minimatch NOTICES AND INFORMATION BEGIN HERE ========================================= -The ISC License +Blue Oak Model License -Copyright (c) Isaac Z. Schlueter and Contributors +Version 1.0.0 -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. +Purpose -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +This license gives everyone as much permission to work with +this software as possible, while protecting contributors +from liability. + +Acceptance + +In order to receive this license, you must agree to its +rules. The rules of this license are both obligations +under that agreement and conditions to your license. +You must not do anything with this software that triggers +a rule that you cannot or will not follow. + +Copyright + +Each contributor licenses you to do everything with this +software that would otherwise infringe that contributor's +copyright in it. + +Notices + +You must ensure that everyone who gets a copy of +any part of this software from you, with or without +changes, also gets the text of this license or a link to +https://blueoakcouncil.org/license/1.0.0. + +Excuse + +If anyone notifies you in writing that you have not +complied with Notices, you can keep your +license by taking all practical steps to comply within 30 +days after the notice. If you do not do so, your license +ends immediately. + +Patent + +Each contributor licenses you to do everything with this +software that would otherwise infringe any patent claims +they can license or become able to license. + +Reliability + +No contributor can revoke this license. + +No Liability + +As far as the law allows, this software comes as is, +without any warranty or condition, and no contributor +will be liable to anyone for any damages related to this +software or this license, under any kind of legal claim. ========================================= END OF isaacs/minimatch NOTICES AND INFORMATION diff --git a/extension.bundle.ts b/extension.bundle.ts index e07cf41e..70a082e9 100644 --- a/extension.bundle.ts +++ b/extension.bundle.ts @@ -28,6 +28,7 @@ export { languageServerApiManager } from "./src/languageServerApi/languageServer // tasks export { BuildTaskProvider, categorizePaths, getFinalPaths } from "./src/tasks/build/buildTaskProvider"; +export { dedupAlreadyCoveredPattern } from "./src/controllers/libraryController"; // delegate commands export { Jdtls } from "./src/java/jdtls"; diff --git a/package-lock.json b/package-lock.json index 726e7d5b..6526ae12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "fs-extra": "^11.4.0", "globby": "^13.1.3", "lodash": "^4.18.0", - "minimatch": "^5.1.9", + "minimatch": "^10.2.6", "semver": "^7.3.8", "vscode-extension-telemetry-wrapper": "^0.15.2", "vscode-tas-client": "^0.3.0" @@ -1147,7 +1147,8 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "node_modules/baseline-browser-mapping": { "version": "2.11.20", @@ -1172,6 +1173,7 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz", "integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -2323,14 +2325,39 @@ } }, "node_modules/minimatch": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz", - "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^5.0.8" }, "engines": { - "node": ">=10" + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimatch/node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/minimatch/node_modules/brace-expansion": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" } }, "node_modules/minimist": { @@ -4898,7 +4925,8 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "baseline-browser-mapping": { "version": "2.11.20", @@ -4915,6 +4943,7 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz", "integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==", + "dev": true, "requires": { "balanced-match": "^1.0.0" } @@ -5702,11 +5731,26 @@ "dev": true }, "minimatch": { - "version": "5.1.9", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz", - "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", "requires": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^5.0.8" + }, + "dependencies": { + "balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==" + }, + "brace-expansion": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "requires": { + "balanced-match": "^4.0.2" + } + } } }, "minimist": { diff --git a/package.json b/package.json index 2ea089a7..176e552d 100644 --- a/package.json +++ b/package.json @@ -1224,7 +1224,7 @@ "fs-extra": "^11.4.0", "globby": "^13.1.3", "lodash": "^4.18.0", - "minimatch": "^5.1.9", + "minimatch": "^10.2.6", "semver": "^7.3.8", "vscode-extension-telemetry-wrapper": "^0.15.2", "vscode-tas-client": "^0.3.0" diff --git a/src/controllers/libraryController.ts b/src/controllers/libraryController.ts index 237d2afc..fd6c833a 100644 --- a/src/controllers/libraryController.ts +++ b/src/controllers/libraryController.ts @@ -3,7 +3,7 @@ import * as fse from "fs-extra"; import * as _ from "lodash"; -import * as minimatch from "minimatch"; +import { minimatch } from "minimatch"; import { platform } from "os"; import * as path from "path"; import { Disposable, ExtensionContext, Uri, window, workspace, WorkspaceFolder } from "vscode"; @@ -90,7 +90,7 @@ export function addLibraryGlobs(libraryGlobs: string[]) { /** * Check if the `update` patterns are already covered by `origin` patterns and return those uncovered */ -function dedupAlreadyCoveredPattern(origin: string[], ...update: string[]): string[] { +export function dedupAlreadyCoveredPattern(origin: string[], ...update: string[]): string[] { return update.filter((newPattern) => { return !origin.some((originPattern) => { return minimatch(newPattern, originPattern); diff --git a/test/suite/libraryController.test.ts b/test/suite/libraryController.test.ts new file mode 100644 index 00000000..59113e04 --- /dev/null +++ b/test/suite/libraryController.test.ts @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +import * as assert from "assert"; +import { dedupAlreadyCoveredPattern } from "../../extension.bundle"; + +// tslint:disable: only-arrow-functions + +suite("Library Controller Tests", () => { + + test("test deduplicating covered library patterns", () => { + assert.deepStrictEqual( + dedupAlreadyCoveredPattern(["lib/**/*.jar"], "lib/foo.jar", "other/foo.jar"), + ["other/foo.jar"], + ); + }); +});