diff --git a/.eslint-plugin-local/index.ts b/.eslint-plugin-local/index.ts index 0666fcd1..dd146b09 100644 --- a/.eslint-plugin-local/index.ts +++ b/.eslint-plugin-local/index.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import type { ESLint } from 'eslint'; -import glob from 'glob'; +import { glob } from 'glob'; import { createRequire } from 'module'; import path from 'path'; diff --git a/build/gulpfile.extensions.ts b/build/gulpfile.extensions.ts index dafca7f2..628e285d 100644 --- a/build/gulpfile.extensions.ts +++ b/build/gulpfile.extensions.ts @@ -10,10 +10,9 @@ EventEmitter.defaultMaxListeners = 100; import es from 'event-stream'; import fancyLog from 'fancy-log'; import * as fs from 'fs'; -import glob from 'glob'; +import { glob } from 'glob'; import { gulp, filter, plumber, sourcemaps } from './lib/gulp/facade.ts'; import * as path from 'path'; -import * as nodeUtil from 'util'; import * as ext from './lib/extensions.ts'; import { getVersion } from './lib/getVersion.ts'; import { createReporter } from './lib/reporter.ts'; @@ -315,7 +314,7 @@ async function buildWebExtensions(isWatch: boolean): Promise { const extensionsPath = path.join(root, 'extensions'); // Find all esbuild.browser.mts files - const esbuildConfigLocations = await nodeUtil.promisify(glob)( + const esbuildConfigLocations = await glob( path.join(extensionsPath, '**', 'esbuild.browser.mts'), { ignore: ['**/node_modules'] } ); diff --git a/build/gulpfile.reh.ts b/build/gulpfile.reh.ts index ef8c094e..ea308146 100644 --- a/build/gulpfile.reh.ts +++ b/build/gulpfile.reh.ts @@ -19,7 +19,7 @@ import packageJson from '../package.json' with { type: 'json' }; import { untar } from './lib/util.ts'; import File from 'vinyl'; import * as fs from 'fs'; -import glob from 'glob'; +import { glob } from 'glob'; import { promisify } from 'util'; import rceditCallback from 'rcedit'; import { compileBuildWithManglingTask } from './gulpfile.compile.ts'; @@ -461,8 +461,8 @@ function patchWin32DependenciesTask(destinationFolderName: string) { return async () => { const deps = (await Promise.all([ - promisify(glob)('**/*.node', { cwd }), - promisify(glob)('**/rg.exe', { cwd }), + glob('**/*.node', { cwd }), + glob('**/rg.exe', { cwd }), ])).flatMap(o => o); const packageJsonContents = JSON.parse(await fs.promises.readFile(path.join(cwd, 'package.json'), 'utf8')); const productContents = JSON.parse(await fs.promises.readFile(path.join(cwd, 'product.json'), 'utf8')); diff --git a/build/gulpfile.ts b/build/gulpfile.ts index 888d4fff..9d3fdfec 100644 --- a/build/gulpfile.ts +++ b/build/gulpfile.ts @@ -5,7 +5,7 @@ import { EventEmitter } from 'events'; EventEmitter.defaultMaxListeners = 100; -import glob from 'glob'; +import { glob } from 'glob'; import { createRequire } from 'node:module'; import { monacoTypecheckTask /* , monacoTypecheckWatchTask */ } from './gulpfile.editor.ts'; import { compileExtensionMediaTask, compileExtensionsTask, watchExtensionsTask } from './gulpfile.extensions.ts'; diff --git a/build/gulpfile.vscode.ts b/build/gulpfile.vscode.ts index 6e98a079..0bcad2b2 100644 --- a/build/gulpfile.vscode.ts +++ b/build/gulpfile.vscode.ts @@ -31,13 +31,12 @@ import { copyCodiconsTask } from './lib/compilation.ts'; import { getCopilotExcludeFilter, getRipgrepExcludeFilter, prepareBuiltInCopilotRipgrepShim } from './lib/copilot.ts'; import { useEsbuildTranspile } from './buildConfig.ts'; import { promisify } from 'util'; -import globCallback from 'glob'; +import { glob } from 'glob'; import rceditCallback from 'rcedit'; import { spawnTsgo } from './lib/tsgo.ts'; import { runEsbuildTranspile, runEsbuildBundle } from './lib/esbuild.ts'; -const glob = promisify(globCallback); const rcedit = promisify(rceditCallback); const root = path.dirname(import.meta.dirname); const commit = getVersion(root); diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts index d5b4a0fa..d87bdcf9 100644 --- a/build/lib/extensions.ts +++ b/build/lib/extensions.ts @@ -6,7 +6,7 @@ import es from 'event-stream'; import fs from 'fs'; import cp from 'child_process'; -import glob from 'glob'; +import { glob } from 'glob'; import { gulp, filter, rename, buffer, vinylZip, jsonEditor } from './gulp/facade.ts'; import path from 'path'; import crypto from 'crypto'; diff --git a/build/next/index.ts b/build/next/index.ts index 7e0ef886..b507de74 100644 --- a/build/next/index.ts +++ b/build/next/index.ts @@ -6,9 +6,8 @@ import * as esbuild from 'esbuild'; import * as fs from 'fs'; import * as path from 'path'; -import { promisify } from 'util'; -import glob from 'glob'; +import { glob } from 'glob'; import gulpWatch from '../lib/watch/index.ts'; import { nlsPlugin, createNLSCollector, finalizeNLS, postProcessNLS } from './nls-plugin.ts'; import { convertPrivateFields, adjustSourceMap, type ConvertPrivateFieldsResult } from './private-to-property.ts'; @@ -19,7 +18,7 @@ import packageJson from '../../package.json' with { type: 'json' }; import { useEsbuildTranspile } from '../buildConfig.ts'; import { isWebExtension, type IScannedBuiltinExtension } from '../lib/extensions.ts'; -const globAsync = promisify(glob); +const globAsync = glob; // ============================================================================ // Configuration diff --git a/extensions/css-language-features/server/test/index.js b/extensions/css-language-features/server/test/index.js index 55eee8a1..5b9241af 100644 --- a/extensions/css-language-features/server/test/index.js +++ b/extensions/css-language-features/server/test/index.js @@ -8,7 +8,7 @@ import { spec, junit } from 'node:test/reporters'; import path from 'node:path'; import fs from 'node:fs'; import { PassThrough } from 'node:stream'; -import glob from 'glob'; +import { glob } from 'glob'; const testRoot = import.meta.dirname; const files = glob.sync(path.posix.join(testRoot, '../out/test/**/*.test.js')); diff --git a/extensions/html-language-features/server/test/index.js b/extensions/html-language-features/server/test/index.js index 3057734f..9d06d755 100644 --- a/extensions/html-language-features/server/test/index.js +++ b/extensions/html-language-features/server/test/index.js @@ -8,7 +8,7 @@ import { spec, junit } from 'node:test/reporters'; import path from 'node:path'; import fs from 'node:fs'; import { PassThrough } from 'node:stream'; -import glob from 'glob'; +import { glob } from 'glob'; const testRoot = import.meta.dirname; const files = glob.sync(path.posix.join(testRoot, '../out/test/**/*.test.js')); diff --git a/package-lock.json b/package-lock.json index 6d27d269..6f0df636 100644 --- a/package-lock.json +++ b/package-lock.json @@ -127,7 +127,7 @@ "eslint-plugin-jsdoc": "^63.0.2", "event-stream": "3.3.4", "fancy-log": "^1.3.3", - "glob": "^5.0.15", + "glob": "^13.0.6", "gulp": "^4.0.2", "gulp-azure-storage": "^0.12.1", "gulp-bom": "^3.0.0", @@ -10289,21 +10289,21 @@ "license": "MIT" }, "node_modules/glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", - "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "version": "13.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", + "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "minimatch": "^10.2.2", + "minipass": "^7.1.3", + "path-scurry": "^2.0.2" }, "engines": { - "node": "*" + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/glob-parent": { @@ -10676,6 +10676,72 @@ "node": ">=0.10.0" } }, + "node_modules/glob/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==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", + "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/glob/node_modules/lru-cache": { + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", + "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob/node_modules/path-scurry": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", + "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/global-agent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz", @@ -18233,90 +18299,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rimraf/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==", - "dev": true, - "license": "MIT", - "engines": { - "node": "18 || 20 || >=22" - } - }, - "node_modules/rimraf/node_modules/brace-expansion": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", - "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^4.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", - "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "minimatch": "^10.2.2", - "minipass": "^7.1.3", - "path-scurry": "^2.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/lru-cache": { - "version": "11.5.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.0.tgz", - "integrity": "sha512-5YgH9UJd7wVb9hIouI2adWpgqrrICkt070Dnj8EUY1+B4B2P9eRLPAkAAo6NICA7CEhOIeBHl46u9zSNpNu7zA==", - "dev": true, - "license": "BlueOak-1.0.0", - "engines": { - "node": "20 || >=22" - } - }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "10.2.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", - "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "brace-expansion": "^5.0.5" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/path-scurry": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", - "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/roarr": { "version": "2.15.4", "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz", diff --git a/package.json b/package.json index ecc07955..84f5b45a 100644 --- a/package.json +++ b/package.json @@ -204,7 +204,7 @@ "eslint-plugin-jsdoc": "^63.0.2", "event-stream": "3.3.4", "fancy-log": "^1.3.3", - "glob": "^5.0.15", + "glob": "^13.0.6", "gulp": "^4.0.2", "gulp-azure-storage": "^0.12.1", "gulp-bom": "^3.0.0", diff --git a/test/integration/electron/testrunner.js b/test/integration/electron/testrunner.js index 93f518da..358c601f 100644 --- a/test/integration/electron/testrunner.js +++ b/test/integration/electron/testrunner.js @@ -7,7 +7,7 @@ 'use strict'; const paths = require('path'); -const glob = require('glob'); +const { glob } = require('glob'); // Linux: prevent a weird NPE when mocha on Linux requires the window size from the TTY // Since we are not running in a tty environment, we just implement the method statically const tty = require('tty'); @@ -35,10 +35,7 @@ exports.run = function run(testsRoot, clb) { require('source-map-support').install(); // Glob test files - glob('**/**.test.js', { cwd: testsRoot }, function (error, files) { - if (error) { - return clb(error); - } + glob('**/**.test.js', { cwd: testsRoot }).then(function (files) { try { // Fill into Mocha files.forEach(function (f) { return mocha.addFile(paths.join(testsRoot, f)); }); @@ -50,5 +47,7 @@ exports.run = function run(testsRoot, clb) { catch (error) { return clb(error); } + }, function (error) { + return clb(error); }); }; diff --git a/test/unit/browser/index.js b/test/unit/browser/index.js index 7789165f..6ddbde5b 100644 --- a/test/unit/browser/index.js +++ b/test/unit/browser/index.js @@ -7,7 +7,7 @@ 'use strict'; const path = require('path'); -const glob = require('glob'); +const { glob } = require('glob'); const events = require('events'); const mocha = require('mocha'); const createStatsCollector = require('mocha/lib/stats-collector'); @@ -21,7 +21,6 @@ const yaserver = require('yaserver'); const http = require('http'); const { randomBytes } = require('crypto'); const minimist = require('minimist'); -const { promisify } = require('node:util'); /** * @type {{ @@ -134,15 +133,7 @@ const testModules = (async function () { const pattern = args.runGlob || defaultGlob; isDefaultModules = pattern === defaultGlob; - promise = new Promise((resolve, reject) => { - glob(pattern, { cwd: out }, (err, files) => { - if (err) { - reject(err); - } else { - resolve(files); - } - }); - }); + promise = glob(pattern, { cwd: out }); } return promise.then(files => { @@ -255,7 +246,7 @@ async function runTestsInBrowser(testModules, browserType, browserChannel) { } // append CSS modules as query-param - await promisify(require('glob'))('**/*.css', { cwd: out }).then(async cssModules => { + await glob('**/*.css', { cwd: out }).then(async cssModules => { const cssData = await new Response((await new Response(cssModules.join(',')).blob()).stream().pipeThrough(new CompressionStream('gzip'))).arrayBuffer(); target.searchParams.set('_devCssData', Buffer.from(cssData).toString('base64')); }); diff --git a/test/unit/electron/renderer.js b/test/unit/electron/renderer.js index 7f8a5b72..2d8f3102 100644 --- a/test/unit/electron/renderer.js +++ b/test/unit/electron/renderer.js @@ -65,7 +65,7 @@ const fs = require('fs'); const { ipcRenderer } = require('electron'); const assert = require('assert'); const path = require('path'); -const glob = require('glob'); +const { glob } = require('glob'); const util = require('util'); const coverage = require('../coverage'); const { pathToFileURL } = require('url'); @@ -156,7 +156,7 @@ async function loadModules(modules) { } } -const globAsync = util.promisify(glob); +const globAsync = glob; async function loadTestModules(opts) { diff --git a/test/unit/node/index.js b/test/unit/node/index.js index 3f9d4a84..897f0571 100644 --- a/test/unit/node/index.js +++ b/test/unit/node/index.js @@ -12,7 +12,7 @@ import * as assert from 'assert'; import Mocha from 'mocha'; import * as path from 'path'; import * as fs from 'fs'; -import glob from 'glob'; +import { glob } from 'glob'; import minimatch from 'minimatch'; import minimist from 'minimist'; import * as module from 'module'; @@ -163,7 +163,7 @@ function main() { loadModules(modulesToLoad).then(() => cb(null), cb); }; - glob(args.runGlob, { cwd: src }, function(err, files) { doRun(files); }); + glob(args.runGlob, { cwd: src }).then(files => doRun(files), cb); }; } else if (args.run) { const tests = (typeof args.run === 'string') ? [args.run] : args.run; @@ -177,7 +177,7 @@ function main() { }; } else { loadFunc = (cb) => { - glob(TEST_GLOB, { cwd: src }, function(err, files) { + glob(TEST_GLOB, { cwd: src }).then(files => { /** @type {string[]} */ const modules = []; for (const file of files) { @@ -186,7 +186,7 @@ function main() { } } loadModules(modules).then(() => cb(null), cb); - }); + }, cb); }; }