mirror of
				https://github.com/actions/upload-artifact.git
				synced 2025-10-23 08:56:38 +08:00 
			
		
		
		
	Bump Actions NPM dependencies (#374)
This commit is contained in:
		
							
								
								
									
										353
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										353
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -515,6 +515,7 @@ exports.default = _default; | ||||
| "use strict"; | ||||
|  | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.MatchKind = void 0; | ||||
| /** | ||||
|  * Indicates whether a pattern matches a path | ||||
|  */ | ||||
| @@ -4213,7 +4214,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge | ||||
|     }); | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.hashFiles = exports.create = void 0; | ||||
| const internal_globber_1 = __webpack_require__(297); | ||||
| const internal_hash_files_1 = __webpack_require__(730); | ||||
| /** | ||||
|  * Constructs a globber | ||||
|  * | ||||
| @@ -4226,6 +4229,23 @@ function create(patterns, options) { | ||||
|     }); | ||||
| } | ||||
| exports.create = create; | ||||
| /** | ||||
|  * Computes the sha256 hash of a glob | ||||
|  * | ||||
|  * @param patterns  Patterns separated by newlines | ||||
|  * @param options   Glob options | ||||
|  */ | ||||
| function hashFiles(patterns, options, verbose = false) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         let followSymbolicLinks = true; | ||||
|         if (options && typeof options.followSymbolicLinks === 'boolean') { | ||||
|             followSymbolicLinks = options.followSymbolicLinks; | ||||
|         } | ||||
|         const globber = yield create(patterns, { followSymbolicLinks }); | ||||
|         return internal_hash_files_1.hashFiles(globber, verbose); | ||||
|     }); | ||||
| } | ||||
| exports.hashFiles = hashFiles; | ||||
| //# sourceMappingURL=glob.js.map | ||||
|  | ||||
| /***/ }), | ||||
| @@ -4235,6 +4255,25 @@ exports.create = create; | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||
|     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||||
|     return new (P || (P = Promise))(function (resolve, reject) { | ||||
| @@ -4264,11 +4303,12 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar | ||||
|     function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const core = __webpack_require__(470); | ||||
| const fs = __webpack_require__(747); | ||||
| const globOptionsHelper = __webpack_require__(601); | ||||
| const path = __webpack_require__(622); | ||||
| const patternHelper = __webpack_require__(597); | ||||
| exports.DefaultGlobber = void 0; | ||||
| const core = __importStar(__webpack_require__(470)); | ||||
| const fs = __importStar(__webpack_require__(747)); | ||||
| const globOptionsHelper = __importStar(__webpack_require__(601)); | ||||
| const path = __importStar(__webpack_require__(622)); | ||||
| const patternHelper = __importStar(__webpack_require__(597)); | ||||
| const internal_match_kind_1 = __webpack_require__(36); | ||||
| const internal_pattern_1 = __webpack_require__(923); | ||||
| const internal_search_state_1 = __webpack_require__(728); | ||||
| @@ -4314,7 +4354,7 @@ class DefaultGlobber { | ||||
|                 if (options.implicitDescendants && | ||||
|                     (pattern.trailingSeparator || | ||||
|                         pattern.segments[pattern.segments.length - 1] !== '**')) { | ||||
|                     patterns.push(new internal_pattern_1.Pattern(pattern.negate, pattern.segments.concat('**'))); | ||||
|                     patterns.push(new internal_pattern_1.Pattern(pattern.negate, true, pattern.segments.concat('**'))); | ||||
|                 } | ||||
|             } | ||||
|             // Push the search paths | ||||
| @@ -4357,7 +4397,7 @@ class DefaultGlobber { | ||||
|                 // Directory | ||||
|                 if (stats.isDirectory()) { | ||||
|                     // Matched | ||||
|                     if (match & internal_match_kind_1.MatchKind.Directory) { | ||||
|                     if (match & internal_match_kind_1.MatchKind.Directory && options.matchDirectories) { | ||||
|                         yield yield __await(item.path); | ||||
|                     } | ||||
|                     // Descend? | ||||
| @@ -4979,10 +5019,33 @@ exports.DefaultArtifactClient = DefaultArtifactClient; | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||||
|     return (mod && mod.__esModule) ? mod : { "default": mod }; | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const assert = __webpack_require__(357); | ||||
| const path = __webpack_require__(622); | ||||
| const pathHelper = __webpack_require__(972); | ||||
| exports.Path = void 0; | ||||
| const path = __importStar(__webpack_require__(622)); | ||||
| const pathHelper = __importStar(__webpack_require__(972)); | ||||
| const assert_1 = __importDefault(__webpack_require__(357)); | ||||
| const IS_WINDOWS = process.platform === 'win32'; | ||||
| /** | ||||
|  * Helper class for parsing paths into segments | ||||
| @@ -4996,7 +5059,7 @@ class Path { | ||||
|         this.segments = []; | ||||
|         // String | ||||
|         if (typeof itemPath === 'string') { | ||||
|             assert(itemPath, `Parameter 'itemPath' must not be empty`); | ||||
|             assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`); | ||||
|             // Normalize slashes and trim unnecessary trailing slash | ||||
|             itemPath = pathHelper.safeTrimTrailingSeparator(itemPath); | ||||
|             // Not rooted | ||||
| @@ -5023,24 +5086,24 @@ class Path { | ||||
|         // Array | ||||
|         else { | ||||
|             // Must not be empty | ||||
|             assert(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 | ||||
|             for (let i = 0; i < itemPath.length; i++) { | ||||
|                 let segment = itemPath[i]; | ||||
|                 // Must not be empty | ||||
|                 assert(segment, `Parameter 'itemPath' must not contain any empty segments`); | ||||
|                 assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`); | ||||
|                 // Normalize slashes | ||||
|                 segment = pathHelper.normalizeSeparators(itemPath[i]); | ||||
|                 // Root segment | ||||
|                 if (i === 0 && pathHelper.hasRoot(segment)) { | ||||
|                     segment = pathHelper.safeTrimTrailingSeparator(segment); | ||||
|                     assert(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); | ||||
|                 } | ||||
|                 // All other segments | ||||
|                 else { | ||||
|                     // Must not contain slash | ||||
|                     assert(!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); | ||||
|                 } | ||||
|             } | ||||
| @@ -7963,8 +8026,28 @@ exports.getUploadSpecification = getUploadSpecification; | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const pathHelper = __webpack_require__(972); | ||||
| exports.partialMatch = exports.match = exports.getSearchPaths = void 0; | ||||
| const pathHelper = __importStar(__webpack_require__(972)); | ||||
| const internal_match_kind_1 = __webpack_require__(36); | ||||
| const IS_WINDOWS = process.platform === 'win32'; | ||||
| /** | ||||
| @@ -8044,8 +8127,28 @@ exports.partialMatch = partialMatch; | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const core = __webpack_require__(470); | ||||
| exports.getOptions = void 0; | ||||
| const core = __importStar(__webpack_require__(470)); | ||||
| /** | ||||
|  * Returns a copy with defaults filled in. | ||||
|  */ | ||||
| @@ -8053,6 +8156,7 @@ function getOptions(copy) { | ||||
|     const result = { | ||||
|         followSymbolicLinks: true, | ||||
|         implicitDescendants: true, | ||||
|         matchDirectories: true, | ||||
|         omitBrokenSymbolicLinks: true | ||||
|     }; | ||||
|     if (copy) { | ||||
| @@ -8064,6 +8168,10 @@ function getOptions(copy) { | ||||
|             result.implicitDescendants = copy.implicitDescendants; | ||||
|             core.debug(`implicitDescendants '${result.implicitDescendants}'`); | ||||
|         } | ||||
|         if (typeof copy.matchDirectories === 'boolean') { | ||||
|             result.matchDirectories = copy.matchDirectories; | ||||
|             core.debug(`matchDirectories '${result.matchDirectories}'`); | ||||
|         } | ||||
|         if (typeof copy.omitBrokenSymbolicLinks === 'boolean') { | ||||
|             result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks; | ||||
|             core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`); | ||||
| @@ -9190,6 +9298,7 @@ exports.default = _default; | ||||
| "use strict"; | ||||
|  | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.SearchState = void 0; | ||||
| class SearchState { | ||||
|     constructor(path, level) { | ||||
|         this.path = path; | ||||
| @@ -9201,6 +9310,108 @@ exports.SearchState = SearchState; | ||||
|  | ||||
| /***/ }), | ||||
|  | ||||
| /***/ 730: | ||||
| /***/ (function(__unusedmodule, exports, __webpack_require__) { | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||
|     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||||
|     return new (P || (P = Promise))(function (resolve, reject) { | ||||
|         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 step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||
|     }); | ||||
| }; | ||||
| var __asyncValues = (this && this.__asyncValues) || function (o) { | ||||
|     if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); | ||||
|     var m = o[Symbol.asyncIterator], i; | ||||
|     return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); | ||||
|     function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } | ||||
|     function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.hashFiles = void 0; | ||||
| const crypto = __importStar(__webpack_require__(417)); | ||||
| const core = __importStar(__webpack_require__(470)); | ||||
| const fs = __importStar(__webpack_require__(747)); | ||||
| const stream = __importStar(__webpack_require__(794)); | ||||
| const util = __importStar(__webpack_require__(669)); | ||||
| const path = __importStar(__webpack_require__(622)); | ||||
| function hashFiles(globber, verbose = false) { | ||||
|     var e_1, _a; | ||||
|     var _b; | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         const writeDelegate = verbose ? core.info : core.debug; | ||||
|         let hasMatch = false; | ||||
|         const githubWorkspace = (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd(); | ||||
|         const result = crypto.createHash('sha256'); | ||||
|         let count = 0; | ||||
|         try { | ||||
|             for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) { | ||||
|                 const file = _d.value; | ||||
|                 writeDelegate(file); | ||||
|                 if (!file.startsWith(`${githubWorkspace}${path.sep}`)) { | ||||
|                     writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`); | ||||
|                     continue; | ||||
|                 } | ||||
|                 if (fs.statSync(file).isDirectory()) { | ||||
|                     writeDelegate(`Skip directory '${file}'.`); | ||||
|                     continue; | ||||
|                 } | ||||
|                 const hash = crypto.createHash('sha256'); | ||||
|                 const pipeline = util.promisify(stream.pipeline); | ||||
|                 yield pipeline(fs.createReadStream(file), hash); | ||||
|                 result.write(hash.digest()); | ||||
|                 count++; | ||||
|                 if (!hasMatch) { | ||||
|                     hasMatch = true; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||||
|         finally { | ||||
|             try { | ||||
|                 if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c); | ||||
|             } | ||||
|             finally { if (e_1) throw e_1.error; } | ||||
|         } | ||||
|         result.end(); | ||||
|         if (hasMatch) { | ||||
|             writeDelegate(`Found ${count} files to hash.`); | ||||
|             return result.digest('hex'); | ||||
|         } | ||||
|         else { | ||||
|             writeDelegate(`No matches found for glob`); | ||||
|             return ''; | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| exports.hashFiles = hashFiles; | ||||
| //# sourceMappingURL=internal-hash-files.js.map | ||||
|  | ||||
| /***/ }), | ||||
|  | ||||
| /***/ 733: | ||||
| /***/ (function(__unusedmodule, exports, __webpack_require__) { | ||||
|  | ||||
| @@ -9596,6 +9807,13 @@ class DownloadHttpClient { | ||||
|             }; | ||||
|             const resetDestinationStream = (fileDownloadPath) => __awaiter(this, void 0, void 0, function* () { | ||||
|                 destinationStream.close(); | ||||
|                 // await until file is created at downloadpath; node15 and up fs.createWriteStream had not created a file yet | ||||
|                 yield new Promise(resolve => { | ||||
|                     destinationStream.on('close', resolve); | ||||
|                     if (destinationStream.writableFinished) { | ||||
|                         resolve(); | ||||
|                     } | ||||
|                 }); | ||||
|                 yield utils_1.rmFile(fileDownloadPath); | ||||
|                 destinationStream = fs.createWriteStream(fileDownloadPath); | ||||
|             }); | ||||
| @@ -10453,17 +10671,40 @@ var isArray = Array.isArray || function (xs) { | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||||
|     return (mod && mod.__esModule) ? mod : { "default": mod }; | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const assert = __webpack_require__(357); | ||||
| const os = __webpack_require__(87); | ||||
| const path = __webpack_require__(622); | ||||
| const pathHelper = __webpack_require__(972); | ||||
| exports.Pattern = void 0; | ||||
| const os = __importStar(__webpack_require__(87)); | ||||
| const path = __importStar(__webpack_require__(622)); | ||||
| const pathHelper = __importStar(__webpack_require__(972)); | ||||
| const assert_1 = __importDefault(__webpack_require__(357)); | ||||
| const minimatch_1 = __webpack_require__(93); | ||||
| const internal_match_kind_1 = __webpack_require__(36); | ||||
| const internal_path_1 = __webpack_require__(383); | ||||
| const IS_WINDOWS = process.platform === 'win32'; | ||||
| class Pattern { | ||||
|     constructor(patternOrNegate, segments) { | ||||
|     constructor(patternOrNegate, isImplicitPattern = false, segments, homedir) { | ||||
|         /** | ||||
|          * Indicates whether matches should be excluded from the result set | ||||
|          */ | ||||
| @@ -10477,9 +10718,9 @@ class Pattern { | ||||
|         else { | ||||
|             // Convert to pattern | ||||
|             segments = segments || []; | ||||
|             assert(segments.length, `Parameter 'segments' must not empty`); | ||||
|             assert_1.default(segments.length, `Parameter 'segments' must not empty`); | ||||
|             const root = Pattern.getLiteral(segments[0]); | ||||
|             assert(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(); | ||||
|             if (patternOrNegate) { | ||||
|                 pattern = `!${pattern}`; | ||||
| @@ -10491,7 +10732,7 @@ class Pattern { | ||||
|             pattern = pattern.substr(1).trim(); | ||||
|         } | ||||
|         // Normalize slashes and ensures absolute root | ||||
|         pattern = Pattern.fixupPattern(pattern); | ||||
|         pattern = Pattern.fixupPattern(pattern, homedir); | ||||
|         // Segments | ||||
|         this.segments = new internal_path_1.Path(pattern).segments; | ||||
|         // Trailing slash indicates the pattern should only match directories, not regular files | ||||
| @@ -10507,6 +10748,7 @@ class Pattern { | ||||
|         this.searchPath = new internal_path_1.Path(searchSegments).toString(); | ||||
|         // Root RegExp (required when determining partial match) | ||||
|         this.rootRegExp = new RegExp(Pattern.regExpEscape(searchSegments[0]), IS_WINDOWS ? 'i' : ''); | ||||
|         this.isImplicitPattern = isImplicitPattern; | ||||
|         // Create minimatch | ||||
|         const minimatchOptions = { | ||||
|             dot: true, | ||||
| @@ -10528,11 +10770,11 @@ class Pattern { | ||||
|             // Normalize slashes | ||||
|             itemPath = pathHelper.normalizeSeparators(itemPath); | ||||
|             // Append a trailing slash. Otherwise Minimatch will not match the directory immediately | ||||
|             // preceeding the globstar. For example, given the pattern `/foo/**`, Minimatch returns | ||||
|             // preceding the globstar. For example, given the pattern `/foo/**`, Minimatch returns | ||||
|             // false for `/foo` but returns true for `/foo/`. Append a trailing slash to handle that quirk. | ||||
|             if (!itemPath.endsWith(path.sep)) { | ||||
|             if (!itemPath.endsWith(path.sep) && this.isImplicitPattern === false) { | ||||
|                 // Note, this is safe because the constructor ensures the pattern has an absolute root. | ||||
|                 // For example, formats like C: and C:foo on Windows are resolved to an aboslute root. | ||||
|                 // For example, formats like C: and C:foo on Windows are resolved to an absolute root. | ||||
|                 itemPath = `${itemPath}${path.sep}`; | ||||
|             } | ||||
|         } | ||||
| @@ -10570,15 +10812,15 @@ class Pattern { | ||||
|     /** | ||||
|      * Normalizes slashes and ensures absolute root | ||||
|      */ | ||||
|     static fixupPattern(pattern) { | ||||
|     static fixupPattern(pattern, homedir) { | ||||
|         // Empty | ||||
|         assert(pattern, 'pattern cannot be empty'); | ||||
|         assert_1.default(pattern, 'pattern cannot be empty'); | ||||
|         // Must not contain `.` segment, unless first segment | ||||
|         // Must not contain `..` segment | ||||
|         const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x)); | ||||
|         assert(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 | ||||
|         assert(!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 | ||||
|         pattern = pathHelper.normalizeSeparators(pattern); | ||||
|         // Replace leading `.` segment | ||||
| @@ -10587,9 +10829,9 @@ class Pattern { | ||||
|         } | ||||
|         // Replace leading `~` segment | ||||
|         else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) { | ||||
|             const homedir = os.homedir(); | ||||
|             assert(homedir, 'Unable to determine HOME directory'); | ||||
|             assert(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); | ||||
|             homedir = homedir || os.homedir(); | ||||
|             assert_1.default(homedir, 'Unable to determine HOME directory'); | ||||
|             assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`); | ||||
|             pattern = Pattern.globEscape(homedir) + pattern.substr(1); | ||||
|         } | ||||
|         // Replace relative drive root, e.g. pattern is C: or C:foo | ||||
| @@ -10691,9 +10933,32 @@ exports.Pattern = Pattern; | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||||
|     return (mod && mod.__esModule) ? mod : { "default": mod }; | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const assert = __webpack_require__(357); | ||||
| const path = __webpack_require__(622); | ||||
| exports.safeTrimTrailingSeparator = exports.normalizeSeparators = exports.hasRoot = exports.hasAbsoluteRoot = exports.ensureAbsoluteRoot = exports.dirname = void 0; | ||||
| const path = __importStar(__webpack_require__(622)); | ||||
| const assert_1 = __importDefault(__webpack_require__(357)); | ||||
| const IS_WINDOWS = process.platform === 'win32'; | ||||
| /** | ||||
|  * Similar to path.dirname except normalizes the path separators and slightly better handling for Windows UNC paths. | ||||
| @@ -10733,8 +10998,8 @@ exports.dirname = dirname; | ||||
|  * or `C:` are expanded based on the current working directory. | ||||
|  */ | ||||
| function ensureAbsoluteRoot(root, itemPath) { | ||||
|     assert(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); | ||||
|     assert(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); | ||||
|     assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`); | ||||
|     assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`); | ||||
|     // Already rooted | ||||
|     if (hasAbsoluteRoot(itemPath)) { | ||||
|         return itemPath; | ||||
| @@ -10744,7 +11009,7 @@ function ensureAbsoluteRoot(root, itemPath) { | ||||
|         // Check for itemPath like C: or C:foo | ||||
|         if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) { | ||||
|             let cwd = process.cwd(); | ||||
|             assert(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 | ||||
|             if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) { | ||||
|                 // Drive only, e.g. C: | ||||
| @@ -10769,11 +11034,11 @@ function ensureAbsoluteRoot(root, itemPath) { | ||||
|         // Check for itemPath like \ or \foo | ||||
|         else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) { | ||||
|             const cwd = process.cwd(); | ||||
|             assert(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)}`; | ||||
|         } | ||||
|     } | ||||
|     assert(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 | ||||
|     if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) { | ||||
|         // Intentionally empty | ||||
| @@ -10790,7 +11055,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot; | ||||
|  * `\\hello\share` and `C:\hello` (and using alternate separator). | ||||
|  */ | ||||
| function hasAbsoluteRoot(itemPath) { | ||||
|     assert(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); | ||||
|     assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`); | ||||
|     // Normalize separators | ||||
|     itemPath = normalizeSeparators(itemPath); | ||||
|     // Windows | ||||
| @@ -10807,7 +11072,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot; | ||||
|  * `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator). | ||||
|  */ | ||||
| function hasRoot(itemPath) { | ||||
|     assert(itemPath, `isRooted parameter 'itemPath' must not be empty`); | ||||
|     assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`); | ||||
|     // Normalize separators | ||||
|     itemPath = normalizeSeparators(itemPath); | ||||
|     // Windows | ||||
|   | ||||
		Reference in New Issue
	
	Block a user