Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion node/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ export interface _MatchOptions {
nocomment?: boolean;
nonegate?: boolean;
flipNegate?: boolean;
windowsPathsNoEscape?: boolean;
}

export function _cloneMatchOptions(matchOptions: _MatchOptions): _MatchOptions {
Expand All @@ -614,7 +615,8 @@ export function _cloneMatchOptions(matchOptions: _MatchOptions): _MatchOptions {
matchBase: matchOptions.matchBase,
nocomment: matchOptions.nocomment,
nonegate: matchOptions.nonegate,
flipNegate: matchOptions.flipNegate
flipNegate: matchOptions.flipNegate,
windowsPathsNoEscape: matchOptions.windowsPathsNoEscape
};
}

Expand Down Expand Up @@ -646,6 +648,9 @@ export function _getFindInfoFromPattern(defaultRoot: string, pattern: string, ma
// for the sake of determining the findPath, pretend nocase=false
matchOptions = _cloneMatchOptions(matchOptions);
matchOptions.nocase = false;
if (process.platform == 'win32' && matchOptions.windowsPathsNoEscape === undefined) {
matchOptions.windowsPathsNoEscape = true;
}

// check if basename only and matchBase=true
if (matchOptions.matchBase &&
Expand Down
1 change: 1 addition & 0 deletions node/mock-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ export interface MatchOptions {
nocomment?: boolean;
nonegate?: boolean;
flipNegate?: boolean;
windowsPathsNoEscape?: boolean;
}

export function findMatch(defaultRoot: string, patterns: string[] | string) : string[] {
Expand Down
116 changes: 39 additions & 77 deletions node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-pipelines-task-lib",
"version": "5.2.9",
"version": "5.3.0",
"description": "Azure Pipelines Task SDK",
"main": "./task.js",
"typings": "./task.d.ts",
Expand Down Expand Up @@ -28,15 +28,14 @@
"homepage": "https://github.com/Microsoft/azure-pipelines-task-lib",
"dependencies": {
"adm-zip": "^0.5.10",
"minimatch": "^3.1.5",
"minimatch": "^10.2.4",
"nodejs-file-downloader": "^4.11.1",
"q": "^1.5.1",
"semver": "^5.7.2",
"shelljs": "^0.10.0",
"uuid": "^3.0.1"
},
"devDependencies": {
"@types/minimatch": "3.0.3",
"@types/mocha": "^10.0.10",
"@types/node": "^16.11.39",
"@types/q": "^1.5.4",
Expand Down
14 changes: 13 additions & 1 deletion node/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,7 @@ export interface MatchOptions {
nocomment?: boolean;
nonegate?: boolean;
flipNegate?: boolean;
windowsPathsNoEscape?: boolean;
}

/**
Expand All @@ -1997,6 +1998,9 @@ export function match(list: string[], patterns: string[] | string, patternRoot?:
// trace parameters
debug(`patternRoot: '${patternRoot}'`);
options = options || _getDefaultMatchOptions(); // default match options
if (process.platform == 'win32' && options.windowsPathsNoEscape === undefined) {
options.windowsPathsNoEscape = true;
}
_debugMatchOptions(options);

// convert pattern to an array
Expand Down Expand Up @@ -2129,6 +2133,9 @@ export function match(list: string[], patterns: string[] | string, patternRoot?:
*/
export function filter(pattern: string, options?: MatchOptions): (element: string, indexed: number, array: string[]) => boolean {
options = options || _getDefaultMatchOptions();
if (process.platform == 'win32' && options.windowsPathsNoEscape === undefined) {
options.windowsPathsNoEscape = true;
}
return minimatch.filter(pattern, options);
}

Expand All @@ -2144,6 +2151,7 @@ function _debugMatchOptions(options: MatchOptions): void {
debug(`matchOptions.nocomment: '${options.nocomment}'`);
debug(`matchOptions.nonegate: '${options.nonegate}'`);
debug(`matchOptions.flipNegate: '${options.flipNegate}'`);
debug(`matchOptions.windowsPathsNoEscape: '${options.windowsPathsNoEscape}'`);
}

function _getDefaultMatchOptions(): MatchOptions {
Expand All @@ -2158,7 +2166,8 @@ function _getDefaultMatchOptions(): MatchOptions {
matchBase: false,
nocomment: false,
nonegate: false,
flipNegate: false
flipNegate: false,
windowsPathsNoEscape: process.platform == 'win32'
};
}

Expand All @@ -2182,6 +2191,9 @@ export function findMatch(defaultRoot: string, patterns: string[] | string, find
findOptions = findOptions || _getDefaultFindOptions();
_debugFindOptions(findOptions);
matchOptions = matchOptions || _getDefaultMatchOptions();
if (process.platform == 'win32' && matchOptions.windowsPathsNoEscape === undefined) {
matchOptions.windowsPathsNoEscape = true;
}
_debugMatchOptions(matchOptions);

// normalize slashes for root dir
Expand Down
2 changes: 1 addition & 1 deletion node/toolrunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ class ExecState extends events.EventEmitter {
private readonly options: IExecOptions;
private readonly toolPath: string;

private timeout: NodeJS.Timer | null = null;
private timeout: ReturnType<typeof setTimeout> | null = null;
private done: boolean;

public CheckComplete(): void {
Expand Down