Skip to content

Commit c30e2cd

Browse files
committed
Bump version to 1.8.0
1 parent e8a6d16 commit c30e2cd

File tree

3 files changed

+157
-6437
lines changed

3 files changed

+157
-6437
lines changed

dist/index.js

Lines changed: 152 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
6363
step((generator = generator.apply(thisArg, _arguments || [])).next());
6464
});
6565
};
66+
var __importStar = (this && this.__importStar) || function (mod) {
67+
if (mod && mod.__esModule) return mod;
68+
var result = {};
69+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
70+
result["default"] = mod;
71+
return result;
72+
};
6673
Object.defineProperty(exports, "__esModule", { value: true });
67-
const childProcess = __webpack_require__(129);
68-
const path = __webpack_require__(622);
74+
const childProcess = __importStar(__webpack_require__(129));
75+
const path = __importStar(__webpack_require__(622));
6976
const util_1 = __webpack_require__(669);
70-
const ioUtil = __webpack_require__(672);
77+
const ioUtil = __importStar(__webpack_require__(672));
7178
const exec = util_1.promisify(childProcess.exec);
7279
/**
7380
* Copies a file or folder.
@@ -235,58 +242,73 @@ function which(tool, check) {
235242
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
236243
}
237244
}
245+
return result;
238246
}
239-
try {
240-
// build the list of extensions to try
241-
const extensions = [];
242-
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
243-
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
244-
if (extension) {
245-
extensions.push(extension);
246-
}
247+
const matches = yield findInPath(tool);
248+
if (matches && matches.length > 0) {
249+
return matches[0];
250+
}
251+
return '';
252+
});
253+
}
254+
exports.which = which;
255+
/**
256+
* Returns a list of all occurrences of the given tool on the system path.
257+
*
258+
* @returns Promise<string[]> the paths of the tool
259+
*/
260+
function findInPath(tool) {
261+
return __awaiter(this, void 0, void 0, function* () {
262+
if (!tool) {
263+
throw new Error("parameter 'tool' is required");
264+
}
265+
// build the list of extensions to try
266+
const extensions = [];
267+
if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) {
268+
for (const extension of process.env['PATHEXT'].split(path.delimiter)) {
269+
if (extension) {
270+
extensions.push(extension);
247271
}
248272
}
249-
// if it's rooted, return it if exists. otherwise return empty.
250-
if (ioUtil.isRooted(tool)) {
251-
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
252-
if (filePath) {
253-
return filePath;
254-
}
255-
return '';
256-
}
257-
// if any path separators, return empty
258-
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
259-
return '';
260-
}
261-
// build the list of directories
262-
//
263-
// Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
264-
// it feels like we should not do this. Checking the current directory seems like more of a use
265-
// case of a shell, and the which() function exposed by the toolkit should strive for consistency
266-
// across platforms.
267-
const directories = [];
268-
if (process.env.PATH) {
269-
for (const p of process.env.PATH.split(path.delimiter)) {
270-
if (p) {
271-
directories.push(p);
272-
}
273-
}
273+
}
274+
// if it's rooted, return it if exists. otherwise return empty.
275+
if (ioUtil.isRooted(tool)) {
276+
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
277+
if (filePath) {
278+
return [filePath];
274279
}
275-
// return the first match
276-
for (const directory of directories) {
277-
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
278-
if (filePath) {
279-
return filePath;
280+
return [];
281+
}
282+
// if any path separators, return empty
283+
if (tool.includes(path.sep)) {
284+
return [];
285+
}
286+
// build the list of directories
287+
//
288+
// Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
289+
// it feels like we should not do this. Checking the current directory seems like more of a use
290+
// case of a shell, and the which() function exposed by the toolkit should strive for consistency
291+
// across platforms.
292+
const directories = [];
293+
if (process.env.PATH) {
294+
for (const p of process.env.PATH.split(path.delimiter)) {
295+
if (p) {
296+
directories.push(p);
280297
}
281298
}
282-
return '';
283299
}
284-
catch (err) {
285-
throw new Error(`which failed with message ${err.message}`);
300+
// find all matches
301+
const matches = [];
302+
for (const directory of directories) {
303+
const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions);
304+
if (filePath) {
305+
matches.push(filePath);
306+
}
286307
}
308+
return matches;
287309
});
288310
}
289-
exports.which = which;
311+
exports.findInPath = findInPath;
290312
function readCopyOptions(options) {
291313
const force = options.force == null ? true : options.force;
292314
const recursive = Boolean(options.recursive);
@@ -2593,7 +2615,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
25932615
var __importStar = (this && this.__importStar) || function (mod) {
25942616
if (mod && mod.__esModule) return mod;
25952617
var result = {};
2596-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
2618+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25972619
__setModuleDefault(result, mod);
25982620
return result;
25992621
};
@@ -7719,7 +7741,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
77197741
var __importStar = (this && this.__importStar) || function (mod) {
77207742
if (mod && mod.__esModule) return mod;
77217743
var result = {};
7722-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
7744+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
77237745
__setModuleDefault(result, mod);
77247746
return result;
77257747
};
@@ -7816,7 +7838,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
78167838
var __importStar = (this && this.__importStar) || function (mod) {
78177839
if (mod && mod.__esModule) return mod;
78187840
var result = {};
7819-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
7841+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
78207842
__setModuleDefault(result, mod);
78217843
return result;
78227844
};
@@ -7826,6 +7848,9 @@ const semver = __importStar(__webpack_require__(876));
78267848
const core = __importStar(__webpack_require__(470));
78277849
const os_1 = __webpack_require__(316);
78287850
const VERSIONS_LIST = [
7851+
["5.4.3", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
7852+
["5.4.2", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
7853+
["5.4.1", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
78297854
["5.4", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
78307855
["5.3.3", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
78317856
["5.3.2", [os_1.OS.MacOS, os_1.OS.Ubuntu]],
@@ -7967,7 +7992,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
79677992
var __importStar = (this && this.__importStar) || function (mod) {
79687993
if (mod && mod.__esModule) return mod;
79697994
var result = {};
7970-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
7995+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
79717996
__setModuleDefault(result, mod);
79727997
return result;
79737998
};
@@ -8366,6 +8391,7 @@ exports.getInput = getInput;
83668391
*/
83678392
// eslint-disable-next-line @typescript-eslint/no-explicit-any
83688393
function setOutput(name, value) {
8394+
process.stdout.write(os.EOL);
83698395
command_1.issueCommand('set-output', { name }, value);
83708396
}
83718397
exports.setOutput = setOutput;
@@ -8630,7 +8656,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
86308656
var __importStar = (this && this.__importStar) || function (mod) {
86318657
if (mod && mod.__esModule) return mod;
86328658
var result = {};
8633-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
8659+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
86348660
__setModuleDefault(result, mod);
86358661
return result;
86368662
};
@@ -12183,11 +12209,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
1218312209
step((generator = generator.apply(thisArg, _arguments || [])).next());
1218412210
});
1218512211
};
12212+
var __importStar = (this && this.__importStar) || function (mod) {
12213+
if (mod && mod.__esModule) return mod;
12214+
var result = {};
12215+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
12216+
result["default"] = mod;
12217+
return result;
12218+
};
1218612219
var _a;
1218712220
Object.defineProperty(exports, "__esModule", { value: true });
1218812221
const assert_1 = __webpack_require__(357);
12189-
const fs = __webpack_require__(747);
12190-
const path = __webpack_require__(622);
12222+
const fs = __importStar(__webpack_require__(747));
12223+
const path = __importStar(__webpack_require__(622));
1219112224
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
1219212225
exports.IS_WINDOWS = process.platform === 'win32';
1219312226
function exists(fsPath) {
@@ -13751,22 +13784,30 @@ exports.exec = exec;
1375113784
/***/ (function(module, __unusedexports, __webpack_require__) {
1375213785

1375313786
const Range = __webpack_require__(124)
13754-
const { ANY } = __webpack_require__(174)
13787+
const Comparator = __webpack_require__(174)
13788+
const { ANY } = Comparator
1375513789
const satisfies = __webpack_require__(310)
1375613790
const compare = __webpack_require__(874)
1375713791

1375813792
// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
13759-
// - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...`
13793+
// - Every simple range `r1, r2, ...` is a null set, OR
13794+
// - Every simple range `r1, r2, ...` which is not a null set is a subset of
13795+
// some `R1, R2, ...`
1376013796
//
1376113797
// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
1376213798
// - If c is only the ANY comparator
1376313799
// - If C is only the ANY comparator, return true
13764-
// - Else return false
13800+
// - Else if in prerelease mode, return false
13801+
// - else replace c with `[>=0.0.0]`
13802+
// - If C is only the ANY comparator
13803+
// - if in prerelease mode, return true
13804+
// - else replace C with `[>=0.0.0]`
1376513805
// - Let EQ be the set of = comparators in c
1376613806
// - If EQ is more than one, return true (null set)
1376713807
// - Let GT be the highest > or >= comparator in c
1376813808
// - Let LT be the lowest < or <= comparator in c
1376913809
// - If GT and LT, and GT.semver > LT.semver, return true (null set)
13810+
// - If any C is a = range, and GT or LT are set, return false
1377013811
// - If EQ
1377113812
// - If GT, and EQ does not satisfy GT, return true (null set)
1377213813
// - If LT, and EQ does not satisfy LT, return true (null set)
@@ -13775,13 +13816,16 @@ const compare = __webpack_require__(874)
1377513816
// - If GT
1377613817
// - If GT.semver is lower than any > or >= comp in C, return false
1377713818
// - If GT is >=, and GT.semver does not satisfy every C, return false
13819+
// - If GT.semver has a prerelease, and not in prerelease mode
13820+
// - If no C has a prerelease and the GT.semver tuple, return false
1377813821
// - If LT
1377913822
// - If LT.semver is greater than any < or <= comp in C, return false
1378013823
// - If LT is <=, and LT.semver does not satisfy every C, return false
13781-
// - If any C is a = range, and GT or LT are set, return false
13824+
// - If GT.semver has a prerelease, and not in prerelease mode
13825+
// - If no C has a prerelease and the LT.semver tuple, return false
1378213826
// - Else return true
1378313827

13784-
const subset = (sub, dom, options) => {
13828+
const subset = (sub, dom, options = {}) => {
1378513829
if (sub === dom)
1378613830
return true
1378713831

@@ -13810,8 +13854,21 @@ const simpleSubset = (sub, dom, options) => {
1381013854
if (sub === dom)
1381113855
return true
1381213856

13813-
if (sub.length === 1 && sub[0].semver === ANY)
13814-
return dom.length === 1 && dom[0].semver === ANY
13857+
if (sub.length === 1 && sub[0].semver === ANY) {
13858+
if (dom.length === 1 && dom[0].semver === ANY)
13859+
return true
13860+
else if (options.includePrerelease)
13861+
sub = [ new Comparator('>=0.0.0-0') ]
13862+
else
13863+
sub = [ new Comparator('>=0.0.0') ]
13864+
}
13865+
13866+
if (dom.length === 1 && dom[0].semver === ANY) {
13867+
if (options.includePrerelease)
13868+
return true
13869+
else
13870+
dom = [ new Comparator('>=0.0.0') ]
13871+
}
1381513872

1381613873
const eqSet = new Set()
1381713874
let gt, lt
@@ -13854,10 +13911,32 @@ const simpleSubset = (sub, dom, options) => {
1385413911

1385513912
let higher, lower
1385613913
let hasDomLT, hasDomGT
13914+
// if the subset has a prerelease, we need a comparator in the superset
13915+
// with the same tuple and a prerelease, or it's not a subset
13916+
let needDomLTPre = lt &&
13917+
!options.includePrerelease &&
13918+
lt.semver.prerelease.length ? lt.semver : false
13919+
let needDomGTPre = gt &&
13920+
!options.includePrerelease &&
13921+
gt.semver.prerelease.length ? gt.semver : false
13922+
// exception: <1.2.3-0 is the same as <1.2.3
13923+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
13924+
lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
13925+
needDomLTPre = false
13926+
}
13927+
1385713928
for (const c of dom) {
1385813929
hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
1385913930
hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
1386013931
if (gt) {
13932+
if (needDomGTPre) {
13933+
if (c.semver.prerelease && c.semver.prerelease.length &&
13934+
c.semver.major === needDomGTPre.major &&
13935+
c.semver.minor === needDomGTPre.minor &&
13936+
c.semver.patch === needDomGTPre.patch) {
13937+
needDomGTPre = false
13938+
}
13939+
}
1386113940
if (c.operator === '>' || c.operator === '>=') {
1386213941
higher = higherGT(gt, c, options)
1386313942
if (higher === c && higher !== gt)
@@ -13866,6 +13945,14 @@ const simpleSubset = (sub, dom, options) => {
1386613945
return false
1386713946
}
1386813947
if (lt) {
13948+
if (needDomLTPre) {
13949+
if (c.semver.prerelease && c.semver.prerelease.length &&
13950+
c.semver.major === needDomLTPre.major &&
13951+
c.semver.minor === needDomLTPre.minor &&
13952+
c.semver.patch === needDomLTPre.patch) {
13953+
needDomLTPre = false
13954+
}
13955+
}
1386913956
if (c.operator === '<' || c.operator === '<=') {
1387013957
lower = lowerLT(lt, c, options)
1387113958
if (lower === c && lower !== lt)
@@ -13886,6 +13973,12 @@ const simpleSubset = (sub, dom, options) => {
1388613973
if (lt && hasDomGT && !gt && gtltComp !== 0)
1388713974
return false
1388813975

13976+
// we needed a prerelease range in a specific tuple, but didn't get one
13977+
// then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
13978+
// because it includes prereleases in the 1.2.3 tuple
13979+
if (needDomGTPre || needDomLTPre)
13980+
return false
13981+
1388913982
return true
1389013983
}
1389113984

0 commit comments

Comments
 (0)