`npm ci` and `npm run release`

This commit is contained in:
Josh Gross 2024-08-15 20:34:01 -04:00
parent 3412bb46a4
commit fa37431cef
No known key found for this signature in database
2 changed files with 96 additions and 186 deletions

141
dist/merge/index.js vendored
View File

@ -8881,18 +8881,16 @@ exports.create = create;
* Computes the sha256 hash of a glob * Computes the sha256 hash of a glob
* *
* @param patterns Patterns separated by newlines * @param patterns Patterns separated by newlines
* @param currentWorkspace Workspace used when matching files
* @param options Glob options * @param options Glob options
* @param verbose Enables verbose logging
*/ */
function hashFiles(patterns, currentWorkspace = '', options, verbose = false) { function hashFiles(patterns, options, verbose = false) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let followSymbolicLinks = true; let followSymbolicLinks = true;
if (options && typeof options.followSymbolicLinks === 'boolean') { if (options && typeof options.followSymbolicLinks === 'boolean') {
followSymbolicLinks = options.followSymbolicLinks; followSymbolicLinks = options.followSymbolicLinks;
} }
const globber = yield create(patterns, { followSymbolicLinks }); const globber = yield create(patterns, { followSymbolicLinks });
return (0, internal_hash_files_1.hashFiles)(globber, currentWorkspace, verbose); return internal_hash_files_1.hashFiles(globber, verbose);
}); });
} }
exports.hashFiles = hashFiles; exports.hashFiles = hashFiles;
@ -8907,11 +8905,7 @@ exports.hashFiles = hashFiles;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -8924,7 +8918,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -8939,8 +8933,7 @@ function getOptions(copy) {
followSymbolicLinks: true, followSymbolicLinks: true,
implicitDescendants: true, implicitDescendants: true,
matchDirectories: true, matchDirectories: true,
omitBrokenSymbolicLinks: true, omitBrokenSymbolicLinks: true
excludeHiddenFiles: false
}; };
if (copy) { if (copy) {
if (typeof copy.followSymbolicLinks === 'boolean') { if (typeof copy.followSymbolicLinks === 'boolean') {
@ -8959,10 +8952,6 @@ function getOptions(copy) {
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks; result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`); core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
} }
if (typeof copy.excludeHiddenFiles === 'boolean') {
result.excludeHiddenFiles = copy.excludeHiddenFiles;
core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`);
}
} }
return result; return result;
} }
@ -8978,11 +8967,7 @@ exports.getOptions = getOptions;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -8995,7 +8980,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9049,21 +9034,19 @@ class DefaultGlobber {
return this.searchPaths.slice(); return this.searchPaths.slice();
} }
glob() { glob() {
var _a, e_1, _b, _c; var e_1, _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const result = []; const result = [];
try { try {
for (var _d = true, _e = __asyncValues(this.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) { for (var _b = __asyncValues(this.globGenerator()), _c; _c = yield _b.next(), !_c.done;) {
_c = _f.value; const itemPath = _c.value;
_d = false;
const itemPath = _c;
result.push(itemPath); result.push(itemPath);
} }
} }
catch (e_1_1) { e_1 = { error: e_1_1 }; } catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally { finally {
try { try {
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e); if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }
@ -9121,10 +9104,6 @@ class DefaultGlobber {
if (!stats) { if (!stats) {
continue; continue;
} }
// Hidden file or directory?
if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) {
continue;
}
// Directory // Directory
if (stats.isDirectory()) { if (stats.isDirectory()) {
// Matched // Matched
@ -9230,11 +9209,7 @@ exports.DefaultGlobber = DefaultGlobber;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9247,7 +9222,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9275,22 +9250,18 @@ const fs = __importStar(__nccwpck_require__(57147));
const stream = __importStar(__nccwpck_require__(12781)); const stream = __importStar(__nccwpck_require__(12781));
const util = __importStar(__nccwpck_require__(73837)); const util = __importStar(__nccwpck_require__(73837));
const path = __importStar(__nccwpck_require__(71017)); const path = __importStar(__nccwpck_require__(71017));
function hashFiles(globber, currentWorkspace, verbose = false) { function hashFiles(globber, verbose = false) {
var _a, e_1, _b, _c; var e_1, _a;
var _d; var _b;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const writeDelegate = verbose ? core.info : core.debug; const writeDelegate = verbose ? core.info : core.debug;
let hasMatch = false; let hasMatch = false;
const githubWorkspace = currentWorkspace const githubWorkspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd();
? currentWorkspace
: (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd();
const result = crypto.createHash('sha256'); const result = crypto.createHash('sha256');
let count = 0; let count = 0;
try { try {
for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) { for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
_c = _g.value; const file = _d.value;
_e = false;
const file = _c;
writeDelegate(file); writeDelegate(file);
if (!file.startsWith(`${githubWorkspace}${path.sep}`)) { if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
@ -9313,7 +9284,7 @@ function hashFiles(globber, currentWorkspace, verbose = false) {
catch (e_1_1) { e_1 = { error: e_1_1 }; } catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally { finally {
try { try {
if (!_e && !_a && (_b = _f.return)) yield _b.call(_f); if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }
@ -9353,7 +9324,7 @@ var MatchKind;
MatchKind[MatchKind["File"] = 2] = "File"; MatchKind[MatchKind["File"] = 2] = "File";
/** Matched */ /** Matched */
MatchKind[MatchKind["All"] = 3] = "All"; MatchKind[MatchKind["All"] = 3] = "All";
})(MatchKind || (exports.MatchKind = MatchKind = {})); })(MatchKind = exports.MatchKind || (exports.MatchKind = {}));
//# sourceMappingURL=internal-match-kind.js.map //# sourceMappingURL=internal-match-kind.js.map
/***/ }), /***/ }),
@ -9365,11 +9336,7 @@ var MatchKind;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9382,7 +9349,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9432,8 +9399,8 @@ exports.dirname = dirname;
* or `C:` are expanded based on the current working directory. * or `C:` are expanded based on the current working directory.
*/ */
function ensureAbsoluteRoot(root, itemPath) { function ensureAbsoluteRoot(root, itemPath) {
(0, assert_1.default)(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
(0, assert_1.default)(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
// Already rooted // Already rooted
if (hasAbsoluteRoot(itemPath)) { if (hasAbsoluteRoot(itemPath)) {
return itemPath; return itemPath;
@ -9443,7 +9410,7 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like C: or C:foo // Check for itemPath like C: or C:foo
if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) { if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
let cwd = process.cwd(); let cwd = process.cwd();
(0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
// Drive letter matches cwd? Expand to cwd // Drive letter matches cwd? Expand to cwd
if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) { if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
// Drive only, e.g. C: // Drive only, e.g. C:
@ -9468,11 +9435,11 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like \ or \foo // Check for itemPath like \ or \foo
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) { else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
const cwd = process.cwd(); const cwd = process.cwd();
(0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
return `${cwd[0]}:\\${itemPath.substr(1)}`; return `${cwd[0]}:\\${itemPath.substr(1)}`;
} }
} }
(0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
// Otherwise ensure root ends with a separator // Otherwise ensure root ends with a separator
if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) { if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) {
// Intentionally empty // Intentionally empty
@ -9489,7 +9456,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
* `\\hello\share` and `C:\hello` (and using alternate separator). * `\\hello\share` and `C:\hello` (and using alternate separator).
*/ */
function hasAbsoluteRoot(itemPath) { function hasAbsoluteRoot(itemPath) {
(0, assert_1.default)(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
// Normalize separators // Normalize separators
itemPath = normalizeSeparators(itemPath); itemPath = normalizeSeparators(itemPath);
// Windows // Windows
@ -9506,7 +9473,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot;
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator). * `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
*/ */
function hasRoot(itemPath) { function hasRoot(itemPath) {
(0, assert_1.default)(itemPath, `isRooted parameter 'itemPath' must not be empty`); assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`);
// Normalize separators // Normalize separators
itemPath = normalizeSeparators(itemPath); itemPath = normalizeSeparators(itemPath);
// Windows // Windows
@ -9574,11 +9541,7 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9591,7 +9554,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9616,7 +9579,7 @@ class Path {
this.segments = []; this.segments = [];
// String // String
if (typeof itemPath === 'string') { if (typeof itemPath === 'string') {
(0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`); assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`);
// Normalize slashes and trim unnecessary trailing slash // Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
// Not rooted // Not rooted
@ -9643,24 +9606,24 @@ class Path {
// Array // Array
else { else {
// Must not be empty // Must not be empty
(0, assert_1.default)(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
// Each segment // Each segment
for (let i = 0; i < itemPath.length; i++) { for (let i = 0; i < itemPath.length; i++) {
let segment = itemPath[i]; let segment = itemPath[i];
// Must not be empty // Must not be empty
(0, assert_1.default)(segment, `Parameter 'itemPath' must not contain any empty segments`); assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`);
// Normalize slashes // Normalize slashes
segment = pathHelper.normalizeSeparators(itemPath[i]); segment = pathHelper.normalizeSeparators(itemPath[i]);
// Root segment // Root segment
if (i === 0 && pathHelper.hasRoot(segment)) { if (i === 0 && pathHelper.hasRoot(segment)) {
segment = pathHelper.safeTrimTrailingSeparator(segment); segment = pathHelper.safeTrimTrailingSeparator(segment);
(0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
this.segments.push(segment); this.segments.push(segment);
} }
// All other segments // All other segments
else { else {
// Must not contain slash // Must not contain slash
(0, assert_1.default)(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
this.segments.push(segment); this.segments.push(segment);
} }
} }
@ -9698,11 +9661,7 @@ exports.Path = Path;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9715,7 +9674,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9803,11 +9762,7 @@ exports.partialMatch = partialMatch;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9820,7 +9775,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9852,9 +9807,9 @@ class Pattern {
else { else {
// Convert to pattern // Convert to pattern
segments = segments || []; segments = segments || [];
(0, assert_1.default)(segments.length, `Parameter 'segments' must not empty`); assert_1.default(segments.length, `Parameter 'segments' must not empty`);
const root = Pattern.getLiteral(segments[0]); const root = Pattern.getLiteral(segments[0]);
(0, assert_1.default)(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
pattern = new internal_path_1.Path(segments).toString().trim(); pattern = new internal_path_1.Path(segments).toString().trim();
if (patternOrNegate) { if (patternOrNegate) {
pattern = `!${pattern}`; pattern = `!${pattern}`;
@ -9948,13 +9903,13 @@ class Pattern {
*/ */
static fixupPattern(pattern, homedir) { static fixupPattern(pattern, homedir) {
// Empty // Empty
(0, assert_1.default)(pattern, 'pattern cannot be empty'); assert_1.default(pattern, 'pattern cannot be empty');
// Must not contain `.` segment, unless first segment // Must not contain `.` segment, unless first segment
// Must not contain `..` segment // Must not contain `..` segment
const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x)); const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x));
(0, assert_1.default)(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r // Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
(0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
// Normalize slashes // Normalize slashes
pattern = pathHelper.normalizeSeparators(pattern); pattern = pathHelper.normalizeSeparators(pattern);
// Replace leading `.` segment // Replace leading `.` segment
@ -9964,8 +9919,8 @@ class Pattern {
// Replace leading `~` segment // Replace leading `~` segment
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) { else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
homedir = homedir || os.homedir(); homedir = homedir || os.homedir();
(0, assert_1.default)(homedir, 'Unable to determine HOME directory'); assert_1.default(homedir, 'Unable to determine HOME directory');
(0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
pattern = Pattern.globEscape(homedir) + pattern.substr(1); pattern = Pattern.globEscape(homedir) + pattern.substr(1);
} }
// Replace relative drive root, e.g. pattern is C: or C:foo // Replace relative drive root, e.g. pattern is C: or C:foo

141
dist/upload/index.js vendored
View File

@ -8881,18 +8881,16 @@ exports.create = create;
* Computes the sha256 hash of a glob * Computes the sha256 hash of a glob
* *
* @param patterns Patterns separated by newlines * @param patterns Patterns separated by newlines
* @param currentWorkspace Workspace used when matching files
* @param options Glob options * @param options Glob options
* @param verbose Enables verbose logging
*/ */
function hashFiles(patterns, currentWorkspace = '', options, verbose = false) { function hashFiles(patterns, options, verbose = false) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let followSymbolicLinks = true; let followSymbolicLinks = true;
if (options && typeof options.followSymbolicLinks === 'boolean') { if (options && typeof options.followSymbolicLinks === 'boolean') {
followSymbolicLinks = options.followSymbolicLinks; followSymbolicLinks = options.followSymbolicLinks;
} }
const globber = yield create(patterns, { followSymbolicLinks }); const globber = yield create(patterns, { followSymbolicLinks });
return (0, internal_hash_files_1.hashFiles)(globber, currentWorkspace, verbose); return internal_hash_files_1.hashFiles(globber, verbose);
}); });
} }
exports.hashFiles = hashFiles; exports.hashFiles = hashFiles;
@ -8907,11 +8905,7 @@ exports.hashFiles = hashFiles;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -8924,7 +8918,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -8939,8 +8933,7 @@ function getOptions(copy) {
followSymbolicLinks: true, followSymbolicLinks: true,
implicitDescendants: true, implicitDescendants: true,
matchDirectories: true, matchDirectories: true,
omitBrokenSymbolicLinks: true, omitBrokenSymbolicLinks: true
excludeHiddenFiles: false
}; };
if (copy) { if (copy) {
if (typeof copy.followSymbolicLinks === 'boolean') { if (typeof copy.followSymbolicLinks === 'boolean') {
@ -8959,10 +8952,6 @@ function getOptions(copy) {
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks; result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`); core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
} }
if (typeof copy.excludeHiddenFiles === 'boolean') {
result.excludeHiddenFiles = copy.excludeHiddenFiles;
core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`);
}
} }
return result; return result;
} }
@ -8978,11 +8967,7 @@ exports.getOptions = getOptions;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -8995,7 +8980,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9049,21 +9034,19 @@ class DefaultGlobber {
return this.searchPaths.slice(); return this.searchPaths.slice();
} }
glob() { glob() {
var _a, e_1, _b, _c; var e_1, _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const result = []; const result = [];
try { try {
for (var _d = true, _e = __asyncValues(this.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) { for (var _b = __asyncValues(this.globGenerator()), _c; _c = yield _b.next(), !_c.done;) {
_c = _f.value; const itemPath = _c.value;
_d = false;
const itemPath = _c;
result.push(itemPath); result.push(itemPath);
} }
} }
catch (e_1_1) { e_1 = { error: e_1_1 }; } catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally { finally {
try { try {
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e); if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }
@ -9121,10 +9104,6 @@ class DefaultGlobber {
if (!stats) { if (!stats) {
continue; continue;
} }
// Hidden file or directory?
if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) {
continue;
}
// Directory // Directory
if (stats.isDirectory()) { if (stats.isDirectory()) {
// Matched // Matched
@ -9230,11 +9209,7 @@ exports.DefaultGlobber = DefaultGlobber;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9247,7 +9222,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9275,22 +9250,18 @@ const fs = __importStar(__nccwpck_require__(57147));
const stream = __importStar(__nccwpck_require__(12781)); const stream = __importStar(__nccwpck_require__(12781));
const util = __importStar(__nccwpck_require__(73837)); const util = __importStar(__nccwpck_require__(73837));
const path = __importStar(__nccwpck_require__(71017)); const path = __importStar(__nccwpck_require__(71017));
function hashFiles(globber, currentWorkspace, verbose = false) { function hashFiles(globber, verbose = false) {
var _a, e_1, _b, _c; var e_1, _a;
var _d; var _b;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const writeDelegate = verbose ? core.info : core.debug; const writeDelegate = verbose ? core.info : core.debug;
let hasMatch = false; let hasMatch = false;
const githubWorkspace = currentWorkspace const githubWorkspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd();
? currentWorkspace
: (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd();
const result = crypto.createHash('sha256'); const result = crypto.createHash('sha256');
let count = 0; let count = 0;
try { try {
for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) { for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
_c = _g.value; const file = _d.value;
_e = false;
const file = _c;
writeDelegate(file); writeDelegate(file);
if (!file.startsWith(`${githubWorkspace}${path.sep}`)) { if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
@ -9313,7 +9284,7 @@ function hashFiles(globber, currentWorkspace, verbose = false) {
catch (e_1_1) { e_1 = { error: e_1_1 }; } catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally { finally {
try { try {
if (!_e && !_a && (_b = _f.return)) yield _b.call(_f); if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
} }
finally { if (e_1) throw e_1.error; } finally { if (e_1) throw e_1.error; }
} }
@ -9353,7 +9324,7 @@ var MatchKind;
MatchKind[MatchKind["File"] = 2] = "File"; MatchKind[MatchKind["File"] = 2] = "File";
/** Matched */ /** Matched */
MatchKind[MatchKind["All"] = 3] = "All"; MatchKind[MatchKind["All"] = 3] = "All";
})(MatchKind || (exports.MatchKind = MatchKind = {})); })(MatchKind = exports.MatchKind || (exports.MatchKind = {}));
//# sourceMappingURL=internal-match-kind.js.map //# sourceMappingURL=internal-match-kind.js.map
/***/ }), /***/ }),
@ -9365,11 +9336,7 @@ var MatchKind;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9382,7 +9349,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9432,8 +9399,8 @@ exports.dirname = dirname;
* or `C:` are expanded based on the current working directory. * or `C:` are expanded based on the current working directory.
*/ */
function ensureAbsoluteRoot(root, itemPath) { function ensureAbsoluteRoot(root, itemPath) {
(0, assert_1.default)(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
(0, assert_1.default)(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
// Already rooted // Already rooted
if (hasAbsoluteRoot(itemPath)) { if (hasAbsoluteRoot(itemPath)) {
return itemPath; return itemPath;
@ -9443,7 +9410,7 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like C: or C:foo // Check for itemPath like C: or C:foo
if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) { if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
let cwd = process.cwd(); let cwd = process.cwd();
(0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
// Drive letter matches cwd? Expand to cwd // Drive letter matches cwd? Expand to cwd
if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) { if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
// Drive only, e.g. C: // Drive only, e.g. C:
@ -9468,11 +9435,11 @@ function ensureAbsoluteRoot(root, itemPath) {
// Check for itemPath like \ or \foo // Check for itemPath like \ or \foo
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) { else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
const cwd = process.cwd(); const cwd = process.cwd();
(0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`); assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
return `${cwd[0]}:\\${itemPath.substr(1)}`; return `${cwd[0]}:\\${itemPath.substr(1)}`;
} }
} }
(0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`); assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
// Otherwise ensure root ends with a separator // Otherwise ensure root ends with a separator
if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) { if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) {
// Intentionally empty // Intentionally empty
@ -9489,7 +9456,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
* `\\hello\share` and `C:\hello` (and using alternate separator). * `\\hello\share` and `C:\hello` (and using alternate separator).
*/ */
function hasAbsoluteRoot(itemPath) { function hasAbsoluteRoot(itemPath) {
(0, assert_1.default)(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
// Normalize separators // Normalize separators
itemPath = normalizeSeparators(itemPath); itemPath = normalizeSeparators(itemPath);
// Windows // Windows
@ -9506,7 +9473,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot;
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator). * `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
*/ */
function hasRoot(itemPath) { function hasRoot(itemPath) {
(0, assert_1.default)(itemPath, `isRooted parameter 'itemPath' must not be empty`); assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`);
// Normalize separators // Normalize separators
itemPath = normalizeSeparators(itemPath); itemPath = normalizeSeparators(itemPath);
// Windows // Windows
@ -9574,11 +9541,7 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9591,7 +9554,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9616,7 +9579,7 @@ class Path {
this.segments = []; this.segments = [];
// String // String
if (typeof itemPath === 'string') { if (typeof itemPath === 'string') {
(0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`); assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`);
// Normalize slashes and trim unnecessary trailing slash // Normalize slashes and trim unnecessary trailing slash
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
// Not rooted // Not rooted
@ -9643,24 +9606,24 @@ class Path {
// Array // Array
else { else {
// Must not be empty // Must not be empty
(0, assert_1.default)(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`); assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
// Each segment // Each segment
for (let i = 0; i < itemPath.length; i++) { for (let i = 0; i < itemPath.length; i++) {
let segment = itemPath[i]; let segment = itemPath[i];
// Must not be empty // Must not be empty
(0, assert_1.default)(segment, `Parameter 'itemPath' must not contain any empty segments`); assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`);
// Normalize slashes // Normalize slashes
segment = pathHelper.normalizeSeparators(itemPath[i]); segment = pathHelper.normalizeSeparators(itemPath[i]);
// Root segment // Root segment
if (i === 0 && pathHelper.hasRoot(segment)) { if (i === 0 && pathHelper.hasRoot(segment)) {
segment = pathHelper.safeTrimTrailingSeparator(segment); segment = pathHelper.safeTrimTrailingSeparator(segment);
(0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`); assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
this.segments.push(segment); this.segments.push(segment);
} }
// All other segments // All other segments
else { else {
// Must not contain slash // Must not contain slash
(0, assert_1.default)(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`); assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
this.segments.push(segment); this.segments.push(segment);
} }
} }
@ -9698,11 +9661,7 @@ exports.Path = Path;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9715,7 +9674,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9803,11 +9762,7 @@ exports.partialMatch = partialMatch;
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); Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
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];
@ -9820,7 +9775,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
@ -9852,9 +9807,9 @@ class Pattern {
else { else {
// Convert to pattern // Convert to pattern
segments = segments || []; segments = segments || [];
(0, assert_1.default)(segments.length, `Parameter 'segments' must not empty`); assert_1.default(segments.length, `Parameter 'segments' must not empty`);
const root = Pattern.getLiteral(segments[0]); const root = Pattern.getLiteral(segments[0]);
(0, assert_1.default)(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`); assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
pattern = new internal_path_1.Path(segments).toString().trim(); pattern = new internal_path_1.Path(segments).toString().trim();
if (patternOrNegate) { if (patternOrNegate) {
pattern = `!${pattern}`; pattern = `!${pattern}`;
@ -9948,13 +9903,13 @@ class Pattern {
*/ */
static fixupPattern(pattern, homedir) { static fixupPattern(pattern, homedir) {
// Empty // Empty
(0, assert_1.default)(pattern, 'pattern cannot be empty'); assert_1.default(pattern, 'pattern cannot be empty');
// Must not contain `.` segment, unless first segment // Must not contain `.` segment, unless first segment
// Must not contain `..` segment // Must not contain `..` segment
const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x)); const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x));
(0, assert_1.default)(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`); assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r // Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
(0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`); assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
// Normalize slashes // Normalize slashes
pattern = pathHelper.normalizeSeparators(pattern); pattern = pathHelper.normalizeSeparators(pattern);
// Replace leading `.` segment // Replace leading `.` segment
@ -9964,8 +9919,8 @@ class Pattern {
// Replace leading `~` segment // Replace leading `~` segment
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) { else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
homedir = homedir || os.homedir(); homedir = homedir || os.homedir();
(0, assert_1.default)(homedir, 'Unable to determine HOME directory'); assert_1.default(homedir, 'Unable to determine HOME directory');
(0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
pattern = Pattern.globEscape(homedir) + pattern.substr(1); pattern = Pattern.globEscape(homedir) + pattern.substr(1);
} }
// Replace relative drive root, e.g. pattern is C: or C:foo // Replace relative drive root, e.g. pattern is C: or C:foo