Skip to content

Commit

Permalink
Update glob.
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-mcmanus committed Jun 6, 2024
1 parent de9d4bc commit 4e4f6ff
Show file tree
Hide file tree
Showing 5 changed files with 342 additions and 159 deletions.
3 changes: 1 addition & 2 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6481,7 +6481,6 @@
},
"devDependencies": {
"@octokit/rest": "^20.1.1",
"@types/glob": "^7.1.6",
"@types/minimatch": "^3.0.5",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.12",
Expand Down Expand Up @@ -6530,7 +6529,7 @@
"comment-json": "^4.2.3",
"editorconfig": "^2.0.0",
"escape-string-regexp": "^2.0.0",
"glob": "^7.1.6",
"glob": "^10.4.1",
"minimatch": "^3.0.5",
"mkdirp": "^3.0.1",
"node-fetch": "^2.6.9",
Expand Down
9 changes: 3 additions & 6 deletions Extension/src/Debugger/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@

import * as jsonc from 'comment-json';
import * as fs from 'fs';
import * as glob from 'glob';
import { glob } from 'glob';
import * as os from 'os';
import * as path from 'path';
import { promisify } from 'util';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import * as util from '../common';
Expand Down Expand Up @@ -39,8 +38,6 @@ enum StepType {
command = 'command'
}

const globAsync: (pattern: string, options?: glob.IOptions | undefined) => Promise<string[]> = promisify(glob);

/*
* Retrieves configurations from a provider and displays them in a quickpick menu to be selected.
* Ensures that the selected configuration's preLaunchTask (if existent) is populated in the user's task.json.
Expand Down Expand Up @@ -1052,10 +1049,10 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
const jumpHosts: util.ISshHostInfo[] = step.host.jumpHosts;
let files: vscode.Uri[] = [];
if (util.isString(step.files)) {
files = files.concat((await globAsync(step.files)).map(file => vscode.Uri.file(file)));
files = files.concat((await glob(step.files)).map(file => vscode.Uri.file(file)));
} else if (util.isArrayOfString(step.files)) {
for (const fileGlob of (step.files as string[])) {
files = files.concat((await globAsync(fileGlob)).map(file => vscode.Uri.file(file)));
files = files.concat((await glob(fileGlob)).map(file => vscode.Uri.file(file)));
}
} else {
void logger.getOutputChannelLogger().showErrorMessage(localize('incorrect.files.type.copyFile', '"files" must be a string or an array of strings in {0} steps.', isScp ? 'SCP' : 'rsync'));
Expand Down
7 changes: 2 additions & 5 deletions Extension/src/SSH/sshHosts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ------------------------------------------------------------------------------------------ */

import { promises as fs } from 'fs';
import * as glob from 'glob';
import { glob } from 'glob';
import * as os from 'os';
import * as path from 'path';
import {
Expand All @@ -15,7 +15,6 @@ import {
ResolvedConfiguration,
parse
} from 'ssh-config';
import { promisify } from 'util';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { ISshConfigHostInfo, resolveHome } from "../common";
Expand All @@ -25,8 +24,6 @@ import { getSshChannel } from '../logger';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();

const globAsync: (pattern: string, options?: glob.IOptions | undefined) => Promise<string[]> = promisify(glob);

const userSshConfigurationFile: string = path.resolve(os.homedir(), '.ssh/config');

const ProgramData: string = process.env.ALLUSERSPROFILE || process.env.PROGRAMDATA || 'C:\\ProgramData';
Expand Down Expand Up @@ -111,7 +108,7 @@ async function resolveConfigIncludes(config: Configuration, configPath: string):
includePath = path.resolve(path.dirname(configPath), includePath);
}

const pathsToGetFilesFrom: string[] = await globAsync(includePath);
const pathsToGetFilesFrom: string[] = await glob(includePath);

for (const filePath of pathsToGetFilesFrom) {
await getIncludedConfigFile(config, filePath);
Expand Down
5 changes: 1 addition & 4 deletions Extension/test/common/selectTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
* ------------------------------------------------------------------------------------------ */

import { readdir } from 'fs/promises';
import { IOptions, glob as globSync } from 'glob';
import { glob } from 'glob';
import * as Mocha from 'mocha';
import { basename, dirname, resolve } from 'path';
import { env } from 'process';
import { promisify } from 'util';
import { returns } from '../../src/Utility/Async/returns';
import { filepath } from '../../src/Utility/Filesystem/filepath';

export const glob: (pattern: string, options?: IOptions | undefined) => Promise<string[]> = promisify(globSync);

// depending if this is pulled in as a ts-node script, or an already-compiled file in dist/...
const $root = __dirname.includes('dist') ? resolve(__dirname, '..', '..', '..') : resolve(__dirname, '..', '..');

Expand Down
Loading

0 comments on commit 4e4f6ff

Please sign in to comment.