mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-08-15 05:05:08 +00:00
Fix: Run build to attempt fixing the failing workflow
This commit is contained in:
parent
a76e7575c8
commit
3f690c2c8f
426
dist/cache-save/index.js
vendored
426
dist/cache-save/index.js
vendored
@ -58523,91 +58523,91 @@ exports["default"] = _default;
|
|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
}
|
}
|
||||||
Object.defineProperty(o, k2, desc);
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
}));
|
}));
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.run = void 0;
|
exports.run = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
const node_fs_1 = __importDefault(__nccwpck_require__(7561));
|
const node_fs_1 = __importDefault(__nccwpck_require__(7561));
|
||||||
const cache_utils_1 = __nccwpck_require__(1678);
|
const cache_utils_1 = __nccwpck_require__(1678);
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
||||||
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
||||||
// throw an uncaught exception. Instead of failing this action, just warn.
|
// throw an uncaught exception. Instead of failing this action, just warn.
|
||||||
process.on('uncaughtException', e => {
|
process.on('uncaughtException', e => {
|
||||||
const warningPrefix = '[warning]';
|
const warningPrefix = '[warning]';
|
||||||
core.info(`${warningPrefix}${e.message}`);
|
core.info(`${warningPrefix}${e.message}`);
|
||||||
});
|
});
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
if (core.getBooleanInput('cache')) {
|
if (core.getBooleanInput('cache')) {
|
||||||
yield cachePackages();
|
yield cachePackages();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () {
|
const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const state = core.getState(constants_1.State.CacheMatchedKey);
|
const state = core.getState(constants_1.State.CacheMatchedKey);
|
||||||
const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
|
const primaryKey = core.getState(constants_1.State.CachePrimaryKey);
|
||||||
if (!primaryKey) {
|
if (!primaryKey) {
|
||||||
core.info('Primary key was not generated, not saving cache.');
|
core.info('Primary key was not generated, not saving cache.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)();
|
const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)();
|
||||||
if (!node_fs_1.default.existsSync(cachePath)) {
|
if (!node_fs_1.default.existsSync(cachePath)) {
|
||||||
throw new Error(`Cache folder path is retrieved for .NET CLI but doesn't exist on disk: ${cachePath}`);
|
throw new Error(`Cache folder path is retrieved for .NET CLI but doesn't exist on disk: ${cachePath}`);
|
||||||
}
|
}
|
||||||
if (primaryKey === state) {
|
if (primaryKey === state) {
|
||||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const cacheId = yield cache.saveCache([cachePath], primaryKey);
|
const cacheId = yield cache.saveCache([cachePath], primaryKey);
|
||||||
if (cacheId == -1) {
|
if (cacheId == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||||
});
|
});
|
||||||
run();
|
run();
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -58616,114 +58616,114 @@ run();
|
|||||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
}
|
}
|
||||||
Object.defineProperty(o, k2, desc);
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
}));
|
}));
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||||
}) : function(o, v) {
|
}) : function(o, v) {
|
||||||
o["default"] = v;
|
o["default"] = v;
|
||||||
});
|
});
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.isCacheFeatureAvailable = exports.getNuGetFolderPath = void 0;
|
exports.isCacheFeatureAvailable = exports.getNuGetFolderPath = void 0;
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
const constants_1 = __nccwpck_require__(9042);
|
const constants_1 = __nccwpck_require__(9042);
|
||||||
/**
|
/**
|
||||||
* Get NuGet global packages, cache, and temp folders from .NET CLI.
|
* Get NuGet global packages, cache, and temp folders from .NET CLI.
|
||||||
* @returns (Folder Name)-(Path) mappings
|
* @returns (Folder Name)-(Path) mappings
|
||||||
* @see https://docs.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders
|
* @see https://docs.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders
|
||||||
* @example
|
* @example
|
||||||
* Windows
|
* Windows
|
||||||
* ```json
|
* ```json
|
||||||
* {
|
* {
|
||||||
* "http-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\v3-cache",
|
* "http-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\v3-cache",
|
||||||
* "global-packages": "C:\\Users\\user1\\.nuget\\packages\\",
|
* "global-packages": "C:\\Users\\user1\\.nuget\\packages\\",
|
||||||
* "temp": "C:\\Users\\user1\\AppData\\Local\\Temp\\NuGetScratch",
|
* "temp": "C:\\Users\\user1\\AppData\\Local\\Temp\\NuGetScratch",
|
||||||
* "plugins-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\plugins-cache"
|
* "plugins-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\plugins-cache"
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* Mac/Linux
|
* Mac/Linux
|
||||||
* ```json
|
* ```json
|
||||||
* {
|
* {
|
||||||
* "http-cache": "/home/user1/.local/share/NuGet/v3-cache",
|
* "http-cache": "/home/user1/.local/share/NuGet/v3-cache",
|
||||||
* "global-packages": "/home/user1/.nuget/packages/",
|
* "global-packages": "/home/user1/.nuget/packages/",
|
||||||
* "temp": "/tmp/NuGetScratch",
|
* "temp": "/tmp/NuGetScratch",
|
||||||
* "plugins-cache": "/home/user1/.local/share/NuGet/plugins-cache"
|
* "plugins-cache": "/home/user1/.local/share/NuGet/plugins-cache"
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
const getNuGetFolderPath = () => __awaiter(void 0, void 0, void 0, function* () {
|
const getNuGetFolderPath = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const { stdout, stderr, exitCode } = yield exec.getExecOutput(constants_1.cliCommand, undefined, { ignoreReturnCode: true, silent: true });
|
const { stdout, stderr, exitCode } = yield exec.getExecOutput(constants_1.cliCommand, undefined, { ignoreReturnCode: true, silent: true });
|
||||||
if (exitCode) {
|
if (exitCode) {
|
||||||
throw new Error(!stderr.trim()
|
throw new Error(!stderr.trim()
|
||||||
? `The '${constants_1.cliCommand}' command failed with exit code: ${exitCode}`
|
? `The '${constants_1.cliCommand}' command failed with exit code: ${exitCode}`
|
||||||
: stderr);
|
: stderr);
|
||||||
}
|
}
|
||||||
const result = {
|
const result = {
|
||||||
'http-cache': '',
|
'http-cache': '',
|
||||||
'global-packages': '',
|
'global-packages': '',
|
||||||
temp: '',
|
temp: '',
|
||||||
'plugins-cache': ''
|
'plugins-cache': ''
|
||||||
};
|
};
|
||||||
const regex = /(?:^|\s)(?<key>[a-z-]+): (?<path>.+[/\\].+)$/gm;
|
const regex = /(?:^|\s)(?<key>[a-z-]+): (?<path>.+[/\\].+)$/gm;
|
||||||
let match;
|
let match;
|
||||||
while ((match = regex.exec(stdout)) !== null) {
|
while ((match = regex.exec(stdout)) !== null) {
|
||||||
const key = match.groups.key;
|
const key = match.groups.key;
|
||||||
if (key in result) {
|
if (key in result) {
|
||||||
result[key] = match.groups.path;
|
result[key] = match.groups.path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
exports.getNuGetFolderPath = getNuGetFolderPath;
|
exports.getNuGetFolderPath = getNuGetFolderPath;
|
||||||
function isCacheFeatureAvailable() {
|
function isCacheFeatureAvailable() {
|
||||||
if (cache.isFeatureAvailable()) {
|
if (cache.isFeatureAvailable()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isGhes()) {
|
if (isGhes()) {
|
||||||
core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
|
core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
exports.isCacheFeatureAvailable = isCacheFeatureAvailable;
|
||||||
/**
|
/**
|
||||||
* Returns this action runs on GitHub Enterprise Server or not.
|
* Returns this action runs on GitHub Enterprise Server or not.
|
||||||
* (port from https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/cache/src/internal/cacheUtils.ts#L134)
|
* (port from https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/cache/src/internal/cacheUtils.ts#L134)
|
||||||
*/
|
*/
|
||||||
function isGhes() {
|
function isGhes() {
|
||||||
const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com';
|
const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com';
|
||||||
return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM';
|
return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@ -58732,26 +58732,26 @@ function isGhes() {
|
|||||||
/***/ ((__unused_webpack_module, exports) => {
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0;
|
exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0;
|
||||||
/** NuGet lock file patterns */
|
/** NuGet lock file patterns */
|
||||||
exports.lockFilePatterns = ['packages.lock.json'];
|
exports.lockFilePatterns = ['packages.lock.json'];
|
||||||
/**
|
/**
|
||||||
* .NET CLI command to list local NuGet resources.
|
* .NET CLI command to list local NuGet resources.
|
||||||
* @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals
|
* @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals
|
||||||
*/
|
*/
|
||||||
exports.cliCommand = 'dotnet nuget locals all --list --force-english-output';
|
exports.cliCommand = 'dotnet nuget locals all --list --force-english-output';
|
||||||
var State;
|
var State;
|
||||||
(function (State) {
|
(function (State) {
|
||||||
State["CachePrimaryKey"] = "CACHE_KEY";
|
State["CachePrimaryKey"] = "CACHE_KEY";
|
||||||
State["CacheMatchedKey"] = "CACHE_RESULT";
|
State["CacheMatchedKey"] = "CACHE_RESULT";
|
||||||
})(State = exports.State || (exports.State = {}));
|
})(State = exports.State || (exports.State = {}));
|
||||||
var Outputs;
|
var Outputs;
|
||||||
(function (Outputs) {
|
(function (Outputs) {
|
||||||
Outputs["CacheHit"] = "cache-hit";
|
Outputs["CacheHit"] = "cache-hit";
|
||||||
Outputs["DotnetVersion"] = "dotnet-version";
|
Outputs["DotnetVersion"] = "dotnet-version";
|
||||||
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
})(Outputs = exports.Outputs || (exports.Outputs = {}));
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
94
dist/setup/index.js
vendored
94
dist/setup/index.js
vendored
@ -48116,39 +48116,11 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
|||||||
// Max safe segment length for coercion.
|
// Max safe segment length for coercion.
|
||||||
var MAX_SAFE_COMPONENT_LENGTH = 16
|
var MAX_SAFE_COMPONENT_LENGTH = 16
|
||||||
|
|
||||||
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
|
|
||||||
|
|
||||||
// The actual regexps go on exports.re
|
// The actual regexps go on exports.re
|
||||||
var re = exports.re = []
|
var re = exports.re = []
|
||||||
var safeRe = exports.safeRe = []
|
|
||||||
var src = exports.src = []
|
var src = exports.src = []
|
||||||
var R = 0
|
var R = 0
|
||||||
|
|
||||||
var LETTERDASHNUMBER = '[a-zA-Z0-9-]'
|
|
||||||
|
|
||||||
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
|
||||||
// used internally via the safeRe object since all inputs in this library get
|
|
||||||
// normalized first to trim and collapse all extra whitespace. The original
|
|
||||||
// regexes are exported for userland consumption and lower level usage. A
|
|
||||||
// future breaking change could export the safer regex only with a note that
|
|
||||||
// all input should have extra whitespace removed.
|
|
||||||
var safeRegexReplacements = [
|
|
||||||
['\\s', 1],
|
|
||||||
['\\d', MAX_LENGTH],
|
|
||||||
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
|
|
||||||
]
|
|
||||||
|
|
||||||
function makeSafeRe (value) {
|
|
||||||
for (var i = 0; i < safeRegexReplacements.length; i++) {
|
|
||||||
var token = safeRegexReplacements[i][0]
|
|
||||||
var max = safeRegexReplacements[i][1]
|
|
||||||
value = value
|
|
||||||
.split(token + '*').join(token + '{0,' + max + '}')
|
|
||||||
.split(token + '+').join(token + '{1,' + max + '}')
|
|
||||||
}
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
// The following Regular Expressions can be used for tokenizing,
|
// The following Regular Expressions can be used for tokenizing,
|
||||||
// validating, and parsing SemVer version strings.
|
// validating, and parsing SemVer version strings.
|
||||||
|
|
||||||
@ -48158,14 +48130,14 @@ function makeSafeRe (value) {
|
|||||||
var NUMERICIDENTIFIER = R++
|
var NUMERICIDENTIFIER = R++
|
||||||
src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
||||||
var NUMERICIDENTIFIERLOOSE = R++
|
var NUMERICIDENTIFIERLOOSE = R++
|
||||||
src[NUMERICIDENTIFIERLOOSE] = '\\d+'
|
src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'
|
||||||
|
|
||||||
// ## Non-numeric Identifier
|
// ## Non-numeric Identifier
|
||||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||||
// more letters, digits, or hyphens.
|
// more letters, digits, or hyphens.
|
||||||
|
|
||||||
var NONNUMERICIDENTIFIER = R++
|
var NONNUMERICIDENTIFIER = R++
|
||||||
src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*'
|
src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
|
||||||
|
|
||||||
// ## Main Version
|
// ## Main Version
|
||||||
// Three dot-separated numeric identifiers.
|
// Three dot-separated numeric identifiers.
|
||||||
@ -48207,7 +48179,7 @@ src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +
|
|||||||
// Any combination of digits, letters, or hyphens.
|
// Any combination of digits, letters, or hyphens.
|
||||||
|
|
||||||
var BUILDIDENTIFIER = R++
|
var BUILDIDENTIFIER = R++
|
||||||
src[BUILDIDENTIFIER] = LETTERDASHNUMBER + '+'
|
src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
|
||||||
|
|
||||||
// ## Build Metadata
|
// ## Build Metadata
|
||||||
// Plus sign, followed by one or more period-separated build metadata
|
// Plus sign, followed by one or more period-separated build metadata
|
||||||
@ -48292,7 +48264,6 @@ src[LONETILDE] = '(?:~>?)'
|
|||||||
var TILDETRIM = R++
|
var TILDETRIM = R++
|
||||||
src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'
|
src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'
|
||||||
re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g')
|
re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g')
|
||||||
safeRe[TILDETRIM] = new RegExp(makeSafeRe(src[TILDETRIM]), 'g')
|
|
||||||
var tildeTrimReplace = '$1~'
|
var tildeTrimReplace = '$1~'
|
||||||
|
|
||||||
var TILDE = R++
|
var TILDE = R++
|
||||||
@ -48308,7 +48279,6 @@ src[LONECARET] = '(?:\\^)'
|
|||||||
var CARETTRIM = R++
|
var CARETTRIM = R++
|
||||||
src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'
|
src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'
|
||||||
re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g')
|
re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g')
|
||||||
safeRe[CARETTRIM] = new RegExp(makeSafeRe(src[CARETTRIM]), 'g')
|
|
||||||
var caretTrimReplace = '$1^'
|
var caretTrimReplace = '$1^'
|
||||||
|
|
||||||
var CARET = R++
|
var CARET = R++
|
||||||
@ -48330,7 +48300,6 @@ src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] +
|
|||||||
|
|
||||||
// this one has to use the /g flag
|
// this one has to use the /g flag
|
||||||
re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g')
|
re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g')
|
||||||
safeRe[COMPARATORTRIM] = new RegExp(makeSafeRe(src[COMPARATORTRIM]), 'g')
|
|
||||||
var comparatorTrimReplace = '$1$2$3'
|
var comparatorTrimReplace = '$1$2$3'
|
||||||
|
|
||||||
// Something like `1.2.3 - 1.2.4`
|
// Something like `1.2.3 - 1.2.4`
|
||||||
@ -48359,14 +48328,6 @@ for (var i = 0; i < R; i++) {
|
|||||||
debug(i, src[i])
|
debug(i, src[i])
|
||||||
if (!re[i]) {
|
if (!re[i]) {
|
||||||
re[i] = new RegExp(src[i])
|
re[i] = new RegExp(src[i])
|
||||||
|
|
||||||
// Replace all greedy whitespace to prevent regex dos issues. These regex are
|
|
||||||
// used internally via the safeRe object since all inputs in this library get
|
|
||||||
// normalized first to trim and collapse all extra whitespace. The original
|
|
||||||
// regexes are exported for userland consumption and lower level usage. A
|
|
||||||
// future breaking change could export the safer regex only with a note that
|
|
||||||
// all input should have extra whitespace removed.
|
|
||||||
safeRe[i] = new RegExp(makeSafeRe(src[i]))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48391,7 +48352,7 @@ function parse (version, options) {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
var r = options.loose ? safeRe[LOOSE] : safeRe[FULL]
|
var r = options.loose ? re[LOOSE] : re[FULL]
|
||||||
if (!r.test(version)) {
|
if (!r.test(version)) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -48446,7 +48407,7 @@ function SemVer (version, options) {
|
|||||||
this.options = options
|
this.options = options
|
||||||
this.loose = !!options.loose
|
this.loose = !!options.loose
|
||||||
|
|
||||||
var m = version.trim().match(options.loose ? safeRe[LOOSE] : safeRe[FULL])
|
var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL])
|
||||||
|
|
||||||
if (!m) {
|
if (!m) {
|
||||||
throw new TypeError('Invalid Version: ' + version)
|
throw new TypeError('Invalid Version: ' + version)
|
||||||
@ -48860,7 +48821,6 @@ function Comparator (comp, options) {
|
|||||||
return new Comparator(comp, options)
|
return new Comparator(comp, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
comp = comp.trim().split(/\s+/).join(' ')
|
|
||||||
debug('comparator', comp, options)
|
debug('comparator', comp, options)
|
||||||
this.options = options
|
this.options = options
|
||||||
this.loose = !!options.loose
|
this.loose = !!options.loose
|
||||||
@ -48877,7 +48837,7 @@ function Comparator (comp, options) {
|
|||||||
|
|
||||||
var ANY = {}
|
var ANY = {}
|
||||||
Comparator.prototype.parse = function (comp) {
|
Comparator.prototype.parse = function (comp) {
|
||||||
var r = this.options.loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR]
|
var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
|
||||||
var m = comp.match(r)
|
var m = comp.match(r)
|
||||||
|
|
||||||
if (!m) {
|
if (!m) {
|
||||||
@ -48991,16 +48951,9 @@ function Range (range, options) {
|
|||||||
this.loose = !!options.loose
|
this.loose = !!options.loose
|
||||||
this.includePrerelease = !!options.includePrerelease
|
this.includePrerelease = !!options.includePrerelease
|
||||||
|
|
||||||
// First reduce all whitespace as much as possible so we do not have to rely
|
|
||||||
// on potentially slow regexes like \s*. This is then stored and used for
|
|
||||||
// future error messages as well.
|
|
||||||
this.raw = range
|
|
||||||
.trim()
|
|
||||||
.split(/\s+/)
|
|
||||||
.join(' ')
|
|
||||||
|
|
||||||
// First, split based on boolean or ||
|
// First, split based on boolean or ||
|
||||||
this.set = this.raw.split('||').map(function (range) {
|
this.raw = range
|
||||||
|
this.set = range.split(/\s*\|\|\s*/).map(function (range) {
|
||||||
return this.parseRange(range.trim())
|
return this.parseRange(range.trim())
|
||||||
}, this).filter(function (c) {
|
}, this).filter(function (c) {
|
||||||
// throw out any that are not relevant for whatever reason
|
// throw out any that are not relevant for whatever reason
|
||||||
@ -49008,7 +48961,7 @@ function Range (range, options) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (!this.set.length) {
|
if (!this.set.length) {
|
||||||
throw new TypeError('Invalid SemVer Range: ' + this.raw)
|
throw new TypeError('Invalid SemVer Range: ' + range)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.format()
|
this.format()
|
||||||
@ -49027,23 +48980,28 @@ Range.prototype.toString = function () {
|
|||||||
|
|
||||||
Range.prototype.parseRange = function (range) {
|
Range.prototype.parseRange = function (range) {
|
||||||
var loose = this.options.loose
|
var loose = this.options.loose
|
||||||
|
range = range.trim()
|
||||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||||
var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE]
|
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]
|
||||||
range = range.replace(hr, hyphenReplace)
|
range = range.replace(hr, hyphenReplace)
|
||||||
debug('hyphen replace', range)
|
debug('hyphen replace', range)
|
||||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||||
range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace)
|
range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace)
|
||||||
debug('comparator trim', range, safeRe[COMPARATORTRIM])
|
debug('comparator trim', range, re[COMPARATORTRIM])
|
||||||
|
|
||||||
// `~ 1.2.3` => `~1.2.3`
|
// `~ 1.2.3` => `~1.2.3`
|
||||||
range = range.replace(safeRe[TILDETRIM], tildeTrimReplace)
|
range = range.replace(re[TILDETRIM], tildeTrimReplace)
|
||||||
|
|
||||||
// `^ 1.2.3` => `^1.2.3`
|
// `^ 1.2.3` => `^1.2.3`
|
||||||
range = range.replace(safeRe[CARETTRIM], caretTrimReplace)
|
range = range.replace(re[CARETTRIM], caretTrimReplace)
|
||||||
|
|
||||||
|
// normalize spaces
|
||||||
|
range = range.split(/\s+/).join(' ')
|
||||||
|
|
||||||
// At this point, the range is completely trimmed and
|
// At this point, the range is completely trimmed and
|
||||||
// ready to be split into comparators.
|
// ready to be split into comparators.
|
||||||
var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR]
|
|
||||||
|
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]
|
||||||
var set = range.split(' ').map(function (comp) {
|
var set = range.split(' ').map(function (comp) {
|
||||||
return parseComparator(comp, this.options)
|
return parseComparator(comp, this.options)
|
||||||
}, this).join(' ').split(/\s+/)
|
}, this).join(' ').split(/\s+/)
|
||||||
@ -49119,7 +49077,7 @@ function replaceTildes (comp, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function replaceTilde (comp, options) {
|
function replaceTilde (comp, options) {
|
||||||
var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE]
|
var r = options.loose ? re[TILDELOOSE] : re[TILDE]
|
||||||
return comp.replace(r, function (_, M, m, p, pr) {
|
return comp.replace(r, function (_, M, m, p, pr) {
|
||||||
debug('tilde', comp, _, M, m, p, pr)
|
debug('tilde', comp, _, M, m, p, pr)
|
||||||
var ret
|
var ret
|
||||||
@ -49160,7 +49118,7 @@ function replaceCarets (comp, options) {
|
|||||||
|
|
||||||
function replaceCaret (comp, options) {
|
function replaceCaret (comp, options) {
|
||||||
debug('caret', comp, options)
|
debug('caret', comp, options)
|
||||||
var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET]
|
var r = options.loose ? re[CARETLOOSE] : re[CARET]
|
||||||
return comp.replace(r, function (_, M, m, p, pr) {
|
return comp.replace(r, function (_, M, m, p, pr) {
|
||||||
debug('caret', comp, _, M, m, p, pr)
|
debug('caret', comp, _, M, m, p, pr)
|
||||||
var ret
|
var ret
|
||||||
@ -49219,7 +49177,7 @@ function replaceXRanges (comp, options) {
|
|||||||
|
|
||||||
function replaceXRange (comp, options) {
|
function replaceXRange (comp, options) {
|
||||||
comp = comp.trim()
|
comp = comp.trim()
|
||||||
var r = options.loose ? safeRe[XRANGELOOSE] : safeRe[XRANGE]
|
var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]
|
||||||
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
||||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||||
var xM = isX(M)
|
var xM = isX(M)
|
||||||
@ -49289,10 +49247,10 @@ function replaceXRange (comp, options) {
|
|||||||
function replaceStars (comp, options) {
|
function replaceStars (comp, options) {
|
||||||
debug('replaceStars', comp, options)
|
debug('replaceStars', comp, options)
|
||||||
// Looseness is ignored here. star is always as loose as it gets!
|
// Looseness is ignored here. star is always as loose as it gets!
|
||||||
return comp.trim().replace(safeRe[STAR], '')
|
return comp.trim().replace(re[STAR], '')
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is passed to string.replace(safeRe[HYPHENRANGE])
|
// This function is passed to string.replace(re[HYPHENRANGE])
|
||||||
// M, m, patch, prerelease, build
|
// M, m, patch, prerelease, build
|
||||||
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
||||||
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
|
||||||
@ -49603,7 +49561,7 @@ function coerce (version) {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
var match = version.match(safeRe[COERCE])
|
var match = version.match(re[COERCE])
|
||||||
|
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
return null
|
return null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user