From 42e540e657fc3dd049dea955013e201a3d88416c Mon Sep 17 00:00:00 2001 From: Marc Schweigert Date: Thu, 2 May 2024 19:25:04 -0400 Subject: [PATCH] enable on behalf of when creating environment with type 'developer' (#562) --- create-environment/action.yml | 4 + dist/actions/actions-install/index.js | 52 +- dist/actions/add-solution-component/index.js | 1074 +- dist/actions/assign-group/index.js | 1074 +- dist/actions/assign-user/index.js | 1074 +- dist/actions/backup-environment/index.js | 1074 +- dist/actions/branch-solution/index.js | 19656 +++++++--------- dist/actions/catalog-status/index.js | 1074 +- dist/actions/check-solution/index.js | 1074 +- dist/actions/clone-solution/index.js | 1074 +- dist/actions/copy-environment/index.js | 1074 +- dist/actions/create-environment/index.js | 1076 +- dist/actions/delete-environment/index.js | 1074 +- dist/actions/delete-solution/index.js | 1074 +- dist/actions/deploy-package/index.js | 1074 +- dist/actions/download-paportal/index.js | 1074 +- dist/actions/export-data/index.js | 1074 +- dist/actions/export-solution/index.js | 1074 +- dist/actions/import-data/index.js | 1074 +- dist/actions/import-solution/index.js | 1074 +- dist/actions/install-catalog/index.js | 1074 +- dist/actions/pack-solution/index.js | 1074 +- dist/actions/publish-solution/index.js | 1074 +- dist/actions/reset-environment/index.js | 1074 +- dist/actions/restore-environment/index.js | 1074 +- .../set-online-solution-version/index.js | 1074 +- dist/actions/submit-catalog/index.js | 1074 +- dist/actions/unpack-solution/index.js | 1074 +- dist/actions/update-solution-version/index.js | 1074 +- dist/actions/upgrade-solution/index.js | 1074 +- dist/actions/upload-paportal/index.js | 1074 +- dist/actions/who-am-i/index.js | 1074 +- package-lock.json | 15 +- package.json | 2 +- src/actions/create-environment/index.ts | 1 + src/test/createEnvironment.test.ts | 1 + 36 files changed, 22857 insertions(+), 28022 deletions(-) diff --git a/create-environment/action.yml b/create-environment/action.yml index 74e0b00b..d1ab4c35 100644 --- a/create-environment/action.yml +++ b/create-environment/action.yml @@ -42,6 +42,10 @@ inputs: required: true default: 'Sandbox' + user: + description: 'Object ID or user principal name (UPN) of Microsoft Entra ID user to be assigned to the environment.' + required: false + currency: description: 'The currency to use for the environment.' required: false diff --git a/dist/actions/actions-install/index.js b/dist/actions/actions-install/index.js index 58d13f6a..e111c8b4 100644 --- a/dist/actions/actions-install/index.js +++ b/dist/actions/actions-install/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -3324,56 +3324,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/add-solution-component/index.js b/dist/actions/add-solution-component/index.js index 3205a1f2..20c7e0e5 100644 --- a/dist/actions/add-solution-component/index.js +++ b/dist/actions/add-solution-component/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24200,56 +24098,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/assign-group/index.js b/dist/actions/assign-group/index.js index 7e1db23c..9097f64a 100644 --- a/dist/actions/assign-group/index.js +++ b/dist/actions/assign-group/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24200,56 +24098,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/assign-user/index.js b/dist/actions/assign-user/index.js index 8b5e451a..1a02f58e 100644 --- a/dist/actions/assign-user/index.js +++ b/dist/actions/assign-user/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24200,56 +24098,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/backup-environment/index.js b/dist/actions/backup-environment/index.js index 5bb7134c..def97085 100644 --- a/dist/actions/backup-environment/index.js +++ b/dist/actions/backup-environment/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24200,56 +24098,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/branch-solution/index.js b/dist/actions/branch-solution/index.js index 42c770a3..c2ade58a 100644 --- a/dist/actions/branch-solution/index.js +++ b/dist/actions/branch-solution/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a2 = res.result) === null || _a2 === void 0 ? void 0 : _a2.value; if (!id_token) { @@ -2300,56 +2300,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } @@ -2544,362 +2544,261 @@ var require_lib2 = __commonJS({ } }); -// node_modules/@babel/runtime/helpers/interopRequireDefault.js -var require_interopRequireDefault = __commonJS({ - "node_modules/@babel/runtime/helpers/interopRequireDefault.js"(exports2, module2) { - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; - } - module2.exports = _interopRequireDefault, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/typeof.js -var require_typeof = __commonJS({ - "node_modules/@babel/runtime/helpers/typeof.js"(exports2, module2) { - function _typeof(obj) { - "@babel/helpers - typeof"; - return module2.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { - return typeof obj2; - } : function(obj2) { - return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }, module2.exports.__esModule = true, module2.exports["default"] = module2.exports, _typeof(obj); - } - module2.exports = _typeof, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/date-fns/_lib/toInteger/index.js -var require_toInteger = __commonJS({ - "node_modules/date-fns/_lib/toInteger/index.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = toInteger; - function toInteger(dirtyNumber) { - if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) { - return NaN; - } - var number = Number(dirtyNumber); - if (isNaN(number)) { - return number; - } - return number < 0 ? Math.ceil(number) : Math.floor(number); - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/requiredArgs/index.js -var require_requiredArgs = __commonJS({ - "node_modules/date-fns/_lib/requiredArgs/index.js"(exports2, module2) { +// node_modules/date-fns/toDate.js +var require_toDate = __commonJS({ + "node_modules/date-fns/toDate.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = requiredArgs; - function requiredArgs(required, args) { - if (args.length < required) { - throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present"); + exports2.toDate = toDate; + function toDate(argument) { + const argStr = Object.prototype.toString.call(argument); + if (argument instanceof Date || typeof argument === "object" && argStr === "[object Date]") { + return new argument.constructor(+argument); + } else if (typeof argument === "number" || argStr === "[object Number]" || typeof argument === "string" || argStr === "[object String]") { + return new Date(argument); + } else { + return /* @__PURE__ */ new Date(NaN); } } - module2.exports = exports2.default; } }); -// node_modules/date-fns/toDate/index.js -var require_toDate = __commonJS({ - "node_modules/date-fns/toDate/index.js"(exports2, module2) { +// node_modules/date-fns/constructFrom.js +var require_constructFrom = __commonJS({ + "node_modules/date-fns/constructFrom.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = toDate; - var _typeof2 = _interopRequireDefault(require_typeof()); - var _index = _interopRequireDefault(require_requiredArgs()); - function toDate(argument) { - (0, _index.default)(1, arguments); - var argStr = Object.prototype.toString.call(argument); - if (argument instanceof Date || (0, _typeof2.default)(argument) === "object" && argStr === "[object Date]") { - return new Date(argument.getTime()); - } else if (typeof argument === "number" || argStr === "[object Number]") { - return new Date(argument); + exports2.constructFrom = constructFrom; + function constructFrom(date, value) { + if (date instanceof Date) { + return new date.constructor(value); } else { - if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") { - console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); - console.warn(new Error().stack); - } - return /* @__PURE__ */ new Date(NaN); + return new Date(value); } } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addDays/index.js +// node_modules/date-fns/addDays.js var require_addDays = __commonJS({ - "node_modules/date-fns/addDays/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addDays; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function addDays(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var amount = (0, _index.default)(dirtyAmount); - if (isNaN(amount)) { - return /* @__PURE__ */ new Date(NaN); - } + "node_modules/date-fns/addDays.js"(exports2) { + "use strict"; + exports2.addDays = addDays; + var _index = require_toDate(); + var _index2 = require_constructFrom(); + function addDays(date, amount) { + const _date = (0, _index.toDate)(date); + if (isNaN(amount)) + return (0, _index2.constructFrom)(date, NaN); if (!amount) { - return date; + return _date; } - date.setDate(date.getDate() + amount); - return date; + _date.setDate(_date.getDate() + amount); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addMonths/index.js +// node_modules/date-fns/addMonths.js var require_addMonths = __commonJS({ - "node_modules/date-fns/addMonths/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addMonths; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function addMonths(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var amount = (0, _index.default)(dirtyAmount); - if (isNaN(amount)) { - return /* @__PURE__ */ new Date(NaN); - } + "node_modules/date-fns/addMonths.js"(exports2) { + "use strict"; + exports2.addMonths = addMonths; + var _index = require_toDate(); + var _index2 = require_constructFrom(); + function addMonths(date, amount) { + const _date = (0, _index.toDate)(date); + if (isNaN(amount)) + return (0, _index2.constructFrom)(date, NaN); if (!amount) { - return date; + return _date; } - var dayOfMonth = date.getDate(); - var endOfDesiredMonth = new Date(date.getTime()); - endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0); - var daysInMonth = endOfDesiredMonth.getDate(); + const dayOfMonth = _date.getDate(); + const endOfDesiredMonth = (0, _index2.constructFrom)(date, _date.getTime()); + endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); + const daysInMonth = endOfDesiredMonth.getDate(); if (dayOfMonth >= daysInMonth) { return endOfDesiredMonth; } else { - date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth); - return date; + _date.setFullYear( + endOfDesiredMonth.getFullYear(), + endOfDesiredMonth.getMonth(), + dayOfMonth + ); + return _date; } } - module2.exports = exports2.default; } }); -// node_modules/date-fns/add/index.js +// node_modules/date-fns/add.js var require_add = __commonJS({ - "node_modules/date-fns/add/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = add; - var _typeof2 = _interopRequireDefault(require_typeof()); - var _index = _interopRequireDefault(require_addDays()); - var _index2 = _interopRequireDefault(require_addMonths()); - var _index3 = _interopRequireDefault(require_toDate()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var _index5 = _interopRequireDefault(require_toInteger()); - function add(dirtyDate, duration) { - (0, _index4.default)(2, arguments); - if (!duration || (0, _typeof2.default)(duration) !== "object") - return /* @__PURE__ */ new Date(NaN); - var years = duration.years ? (0, _index5.default)(duration.years) : 0; - var months = duration.months ? (0, _index5.default)(duration.months) : 0; - var weeks = duration.weeks ? (0, _index5.default)(duration.weeks) : 0; - var days = duration.days ? (0, _index5.default)(duration.days) : 0; - var hours = duration.hours ? (0, _index5.default)(duration.hours) : 0; - var minutes = duration.minutes ? (0, _index5.default)(duration.minutes) : 0; - var seconds = duration.seconds ? (0, _index5.default)(duration.seconds) : 0; - var date = (0, _index3.default)(dirtyDate); - var dateWithMonths = months || years ? (0, _index2.default)(date, months + years * 12) : date; - var dateWithDays = days || weeks ? (0, _index.default)(dateWithMonths, days + weeks * 7) : dateWithMonths; - var minutesToAdd = minutes + hours * 60; - var secondsToAdd = seconds + minutesToAdd * 60; - var msToAdd = secondsToAdd * 1e3; - var finalDate = new Date(dateWithDays.getTime() + msToAdd); + "node_modules/date-fns/add.js"(exports2) { + "use strict"; + exports2.add = add; + var _index = require_addDays(); + var _index2 = require_addMonths(); + var _index3 = require_constructFrom(); + var _index4 = require_toDate(); + function add(date, duration) { + const { + years = 0, + months = 0, + weeks = 0, + days = 0, + hours = 0, + minutes = 0, + seconds = 0 + } = duration; + const _date = (0, _index4.toDate)(date); + const dateWithMonths = months || years ? (0, _index2.addMonths)(_date, months + years * 12) : _date; + const dateWithDays = days || weeks ? (0, _index.addDays)(dateWithMonths, days + weeks * 7) : dateWithMonths; + const minutesToAdd = minutes + hours * 60; + const secondsToAdd = seconds + minutesToAdd * 60; + const msToAdd = secondsToAdd * 1e3; + const finalDate = (0, _index3.constructFrom)( + date, + dateWithDays.getTime() + msToAdd + ); return finalDate; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isWeekend/index.js -var require_isWeekend = __commonJS({ - "node_modules/date-fns/isWeekend/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isWeekend; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isWeekend(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var day = date.getDay(); - return day === 0 || day === 6; +// node_modules/date-fns/isSaturday.js +var require_isSaturday = __commonJS({ + "node_modules/date-fns/isSaturday.js"(exports2) { + "use strict"; + exports2.isSaturday = isSaturday; + var _index = require_toDate(); + function isSaturday(date) { + return (0, _index.toDate)(date).getDay() === 6; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSunday/index.js +// node_modules/date-fns/isSunday.js var require_isSunday = __commonJS({ - "node_modules/date-fns/isSunday/index.js"(exports2, module2) { + "node_modules/date-fns/isSunday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSunday; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSunday(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getDay() === 0; + exports2.isSunday = isSunday; + var _index = require_toDate(); + function isSunday(date) { + return (0, _index.toDate)(date).getDay() === 0; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSaturday/index.js -var require_isSaturday = __commonJS({ - "node_modules/date-fns/isSaturday/index.js"(exports2, module2) { +// node_modules/date-fns/isWeekend.js +var require_isWeekend = __commonJS({ + "node_modules/date-fns/isWeekend.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSaturday; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSaturday(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getDay() === 6; + exports2.isWeekend = isWeekend; + var _index = require_toDate(); + function isWeekend(date) { + const day = (0, _index.toDate)(date).getDay(); + return day === 0 || day === 6; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addBusinessDays/index.js +// node_modules/date-fns/addBusinessDays.js var require_addBusinessDays = __commonJS({ - "node_modules/date-fns/addBusinessDays/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addBusinessDays; - var _index = _interopRequireDefault(require_isWeekend()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_toInteger()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var _index5 = _interopRequireDefault(require_isSunday()); - var _index6 = _interopRequireDefault(require_isSaturday()); - function addBusinessDays(dirtyDate, dirtyAmount) { - (0, _index4.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var startedOnWeekend = (0, _index.default)(date); - var amount = (0, _index3.default)(dirtyAmount); + "node_modules/date-fns/addBusinessDays.js"(exports2) { + "use strict"; + exports2.addBusinessDays = addBusinessDays; + var _index = require_constructFrom(); + var _index2 = require_isSaturday(); + var _index3 = require_isSunday(); + var _index4 = require_isWeekend(); + var _index5 = require_toDate(); + function addBusinessDays(date, amount) { + const _date = (0, _index5.toDate)(date); + const startedOnWeekend = (0, _index4.isWeekend)(_date); if (isNaN(amount)) - return /* @__PURE__ */ new Date(NaN); - var hours = date.getHours(); - var sign = amount < 0 ? -1 : 1; - var fullWeeks = (0, _index3.default)(amount / 5); - date.setDate(date.getDate() + fullWeeks * 7); - var restDays = Math.abs(amount % 5); + return (0, _index.constructFrom)(date, NaN); + const hours = _date.getHours(); + const sign = amount < 0 ? -1 : 1; + const fullWeeks = Math.trunc(amount / 5); + _date.setDate(_date.getDate() + fullWeeks * 7); + let restDays = Math.abs(amount % 5); while (restDays > 0) { - date.setDate(date.getDate() + sign); - if (!(0, _index.default)(date)) + _date.setDate(_date.getDate() + sign); + if (!(0, _index4.isWeekend)(_date)) restDays -= 1; } - if (startedOnWeekend && (0, _index.default)(date) && amount !== 0) { - if ((0, _index6.default)(date)) - date.setDate(date.getDate() + (sign < 0 ? 2 : -1)); - if ((0, _index5.default)(date)) - date.setDate(date.getDate() + (sign < 0 ? 1 : -2)); + if (startedOnWeekend && (0, _index4.isWeekend)(_date) && amount !== 0) { + if ((0, _index2.isSaturday)(_date)) + _date.setDate(_date.getDate() + (sign < 0 ? 2 : -1)); + if ((0, _index3.isSunday)(_date)) + _date.setDate(_date.getDate() + (sign < 0 ? 1 : -2)); } - date.setHours(hours); - return date; + _date.setHours(hours); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addMilliseconds/index.js +// node_modules/date-fns/addMilliseconds.js var require_addMilliseconds = __commonJS({ - "node_modules/date-fns/addMilliseconds/index.js"(exports2, module2) { + "node_modules/date-fns/addMilliseconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addMilliseconds; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function addMilliseconds(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var timestamp = (0, _index2.default)(dirtyDate).getTime(); - var amount = (0, _index.default)(dirtyAmount); - return new Date(timestamp + amount); + exports2.addMilliseconds = addMilliseconds; + var _index = require_toDate(); + var _index2 = require_constructFrom(); + function addMilliseconds(date, amount) { + const timestamp = +(0, _index.toDate)(date); + return (0, _index2.constructFrom)(date, timestamp + amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addHours/index.js +// node_modules/date-fns/constants.js +var require_constants = __commonJS({ + "node_modules/date-fns/constants.js"(exports2) { + "use strict"; + exports2.secondsInYear = exports2.secondsInWeek = exports2.secondsInQuarter = exports2.secondsInMonth = exports2.secondsInMinute = exports2.secondsInHour = exports2.secondsInDay = exports2.quartersInYear = exports2.monthsInYear = exports2.monthsInQuarter = exports2.minutesInYear = exports2.minutesInMonth = exports2.minutesInHour = exports2.minutesInDay = exports2.minTime = exports2.millisecondsInWeek = exports2.millisecondsInSecond = exports2.millisecondsInMinute = exports2.millisecondsInHour = exports2.millisecondsInDay = exports2.maxTime = exports2.daysInYear = exports2.daysInWeek = void 0; + var daysInWeek = exports2.daysInWeek = 7; + var daysInYear = exports2.daysInYear = 365.2425; + var maxTime = exports2.maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3; + var minTime = exports2.minTime = -maxTime; + var millisecondsInWeek = exports2.millisecondsInWeek = 6048e5; + var millisecondsInDay = exports2.millisecondsInDay = 864e5; + var millisecondsInMinute = exports2.millisecondsInMinute = 6e4; + var millisecondsInHour = exports2.millisecondsInHour = 36e5; + var millisecondsInSecond = exports2.millisecondsInSecond = 1e3; + var minutesInYear = exports2.minutesInYear = 525600; + var minutesInMonth = exports2.minutesInMonth = 43200; + var minutesInDay = exports2.minutesInDay = 1440; + var minutesInHour = exports2.minutesInHour = 60; + var monthsInQuarter = exports2.monthsInQuarter = 3; + var monthsInYear = exports2.monthsInYear = 12; + var quartersInYear = exports2.quartersInYear = 4; + var secondsInHour = exports2.secondsInHour = 3600; + var secondsInMinute = exports2.secondsInMinute = 60; + var secondsInDay = exports2.secondsInDay = secondsInHour * 24; + var secondsInWeek = exports2.secondsInWeek = secondsInDay * 7; + var secondsInYear = exports2.secondsInYear = secondsInDay * daysInYear; + var secondsInMonth = exports2.secondsInMonth = secondsInYear / 12; + var secondsInQuarter = exports2.secondsInQuarter = secondsInMonth * 3; + } +}); + +// node_modules/date-fns/addHours.js var require_addHours = __commonJS({ - "node_modules/date-fns/addHours/index.js"(exports2, module2) { + "node_modules/date-fns/addHours.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addHours; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addMilliseconds()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_HOUR = 36e5; - function addHours(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index2.default)(dirtyDate, amount * MILLISECONDS_IN_HOUR); + exports2.addHours = addHours; + var _index = require_addMilliseconds(); + var _index2 = require_constants(); + function addHours(date, amount) { + return (0, _index.addMilliseconds)(date, amount * _index2.millisecondsInHour); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/_lib/defaultOptions/index.js +// node_modules/date-fns/_lib/defaultOptions.js var require_defaultOptions = __commonJS({ - "node_modules/date-fns/_lib/defaultOptions/index.js"(exports2) { + "node_modules/date-fns/_lib/defaultOptions.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.getDefaultOptions = getDefaultOptions; exports2.setDefaultOptions = setDefaultOptions; var defaultOptions = {}; @@ -2912,571 +2811,405 @@ var require_defaultOptions = __commonJS({ } }); -// node_modules/date-fns/startOfWeek/index.js +// node_modules/date-fns/startOfWeek.js var require_startOfWeek = __commonJS({ - "node_modules/date-fns/startOfWeek/index.js"(exports2, module2) { + "node_modules/date-fns/startOfWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfWeek; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_toInteger()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var _index4 = require_defaultOptions(); - function startOfWeek(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index3.default)(1, arguments); - var defaultOptions = (0, _index4.getDefaultOptions)(); - var weekStartsOn = (0, _index2.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - var date = (0, _index.default)(dirtyDate); - var day = date.getDay(); - var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; - date.setDate(date.getDate() - diff); - date.setHours(0, 0, 0, 0); - return date; + exports2.startOfWeek = startOfWeek; + var _index = require_toDate(); + var _index2 = require_defaultOptions(); + function startOfWeek(date, options) { + const defaultOptions = (0, _index2.getDefaultOptions)(); + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; + const _date = (0, _index.toDate)(date); + const day = _date.getDay(); + const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; + _date.setDate(_date.getDate() - diff); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfISOWeek/index.js +// node_modules/date-fns/startOfISOWeek.js var require_startOfISOWeek = __commonJS({ - "node_modules/date-fns/startOfISOWeek/index.js"(exports2, module2) { + "node_modules/date-fns/startOfISOWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfISOWeek; - var _index = _interopRequireDefault(require_startOfWeek()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfISOWeek(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate, { - weekStartsOn: 1 - }); + exports2.startOfISOWeek = startOfISOWeek; + var _index = require_startOfWeek(); + function startOfISOWeek(date) { + return (0, _index.startOfWeek)(date, { weekStartsOn: 1 }); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getISOWeekYear/index.js +// node_modules/date-fns/getISOWeekYear.js var require_getISOWeekYear = __commonJS({ - "node_modules/date-fns/getISOWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getISOWeekYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_startOfISOWeek()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function getISOWeekYear(dirtyDate) { - (0, _index3.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getFullYear(); - var fourthOfJanuaryOfNextYear = /* @__PURE__ */ new Date(0); + "node_modules/date-fns/getISOWeekYear.js"(exports2) { + "use strict"; + exports2.getISOWeekYear = getISOWeekYear; + var _index = require_constructFrom(); + var _index2 = require_startOfISOWeek(); + var _index3 = require_toDate(); + function getISOWeekYear(date) { + const _date = (0, _index3.toDate)(date); + const year = _date.getFullYear(); + const fourthOfJanuaryOfNextYear = (0, _index.constructFrom)(date, 0); fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); - var startOfNextYear = (0, _index2.default)(fourthOfJanuaryOfNextYear); - var fourthOfJanuaryOfThisYear = /* @__PURE__ */ new Date(0); + const startOfNextYear = (0, _index2.startOfISOWeek)( + fourthOfJanuaryOfNextYear + ); + const fourthOfJanuaryOfThisYear = (0, _index.constructFrom)(date, 0); fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); - var startOfThisYear = (0, _index2.default)(fourthOfJanuaryOfThisYear); - if (date.getTime() >= startOfNextYear.getTime()) { + const startOfThisYear = (0, _index2.startOfISOWeek)( + fourthOfJanuaryOfThisYear + ); + if (_date.getTime() >= startOfNextYear.getTime()) { return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { + } else if (_date.getTime() >= startOfThisYear.getTime()) { return year; } else { return year - 1; } } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfISOWeekYear/index.js -var require_startOfISOWeekYear = __commonJS({ - "node_modules/date-fns/startOfISOWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfISOWeekYear; - var _index = _interopRequireDefault(require_getISOWeekYear()); - var _index2 = _interopRequireDefault(require_startOfISOWeek()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function startOfISOWeekYear(dirtyDate) { - (0, _index3.default)(1, arguments); - var year = (0, _index.default)(dirtyDate); - var fourthOfJanuary = /* @__PURE__ */ new Date(0); - fourthOfJanuary.setFullYear(year, 0, 4); - fourthOfJanuary.setHours(0, 0, 0, 0); - var date = (0, _index2.default)(fourthOfJanuary); - return date; +// node_modules/date-fns/startOfDay.js +var require_startOfDay = __commonJS({ + "node_modules/date-fns/startOfDay.js"(exports2) { + "use strict"; + exports2.startOfDay = startOfDay; + var _index = require_toDate(); + function startOfDay(date) { + const _date = (0, _index.toDate)(date); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js +// node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js var require_getTimezoneOffsetInMilliseconds = __commonJS({ - "node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js"(exports2, module2) { + "node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getTimezoneOffsetInMilliseconds; + exports2.getTimezoneOffsetInMilliseconds = getTimezoneOffsetInMilliseconds; + var _index = require_toDate(); function getTimezoneOffsetInMilliseconds(date) { - var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds())); - utcDate.setUTCFullYear(date.getFullYear()); - return date.getTime() - utcDate.getTime(); + const _date = (0, _index.toDate)(date); + const utcDate = new Date( + Date.UTC( + _date.getFullYear(), + _date.getMonth(), + _date.getDate(), + _date.getHours(), + _date.getMinutes(), + _date.getSeconds(), + _date.getMilliseconds() + ) + ); + utcDate.setUTCFullYear(_date.getFullYear()); + return +date - +utcDate; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfDay/index.js -var require_startOfDay = __commonJS({ - "node_modules/date-fns/startOfDay/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfDay; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfDay(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - date.setHours(0, 0, 0, 0); - return date; +// node_modules/date-fns/differenceInCalendarDays.js +var require_differenceInCalendarDays = __commonJS({ + "node_modules/date-fns/differenceInCalendarDays.js"(exports2) { + "use strict"; + exports2.differenceInCalendarDays = differenceInCalendarDays; + var _index = require_constants(); + var _index2 = require_startOfDay(); + var _index3 = require_getTimezoneOffsetInMilliseconds(); + function differenceInCalendarDays(dateLeft, dateRight) { + const startOfDayLeft = (0, _index2.startOfDay)(dateLeft); + const startOfDayRight = (0, _index2.startOfDay)(dateRight); + const timestampLeft = +startOfDayLeft - (0, _index3.getTimezoneOffsetInMilliseconds)(startOfDayLeft); + const timestampRight = +startOfDayRight - (0, _index3.getTimezoneOffsetInMilliseconds)(startOfDayRight); + return Math.round( + (timestampLeft - timestampRight) / _index.millisecondsInDay + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarDays/index.js -var require_differenceInCalendarDays = __commonJS({ - "node_modules/date-fns/differenceInCalendarDays/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInCalendarDays; - var _index = _interopRequireDefault(require_getTimezoneOffsetInMilliseconds()); - var _index2 = _interopRequireDefault(require_startOfDay()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_DAY = 864e5; - function differenceInCalendarDays(dirtyDateLeft, dirtyDateRight) { - (0, _index3.default)(2, arguments); - var startOfDayLeft = (0, _index2.default)(dirtyDateLeft); - var startOfDayRight = (0, _index2.default)(dirtyDateRight); - var timestampLeft = startOfDayLeft.getTime() - (0, _index.default)(startOfDayLeft); - var timestampRight = startOfDayRight.getTime() - (0, _index.default)(startOfDayRight); - return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY); +// node_modules/date-fns/startOfISOWeekYear.js +var require_startOfISOWeekYear = __commonJS({ + "node_modules/date-fns/startOfISOWeekYear.js"(exports2) { + "use strict"; + exports2.startOfISOWeekYear = startOfISOWeekYear; + var _index = require_getISOWeekYear(); + var _index2 = require_startOfISOWeek(); + var _index3 = require_constructFrom(); + function startOfISOWeekYear(date) { + const year = (0, _index.getISOWeekYear)(date); + const fourthOfJanuary = (0, _index3.constructFrom)(date, 0); + fourthOfJanuary.setFullYear(year, 0, 4); + fourthOfJanuary.setHours(0, 0, 0, 0); + return (0, _index2.startOfISOWeek)(fourthOfJanuary); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setISOWeekYear/index.js +// node_modules/date-fns/setISOWeekYear.js var require_setISOWeekYear = __commonJS({ - "node_modules/date-fns/setISOWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setISOWeekYear; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_startOfISOWeekYear()); - var _index4 = _interopRequireDefault(require_differenceInCalendarDays()); - var _index5 = _interopRequireDefault(require_requiredArgs()); - function setISOWeekYear(dirtyDate, dirtyISOWeekYear) { - (0, _index5.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var isoWeekYear = (0, _index.default)(dirtyISOWeekYear); - var diff = (0, _index4.default)(date, (0, _index3.default)(date)); - var fourthOfJanuary = /* @__PURE__ */ new Date(0); - fourthOfJanuary.setFullYear(isoWeekYear, 0, 4); + "node_modules/date-fns/setISOWeekYear.js"(exports2) { + "use strict"; + exports2.setISOWeekYear = setISOWeekYear; + var _index = require_constructFrom(); + var _index2 = require_differenceInCalendarDays(); + var _index3 = require_startOfISOWeekYear(); + var _index4 = require_toDate(); + function setISOWeekYear(date, weekYear) { + let _date = (0, _index4.toDate)(date); + const diff = (0, _index2.differenceInCalendarDays)( + _date, + (0, _index3.startOfISOWeekYear)(_date) + ); + const fourthOfJanuary = (0, _index.constructFrom)(date, 0); + fourthOfJanuary.setFullYear(weekYear, 0, 4); fourthOfJanuary.setHours(0, 0, 0, 0); - date = (0, _index3.default)(fourthOfJanuary); - date.setDate(date.getDate() + diff); - return date; + _date = (0, _index3.startOfISOWeekYear)(fourthOfJanuary); + _date.setDate(_date.getDate() + diff); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addISOWeekYears/index.js +// node_modules/date-fns/addISOWeekYears.js var require_addISOWeekYears = __commonJS({ - "node_modules/date-fns/addISOWeekYears/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addISOWeekYears; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_getISOWeekYear()); - var _index3 = _interopRequireDefault(require_setISOWeekYear()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function addISOWeekYears(dirtyDate, dirtyAmount) { - (0, _index4.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index3.default)(dirtyDate, (0, _index2.default)(dirtyDate) + amount); + "node_modules/date-fns/addISOWeekYears.js"(exports2) { + "use strict"; + exports2.addISOWeekYears = addISOWeekYears; + var _index = require_getISOWeekYear(); + var _index2 = require_setISOWeekYear(); + function addISOWeekYears(date, amount) { + return (0, _index2.setISOWeekYear)( + date, + (0, _index.getISOWeekYear)(date) + amount + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addMinutes/index.js +// node_modules/date-fns/addMinutes.js var require_addMinutes = __commonJS({ - "node_modules/date-fns/addMinutes/index.js"(exports2, module2) { + "node_modules/date-fns/addMinutes.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addMinutes; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addMilliseconds()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_MINUTE = 6e4; - function addMinutes(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index2.default)(dirtyDate, amount * MILLISECONDS_IN_MINUTE); + exports2.addMinutes = addMinutes; + var _index = require_addMilliseconds(); + var _index2 = require_constants(); + function addMinutes(date, amount) { + return (0, _index.addMilliseconds)( + date, + amount * _index2.millisecondsInMinute + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addQuarters/index.js +// node_modules/date-fns/addQuarters.js var require_addQuarters = __commonJS({ - "node_modules/date-fns/addQuarters/index.js"(exports2, module2) { + "node_modules/date-fns/addQuarters.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addQuarters; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addMonths()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function addQuarters(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - var months = amount * 3; - return (0, _index2.default)(dirtyDate, months); + exports2.addQuarters = addQuarters; + var _index = require_addMonths(); + function addQuarters(date, amount) { + const months = amount * 3; + return (0, _index.addMonths)(date, months); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addSeconds/index.js +// node_modules/date-fns/addSeconds.js var require_addSeconds = __commonJS({ - "node_modules/date-fns/addSeconds/index.js"(exports2, module2) { + "node_modules/date-fns/addSeconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addSeconds; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addMilliseconds()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function addSeconds(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index2.default)(dirtyDate, amount * 1e3); + exports2.addSeconds = addSeconds; + var _index = require_addMilliseconds(); + function addSeconds(date, amount) { + return (0, _index.addMilliseconds)(date, amount * 1e3); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addWeeks/index.js +// node_modules/date-fns/addWeeks.js var require_addWeeks = __commonJS({ - "node_modules/date-fns/addWeeks/index.js"(exports2, module2) { + "node_modules/date-fns/addWeeks.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addWeeks; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addDays()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function addWeeks(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - var days = amount * 7; - return (0, _index2.default)(dirtyDate, days); + exports2.addWeeks = addWeeks; + var _index = require_addDays(); + function addWeeks(date, amount) { + const days = amount * 7; + return (0, _index.addDays)(date, days); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/addYears/index.js +// node_modules/date-fns/addYears.js var require_addYears = __commonJS({ - "node_modules/date-fns/addYears/index.js"(exports2, module2) { + "node_modules/date-fns/addYears.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addYears; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addMonths()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function addYears(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index2.default)(dirtyDate, amount * 12); + exports2.addYears = addYears; + var _index = require_addMonths(); + function addYears(date, amount) { + return (0, _index.addMonths)(date, amount * 12); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/areIntervalsOverlapping/index.js +// node_modules/date-fns/areIntervalsOverlapping.js var require_areIntervalsOverlapping = __commonJS({ - "node_modules/date-fns/areIntervalsOverlapping/index.js"(exports2, module2) { + "node_modules/date-fns/areIntervalsOverlapping.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = areIntervalsOverlapping; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); + exports2.areIntervalsOverlapping = areIntervalsOverlapping; + var _index = require_toDate(); function areIntervalsOverlapping(intervalLeft, intervalRight, options) { - (0, _index2.default)(2, arguments); - var leftStartTime = (0, _index.default)(intervalLeft === null || intervalLeft === void 0 ? void 0 : intervalLeft.start).getTime(); - var leftEndTime = (0, _index.default)(intervalLeft === null || intervalLeft === void 0 ? void 0 : intervalLeft.end).getTime(); - var rightStartTime = (0, _index.default)(intervalRight === null || intervalRight === void 0 ? void 0 : intervalRight.start).getTime(); - var rightEndTime = (0, _index.default)(intervalRight === null || intervalRight === void 0 ? void 0 : intervalRight.end).getTime(); - if (!(leftStartTime <= leftEndTime && rightStartTime <= rightEndTime)) { - throw new RangeError("Invalid interval"); - } - if (options !== null && options !== void 0 && options.inclusive) { + const [leftStartTime, leftEndTime] = [ + +(0, _index.toDate)(intervalLeft.start), + +(0, _index.toDate)(intervalLeft.end) + ].sort((a, b) => a - b); + const [rightStartTime, rightEndTime] = [ + +(0, _index.toDate)(intervalRight.start), + +(0, _index.toDate)(intervalRight.end) + ].sort((a, b) => a - b); + if (options?.inclusive) return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime; - } return leftStartTime < rightEndTime && rightStartTime < leftEndTime; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/max/index.js +// node_modules/date-fns/max.js var require_max = __commonJS({ - "node_modules/date-fns/max/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = max; - var _typeof2 = _interopRequireDefault(require_typeof()); - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function max(dirtyDatesArray) { - (0, _index2.default)(1, arguments); - var datesArray; - if (dirtyDatesArray && typeof dirtyDatesArray.forEach === "function") { - datesArray = dirtyDatesArray; - } else if ((0, _typeof2.default)(dirtyDatesArray) === "object" && dirtyDatesArray !== null) { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } else { - return /* @__PURE__ */ new Date(NaN); - } - var result; - datesArray.forEach(function(dirtyDate) { - var currentDate = (0, _index.default)(dirtyDate); + "node_modules/date-fns/max.js"(exports2) { + "use strict"; + exports2.max = max; + var _index = require_toDate(); + function max(dates) { + let result; + dates.forEach(function(dirtyDate) { + const currentDate = (0, _index.toDate)(dirtyDate); if (result === void 0 || result < currentDate || isNaN(Number(currentDate))) { result = currentDate; } }); return result || /* @__PURE__ */ new Date(NaN); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/min/index.js +// node_modules/date-fns/min.js var require_min = __commonJS({ - "node_modules/date-fns/min/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = min; - var _typeof2 = _interopRequireDefault(require_typeof()); - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function min(dirtyDatesArray) { - (0, _index2.default)(1, arguments); - var datesArray; - if (dirtyDatesArray && typeof dirtyDatesArray.forEach === "function") { - datesArray = dirtyDatesArray; - } else if ((0, _typeof2.default)(dirtyDatesArray) === "object" && dirtyDatesArray !== null) { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } else { - return /* @__PURE__ */ new Date(NaN); - } - var result; - datesArray.forEach(function(dirtyDate) { - var currentDate = (0, _index.default)(dirtyDate); - if (result === void 0 || result > currentDate || isNaN(currentDate.getDate())) { - result = currentDate; + "node_modules/date-fns/min.js"(exports2) { + "use strict"; + exports2.min = min; + var _index = require_toDate(); + function min(dates) { + let result; + dates.forEach((dirtyDate) => { + const date = (0, _index.toDate)(dirtyDate); + if (!result || result > date || isNaN(+date)) { + result = date; } }); return result || /* @__PURE__ */ new Date(NaN); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/clamp/index.js +// node_modules/date-fns/clamp.js var require_clamp = __commonJS({ - "node_modules/date-fns/clamp/index.js"(exports2, module2) { + "node_modules/date-fns/clamp.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = clamp; - var _index = _interopRequireDefault(require_max()); - var _index2 = _interopRequireDefault(require_min()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function clamp(date, _ref) { - var start = _ref.start, end = _ref.end; - (0, _index3.default)(2, arguments); - return (0, _index2.default)([(0, _index.default)([date, start]), end]); + exports2.clamp = clamp; + var _index = require_max(); + var _index2 = require_min(); + function clamp(date, interval) { + return (0, _index2.min)([ + (0, _index.max)([date, interval.start]), + interval.end + ]); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/closestIndexTo/index.js +// node_modules/date-fns/closestIndexTo.js var require_closestIndexTo = __commonJS({ - "node_modules/date-fns/closestIndexTo/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = closestIndexTo; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function closestIndexTo(dirtyDateToCompare, dirtyDatesArray) { - (0, _index2.default)(2, arguments); - var dateToCompare = (0, _index.default)(dirtyDateToCompare); - if (isNaN(Number(dateToCompare))) + "node_modules/date-fns/closestIndexTo.js"(exports2) { + "use strict"; + exports2.closestIndexTo = closestIndexTo; + var _index = require_toDate(); + function closestIndexTo(dateToCompare, dates) { + const date = (0, _index.toDate)(dateToCompare); + if (isNaN(Number(date))) return NaN; - var timeToCompare = dateToCompare.getTime(); - var datesArray; - if (dirtyDatesArray == null) { - datesArray = []; - } else if (typeof dirtyDatesArray.forEach === "function") { - datesArray = dirtyDatesArray; - } else { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } - var result; - var minDistance; - datesArray.forEach(function(dirtyDate, index) { - var currentDate = (0, _index.default)(dirtyDate); + const timeToCompare = date.getTime(); + let result; + let minDistance; + dates.forEach(function(dirtyDate, index) { + const currentDate = (0, _index.toDate)(dirtyDate); if (isNaN(Number(currentDate))) { result = NaN; minDistance = NaN; return; } - var distance = Math.abs(timeToCompare - currentDate.getTime()); - if (result == null || distance < Number(minDistance)) { + const distance = Math.abs(timeToCompare - currentDate.getTime()); + if (result == null || distance < minDistance) { result = index; minDistance = distance; } }); return result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/closestTo/index.js +// node_modules/date-fns/closestTo.js var require_closestTo = __commonJS({ - "node_modules/date-fns/closestTo/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = closestTo; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function closestTo(dirtyDateToCompare, dirtyDatesArray) { - (0, _index2.default)(2, arguments); - var dateToCompare = (0, _index.default)(dirtyDateToCompare); - if (isNaN(Number(dateToCompare))) - return /* @__PURE__ */ new Date(NaN); - var timeToCompare = dateToCompare.getTime(); - var datesArray; - if (dirtyDatesArray == null) { - datesArray = []; - } else if (typeof dirtyDatesArray.forEach === "function") { - datesArray = dirtyDatesArray; - } else { - datesArray = Array.prototype.slice.call(dirtyDatesArray); - } - var result; - var minDistance; - datesArray.forEach(function(dirtyDate) { - var currentDate = (0, _index.default)(dirtyDate); + "node_modules/date-fns/closestTo.js"(exports2) { + "use strict"; + exports2.closestTo = closestTo; + var _index = require_constructFrom(); + var _index2 = require_toDate(); + function closestTo(dateToCompare, dates) { + const date = (0, _index2.toDate)(dateToCompare); + if (isNaN(Number(date))) + return (0, _index.constructFrom)(dateToCompare, NaN); + const timeToCompare = date.getTime(); + let result; + let minDistance; + dates.forEach((dirtyDate) => { + const currentDate = (0, _index2.toDate)(dirtyDate); if (isNaN(Number(currentDate))) { - result = /* @__PURE__ */ new Date(NaN); + result = (0, _index.constructFrom)(dateToCompare, NaN); minDistance = NaN; return; } - var distance = Math.abs(timeToCompare - currentDate.getTime()); - if (result == null || distance < Number(minDistance)) { + const distance = Math.abs(timeToCompare - currentDate.getTime()); + if (result == null || distance < minDistance) { result = currentDate; minDistance = distance; } }); return result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/compareAsc/index.js +// node_modules/date-fns/compareAsc.js var require_compareAsc = __commonJS({ - "node_modules/date-fns/compareAsc/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = compareAsc; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function compareAsc(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - var diff = dateLeft.getTime() - dateRight.getTime(); + "node_modules/date-fns/compareAsc.js"(exports2) { + "use strict"; + exports2.compareAsc = compareAsc; + var _index = require_toDate(); + function compareAsc(dateLeft, dateRight) { + const _dateLeft = (0, _index.toDate)(dateLeft); + const _dateRight = (0, _index.toDate)(dateRight); + const diff = _dateLeft.getTime() - _dateRight.getTime(); if (diff < 0) { return -1; } else if (diff > 0) { @@ -3485,26 +3218,19 @@ var require_compareAsc = __commonJS({ return diff; } } - module2.exports = exports2.default; } }); -// node_modules/date-fns/compareDesc/index.js +// node_modules/date-fns/compareDesc.js var require_compareDesc = __commonJS({ - "node_modules/date-fns/compareDesc/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = compareDesc; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function compareDesc(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - var diff = dateLeft.getTime() - dateRight.getTime(); + "node_modules/date-fns/compareDesc.js"(exports2) { + "use strict"; + exports2.compareDesc = compareDesc; + var _index = require_toDate(); + function compareDesc(dateLeft, dateRight) { + const _dateLeft = (0, _index.toDate)(dateLeft); + const _dateRight = (0, _index.toDate)(dateRight); + const diff = _dateLeft.getTime() - _dateRight.getTime(); if (diff > 0) { return -1; } else if (diff < 0) { @@ -3513,351 +3239,246 @@ var require_compareDesc = __commonJS({ return diff; } } - module2.exports = exports2.default; } }); -// node_modules/date-fns/constants/index.js -var require_constants = __commonJS({ - "node_modules/date-fns/constants/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.secondsInYear = exports2.secondsInWeek = exports2.secondsInQuarter = exports2.secondsInMonth = exports2.secondsInMinute = exports2.secondsInHour = exports2.secondsInDay = exports2.quartersInYear = exports2.monthsInYear = exports2.monthsInQuarter = exports2.minutesInHour = exports2.minTime = exports2.millisecondsInSecond = exports2.millisecondsInMinute = exports2.millisecondsInHour = exports2.maxTime = exports2.daysInYear = exports2.daysInWeek = void 0; - var daysInWeek = 7; - exports2.daysInWeek = daysInWeek; - var daysInYear = 365.2425; - exports2.daysInYear = daysInYear; - var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3; - exports2.maxTime = maxTime; - var millisecondsInMinute = 6e4; - exports2.millisecondsInMinute = millisecondsInMinute; - var millisecondsInHour = 36e5; - exports2.millisecondsInHour = millisecondsInHour; - var millisecondsInSecond = 1e3; - exports2.millisecondsInSecond = millisecondsInSecond; - var minTime = -maxTime; - exports2.minTime = minTime; - var minutesInHour = 60; - exports2.minutesInHour = minutesInHour; - var monthsInQuarter = 3; - exports2.monthsInQuarter = monthsInQuarter; - var monthsInYear = 12; - exports2.monthsInYear = monthsInYear; - var quartersInYear = 4; - exports2.quartersInYear = quartersInYear; - var secondsInHour = 3600; - exports2.secondsInHour = secondsInHour; - var secondsInMinute = 60; - exports2.secondsInMinute = secondsInMinute; - var secondsInDay = secondsInHour * 24; - exports2.secondsInDay = secondsInDay; - var secondsInWeek = secondsInDay * 7; - exports2.secondsInWeek = secondsInWeek; - var secondsInYear = secondsInDay * daysInYear; - exports2.secondsInYear = secondsInYear; - var secondsInMonth = secondsInYear / 12; - exports2.secondsInMonth = secondsInMonth; - var secondsInQuarter = secondsInMonth * 3; - exports2.secondsInQuarter = secondsInQuarter; - } -}); - -// node_modules/date-fns/daysToWeeks/index.js +// node_modules/date-fns/constructNow.js +var require_constructNow = __commonJS({ + "node_modules/date-fns/constructNow.js"(exports2) { + "use strict"; + exports2.constructNow = constructNow; + var _index = require_constructFrom(); + function constructNow(date) { + return (0, _index.constructFrom)(date, Date.now()); + } + } +}); + +// node_modules/date-fns/daysToWeeks.js var require_daysToWeeks = __commonJS({ - "node_modules/date-fns/daysToWeeks/index.js"(exports2, module2) { + "node_modules/date-fns/daysToWeeks.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = daysToWeeks; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.daysToWeeks = daysToWeeks; + var _index = require_constants(); function daysToWeeks(days) { - (0, _index.default)(1, arguments); - var weeks = days / _index2.daysInWeek; - return Math.floor(weeks); + const weeks = days / _index.daysInWeek; + const result = Math.trunc(weeks); + return result === 0 ? 0 : result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameDay/index.js +// node_modules/date-fns/isSameDay.js var require_isSameDay = __commonJS({ - "node_modules/date-fns/isSameDay/index.js"(exports2, module2) { + "node_modules/date-fns/isSameDay.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameDay; - var _index = _interopRequireDefault(require_startOfDay()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameDay(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeftStartOfDay = (0, _index.default)(dirtyDateLeft); - var dateRightStartOfDay = (0, _index.default)(dirtyDateRight); - return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime(); + exports2.isSameDay = isSameDay; + var _index = require_startOfDay(); + function isSameDay(dateLeft, dateRight) { + const dateLeftStartOfDay = (0, _index.startOfDay)(dateLeft); + const dateRightStartOfDay = (0, _index.startOfDay)(dateRight); + return +dateLeftStartOfDay === +dateRightStartOfDay; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isDate/index.js +// node_modules/date-fns/isDate.js var require_isDate = __commonJS({ - "node_modules/date-fns/isDate/index.js"(exports2, module2) { + "node_modules/date-fns/isDate.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isDate; - var _typeof2 = _interopRequireDefault(require_typeof()); - var _index = _interopRequireDefault(require_requiredArgs()); + exports2.isDate = isDate; function isDate(value) { - (0, _index.default)(1, arguments); - return value instanceof Date || (0, _typeof2.default)(value) === "object" && Object.prototype.toString.call(value) === "[object Date]"; + return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]"; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isValid/index.js +// node_modules/date-fns/isValid.js var require_isValid = __commonJS({ - "node_modules/date-fns/isValid/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isValid; - var _index = _interopRequireDefault(require_isDate()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function isValid(dirtyDate) { - (0, _index3.default)(1, arguments); - if (!(0, _index.default)(dirtyDate) && typeof dirtyDate !== "number") { + "node_modules/date-fns/isValid.js"(exports2) { + "use strict"; + exports2.isValid = isValid; + var _index = require_isDate(); + var _index2 = require_toDate(); + function isValid(date) { + if (!(0, _index.isDate)(date) && typeof date !== "number") { return false; } - var date = (0, _index2.default)(dirtyDate); - return !isNaN(Number(date)); + const _date = (0, _index2.toDate)(date); + return !isNaN(Number(_date)); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInBusinessDays/index.js +// node_modules/date-fns/differenceInBusinessDays.js var require_differenceInBusinessDays = __commonJS({ - "node_modules/date-fns/differenceInBusinessDays/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInBusinessDays; - var _index = _interopRequireDefault(require_addDays()); - var _index2 = _interopRequireDefault(require_differenceInCalendarDays()); - var _index3 = _interopRequireDefault(require_isSameDay()); - var _index4 = _interopRequireDefault(require_isValid()); - var _index5 = _interopRequireDefault(require_isWeekend()); - var _index6 = _interopRequireDefault(require_toDate()); - var _index7 = _interopRequireDefault(require_requiredArgs()); - var _index8 = _interopRequireDefault(require_toInteger()); - function differenceInBusinessDays(dirtyDateLeft, dirtyDateRight) { - (0, _index7.default)(2, arguments); - var dateLeft = (0, _index6.default)(dirtyDateLeft); - var dateRight = (0, _index6.default)(dirtyDateRight); - if (!(0, _index4.default)(dateLeft) || !(0, _index4.default)(dateRight)) + "node_modules/date-fns/differenceInBusinessDays.js"(exports2) { + "use strict"; + exports2.differenceInBusinessDays = differenceInBusinessDays; + var _index = require_addDays(); + var _index2 = require_differenceInCalendarDays(); + var _index3 = require_isSameDay(); + var _index4 = require_isValid(); + var _index5 = require_isWeekend(); + var _index6 = require_toDate(); + function differenceInBusinessDays(dateLeft, dateRight) { + const _dateLeft = (0, _index6.toDate)(dateLeft); + let _dateRight = (0, _index6.toDate)(dateRight); + if (!(0, _index4.isValid)(_dateLeft) || !(0, _index4.isValid)(_dateRight)) return NaN; - var calendarDifference = (0, _index2.default)(dateLeft, dateRight); - var sign = calendarDifference < 0 ? -1 : 1; - var weeks = (0, _index8.default)(calendarDifference / 7); - var result = weeks * 5; - dateRight = (0, _index.default)(dateRight, weeks * 7); - while (!(0, _index3.default)(dateLeft, dateRight)) { - result += (0, _index5.default)(dateRight) ? 0 : sign; - dateRight = (0, _index.default)(dateRight, sign); + const calendarDifference = (0, _index2.differenceInCalendarDays)( + _dateLeft, + _dateRight + ); + const sign = calendarDifference < 0 ? -1 : 1; + const weeks = Math.trunc(calendarDifference / 7); + let result = weeks * 5; + _dateRight = (0, _index.addDays)(_dateRight, weeks * 7); + while (!(0, _index3.isSameDay)(_dateLeft, _dateRight)) { + result += (0, _index5.isWeekend)(_dateRight) ? 0 : sign; + _dateRight = (0, _index.addDays)(_dateRight, sign); } return result === 0 ? 0 : result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarISOWeekYears/index.js +// node_modules/date-fns/differenceInCalendarISOWeekYears.js var require_differenceInCalendarISOWeekYears = __commonJS({ - "node_modules/date-fns/differenceInCalendarISOWeekYears/index.js"(exports2, module2) { + "node_modules/date-fns/differenceInCalendarISOWeekYears.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInCalendarISOWeekYears; - var _index = _interopRequireDefault(require_getISOWeekYear()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function differenceInCalendarISOWeekYears(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - return (0, _index.default)(dirtyDateLeft) - (0, _index.default)(dirtyDateRight); + exports2.differenceInCalendarISOWeekYears = differenceInCalendarISOWeekYears; + var _index = require_getISOWeekYear(); + function differenceInCalendarISOWeekYears(dateLeft, dateRight) { + return (0, _index.getISOWeekYear)(dateLeft) - (0, _index.getISOWeekYear)(dateRight); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarISOWeeks/index.js +// node_modules/date-fns/differenceInCalendarISOWeeks.js var require_differenceInCalendarISOWeeks = __commonJS({ - "node_modules/date-fns/differenceInCalendarISOWeeks/index.js"(exports2, module2) { + "node_modules/date-fns/differenceInCalendarISOWeeks.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInCalendarISOWeeks; - var _index = _interopRequireDefault(require_getTimezoneOffsetInMilliseconds()); - var _index2 = _interopRequireDefault(require_startOfISOWeek()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_WEEK = 6048e5; - function differenceInCalendarISOWeeks(dirtyDateLeft, dirtyDateRight) { - (0, _index3.default)(2, arguments); - var startOfISOWeekLeft = (0, _index2.default)(dirtyDateLeft); - var startOfISOWeekRight = (0, _index2.default)(dirtyDateRight); - var timestampLeft = startOfISOWeekLeft.getTime() - (0, _index.default)(startOfISOWeekLeft); - var timestampRight = startOfISOWeekRight.getTime() - (0, _index.default)(startOfISOWeekRight); - return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK); + exports2.differenceInCalendarISOWeeks = differenceInCalendarISOWeeks; + var _index = require_constants(); + var _index2 = require_startOfISOWeek(); + var _index3 = require_getTimezoneOffsetInMilliseconds(); + function differenceInCalendarISOWeeks(dateLeft, dateRight) { + const startOfISOWeekLeft = (0, _index2.startOfISOWeek)(dateLeft); + const startOfISOWeekRight = (0, _index2.startOfISOWeek)(dateRight); + const timestampLeft = +startOfISOWeekLeft - (0, _index3.getTimezoneOffsetInMilliseconds)(startOfISOWeekLeft); + const timestampRight = +startOfISOWeekRight - (0, _index3.getTimezoneOffsetInMilliseconds)(startOfISOWeekRight); + return Math.round( + (timestampLeft - timestampRight) / _index.millisecondsInWeek + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarMonths/index.js +// node_modules/date-fns/differenceInCalendarMonths.js var require_differenceInCalendarMonths = __commonJS({ - "node_modules/date-fns/differenceInCalendarMonths/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInCalendarMonths; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function differenceInCalendarMonths(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear(); - var monthDiff = dateLeft.getMonth() - dateRight.getMonth(); + "node_modules/date-fns/differenceInCalendarMonths.js"(exports2) { + "use strict"; + exports2.differenceInCalendarMonths = differenceInCalendarMonths; + var _index = require_toDate(); + function differenceInCalendarMonths(dateLeft, dateRight) { + const _dateLeft = (0, _index.toDate)(dateLeft); + const _dateRight = (0, _index.toDate)(dateRight); + const yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear(); + const monthDiff = _dateLeft.getMonth() - _dateRight.getMonth(); return yearDiff * 12 + monthDiff; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getQuarter/index.js +// node_modules/date-fns/getQuarter.js var require_getQuarter = __commonJS({ - "node_modules/date-fns/getQuarter/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getQuarter; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getQuarter(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var quarter = Math.floor(date.getMonth() / 3) + 1; + "node_modules/date-fns/getQuarter.js"(exports2) { + "use strict"; + exports2.getQuarter = getQuarter; + var _index = require_toDate(); + function getQuarter(date) { + const _date = (0, _index.toDate)(date); + const quarter = Math.trunc(_date.getMonth() / 3) + 1; return quarter; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarQuarters/index.js +// node_modules/date-fns/differenceInCalendarQuarters.js var require_differenceInCalendarQuarters = __commonJS({ - "node_modules/date-fns/differenceInCalendarQuarters/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInCalendarQuarters; - var _index = _interopRequireDefault(require_getQuarter()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function differenceInCalendarQuarters(dirtyDateLeft, dirtyDateRight) { - (0, _index3.default)(2, arguments); - var dateLeft = (0, _index2.default)(dirtyDateLeft); - var dateRight = (0, _index2.default)(dirtyDateRight); - var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear(); - var quarterDiff = (0, _index.default)(dateLeft) - (0, _index.default)(dateRight); + "node_modules/date-fns/differenceInCalendarQuarters.js"(exports2) { + "use strict"; + exports2.differenceInCalendarQuarters = differenceInCalendarQuarters; + var _index = require_getQuarter(); + var _index2 = require_toDate(); + function differenceInCalendarQuarters(dateLeft, dateRight) { + const _dateLeft = (0, _index2.toDate)(dateLeft); + const _dateRight = (0, _index2.toDate)(dateRight); + const yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear(); + const quarterDiff = (0, _index.getQuarter)(_dateLeft) - (0, _index.getQuarter)(_dateRight); return yearDiff * 4 + quarterDiff; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarWeeks/index.js +// node_modules/date-fns/differenceInCalendarWeeks.js var require_differenceInCalendarWeeks = __commonJS({ - "node_modules/date-fns/differenceInCalendarWeeks/index.js"(exports2, module2) { + "node_modules/date-fns/differenceInCalendarWeeks.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInCalendarWeeks; - var _index = _interopRequireDefault(require_startOfWeek()); - var _index2 = _interopRequireDefault(require_getTimezoneOffsetInMilliseconds()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_WEEK = 6048e5; - function differenceInCalendarWeeks(dirtyDateLeft, dirtyDateRight, options) { - (0, _index3.default)(2, arguments); - var startOfWeekLeft = (0, _index.default)(dirtyDateLeft, options); - var startOfWeekRight = (0, _index.default)(dirtyDateRight, options); - var timestampLeft = startOfWeekLeft.getTime() - (0, _index2.default)(startOfWeekLeft); - var timestampRight = startOfWeekRight.getTime() - (0, _index2.default)(startOfWeekRight); - return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK); + exports2.differenceInCalendarWeeks = differenceInCalendarWeeks; + var _index = require_constants(); + var _index2 = require_startOfWeek(); + var _index3 = require_getTimezoneOffsetInMilliseconds(); + function differenceInCalendarWeeks(dateLeft, dateRight, options) { + const startOfWeekLeft = (0, _index2.startOfWeek)(dateLeft, options); + const startOfWeekRight = (0, _index2.startOfWeek)(dateRight, options); + const timestampLeft = +startOfWeekLeft - (0, _index3.getTimezoneOffsetInMilliseconds)(startOfWeekLeft); + const timestampRight = +startOfWeekRight - (0, _index3.getTimezoneOffsetInMilliseconds)(startOfWeekRight); + return Math.round( + (timestampLeft - timestampRight) / _index.millisecondsInWeek + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarYears/index.js +// node_modules/date-fns/differenceInCalendarYears.js var require_differenceInCalendarYears = __commonJS({ - "node_modules/date-fns/differenceInCalendarYears/index.js"(exports2, module2) { + "node_modules/date-fns/differenceInCalendarYears.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInCalendarYears; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - return dateLeft.getFullYear() - dateRight.getFullYear(); + exports2.differenceInCalendarYears = differenceInCalendarYears; + var _index = require_toDate(); + function differenceInCalendarYears(dateLeft, dateRight) { + const _dateLeft = (0, _index.toDate)(dateLeft); + const _dateRight = (0, _index.toDate)(dateRight); + return _dateLeft.getFullYear() - _dateRight.getFullYear(); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInDays/index.js +// node_modules/date-fns/differenceInDays.js var require_differenceInDays = __commonJS({ - "node_modules/date-fns/differenceInDays/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInDays; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_differenceInCalendarDays()); - var _index3 = _interopRequireDefault(require_requiredArgs()); + "node_modules/date-fns/differenceInDays.js"(exports2) { + "use strict"; + exports2.differenceInDays = differenceInDays; + var _index = require_differenceInCalendarDays(); + var _index2 = require_toDate(); + function differenceInDays(dateLeft, dateRight) { + const _dateLeft = (0, _index2.toDate)(dateLeft); + const _dateRight = (0, _index2.toDate)(dateRight); + const sign = compareLocalAsc(_dateLeft, _dateRight); + const difference = Math.abs( + (0, _index.differenceInCalendarDays)(_dateLeft, _dateRight) + ); + _dateLeft.setDate(_dateLeft.getDate() - sign * difference); + const isLastDayNotFull = Number( + compareLocalAsc(_dateLeft, _dateRight) === -sign + ); + const result = sign * (difference - isLastDayNotFull); + return result === 0 ? 0 : result; + } function compareLocalAsc(dateLeft, dateRight) { - var diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds(); + const diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds(); if (diff < 0) { return -1; } else if (diff > 0) { @@ -3866,1524 +3487,1644 @@ var require_differenceInDays = __commonJS({ return diff; } } - function differenceInDays(dirtyDateLeft, dirtyDateRight) { - (0, _index3.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - var sign = compareLocalAsc(dateLeft, dateRight); - var difference = Math.abs((0, _index2.default)(dateLeft, dateRight)); - dateLeft.setDate(dateLeft.getDate() - sign * difference); - var isLastDayNotFull = Number(compareLocalAsc(dateLeft, dateRight) === -sign); - var result = sign * (difference - isLastDayNotFull); - return result === 0 ? 0 : result; - } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInMilliseconds/index.js -var require_differenceInMilliseconds = __commonJS({ - "node_modules/date-fns/differenceInMilliseconds/index.js"(exports2, module2) { +// node_modules/date-fns/_lib/getRoundingMethod.js +var require_getRoundingMethod = __commonJS({ + "node_modules/date-fns/_lib/getRoundingMethod.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInMilliseconds; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function differenceInMilliseconds(dateLeft, dateRight) { - (0, _index2.default)(2, arguments); - return (0, _index.default)(dateLeft).getTime() - (0, _index.default)(dateRight).getTime(); + exports2.getRoundingMethod = getRoundingMethod; + function getRoundingMethod(method) { + return (number) => { + const round = method ? Math[method] : Math.trunc; + const result = round(number); + return result === 0 ? 0 : result; + }; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/_lib/roundingMethods/index.js -var require_roundingMethods = __commonJS({ - "node_modules/date-fns/_lib/roundingMethods/index.js"(exports2) { +// node_modules/date-fns/differenceInMilliseconds.js +var require_differenceInMilliseconds = __commonJS({ + "node_modules/date-fns/differenceInMilliseconds.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.getRoundingMethod = getRoundingMethod; - var roundingMap = { - ceil: Math.ceil, - round: Math.round, - floor: Math.floor, - trunc: function trunc(value) { - return value < 0 ? Math.ceil(value) : Math.floor(value); - } - // Math.trunc is not supported by IE - }; - var defaultRoundingMethod = "trunc"; - function getRoundingMethod(method) { - return method ? roundingMap[method] : roundingMap[defaultRoundingMethod]; + exports2.differenceInMilliseconds = differenceInMilliseconds; + var _index = require_toDate(); + function differenceInMilliseconds(dateLeft, dateRight) { + return +(0, _index.toDate)(dateLeft) - +(0, _index.toDate)(dateRight); } } }); -// node_modules/date-fns/differenceInHours/index.js +// node_modules/date-fns/differenceInHours.js var require_differenceInHours = __commonJS({ - "node_modules/date-fns/differenceInHours/index.js"(exports2, module2) { + "node_modules/date-fns/differenceInHours.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInHours; - var _index = require_constants(); - var _index2 = _interopRequireDefault(require_differenceInMilliseconds()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var _index4 = require_roundingMethods(); + exports2.differenceInHours = differenceInHours; + var _index = require_getRoundingMethod(); + var _index2 = require_constants(); + var _index3 = require_differenceInMilliseconds(); function differenceInHours(dateLeft, dateRight, options) { - (0, _index3.default)(2, arguments); - var diff = (0, _index2.default)(dateLeft, dateRight) / _index.millisecondsInHour; - return (0, _index4.getRoundingMethod)(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff); + const diff = (0, _index3.differenceInMilliseconds)(dateLeft, dateRight) / _index2.millisecondsInHour; + return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subISOWeekYears/index.js +// node_modules/date-fns/subISOWeekYears.js var require_subISOWeekYears = __commonJS({ - "node_modules/date-fns/subISOWeekYears/index.js"(exports2, module2) { + "node_modules/date-fns/subISOWeekYears.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subISOWeekYears; - var _index = _interopRequireDefault(require_addISOWeekYears()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); - function subISOWeekYears(dirtyDate, dirtyAmount) { - (0, _index2.default)(2, arguments); - var amount = (0, _index3.default)(dirtyAmount); - return (0, _index.default)(dirtyDate, -amount); + exports2.subISOWeekYears = subISOWeekYears; + var _index = require_addISOWeekYears(); + function subISOWeekYears(date, amount) { + return (0, _index.addISOWeekYears)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInISOWeekYears/index.js +// node_modules/date-fns/differenceInISOWeekYears.js var require_differenceInISOWeekYears = __commonJS({ - "node_modules/date-fns/differenceInISOWeekYears/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInISOWeekYears; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_differenceInCalendarISOWeekYears()); - var _index3 = _interopRequireDefault(require_compareAsc()); - var _index4 = _interopRequireDefault(require_subISOWeekYears()); - var _index5 = _interopRequireDefault(require_requiredArgs()); - function differenceInISOWeekYears(dirtyDateLeft, dirtyDateRight) { - (0, _index5.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - var sign = (0, _index3.default)(dateLeft, dateRight); - var difference = Math.abs((0, _index2.default)(dateLeft, dateRight)); - dateLeft = (0, _index4.default)(dateLeft, sign * difference); - var isLastISOWeekYearNotFull = Number((0, _index3.default)(dateLeft, dateRight) === -sign); - var result = sign * (difference - isLastISOWeekYearNotFull); + "node_modules/date-fns/differenceInISOWeekYears.js"(exports2) { + "use strict"; + exports2.differenceInISOWeekYears = differenceInISOWeekYears; + var _index = require_compareAsc(); + var _index2 = require_differenceInCalendarISOWeekYears(); + var _index3 = require_subISOWeekYears(); + var _index4 = require_toDate(); + function differenceInISOWeekYears(dateLeft, dateRight) { + let _dateLeft = (0, _index4.toDate)(dateLeft); + const _dateRight = (0, _index4.toDate)(dateRight); + const sign = (0, _index.compareAsc)(_dateLeft, _dateRight); + const difference = Math.abs( + (0, _index2.differenceInCalendarISOWeekYears)(_dateLeft, _dateRight) + ); + _dateLeft = (0, _index3.subISOWeekYears)(_dateLeft, sign * difference); + const isLastISOWeekYearNotFull = Number( + (0, _index.compareAsc)(_dateLeft, _dateRight) === -sign + ); + const result = sign * (difference - isLastISOWeekYearNotFull); return result === 0 ? 0 : result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInMinutes/index.js +// node_modules/date-fns/differenceInMinutes.js var require_differenceInMinutes = __commonJS({ - "node_modules/date-fns/differenceInMinutes/index.js"(exports2, module2) { + "node_modules/date-fns/differenceInMinutes.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInMinutes; - var _index = require_constants(); - var _index2 = _interopRequireDefault(require_differenceInMilliseconds()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var _index4 = require_roundingMethods(); + exports2.differenceInMinutes = differenceInMinutes; + var _index = require_getRoundingMethod(); + var _index2 = require_constants(); + var _index3 = require_differenceInMilliseconds(); function differenceInMinutes(dateLeft, dateRight, options) { - (0, _index3.default)(2, arguments); - var diff = (0, _index2.default)(dateLeft, dateRight) / _index.millisecondsInMinute; - return (0, _index4.getRoundingMethod)(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff); + const diff = (0, _index3.differenceInMilliseconds)(dateLeft, dateRight) / _index2.millisecondsInMinute; + return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfDay/index.js +// node_modules/date-fns/endOfDay.js var require_endOfDay = __commonJS({ - "node_modules/date-fns/endOfDay/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfDay; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function endOfDay(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - date.setHours(23, 59, 59, 999); - return date; + "node_modules/date-fns/endOfDay.js"(exports2) { + "use strict"; + exports2.endOfDay = endOfDay; + var _index = require_toDate(); + function endOfDay(date) { + const _date = (0, _index.toDate)(date); + _date.setHours(23, 59, 59, 999); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfMonth/index.js +// node_modules/date-fns/endOfMonth.js var require_endOfMonth = __commonJS({ - "node_modules/date-fns/endOfMonth/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfMonth; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function endOfMonth(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var month = date.getMonth(); - date.setFullYear(date.getFullYear(), month + 1, 0); - date.setHours(23, 59, 59, 999); - return date; + "node_modules/date-fns/endOfMonth.js"(exports2) { + "use strict"; + exports2.endOfMonth = endOfMonth; + var _index = require_toDate(); + function endOfMonth(date) { + const _date = (0, _index.toDate)(date); + const month = _date.getMonth(); + _date.setFullYear(_date.getFullYear(), month + 1, 0); + _date.setHours(23, 59, 59, 999); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isLastDayOfMonth/index.js +// node_modules/date-fns/isLastDayOfMonth.js var require_isLastDayOfMonth = __commonJS({ - "node_modules/date-fns/isLastDayOfMonth/index.js"(exports2, module2) { + "node_modules/date-fns/isLastDayOfMonth.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isLastDayOfMonth; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_endOfDay()); - var _index3 = _interopRequireDefault(require_endOfMonth()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function isLastDayOfMonth(dirtyDate) { - (0, _index4.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - return (0, _index2.default)(date).getTime() === (0, _index3.default)(date).getTime(); + exports2.isLastDayOfMonth = isLastDayOfMonth; + var _index = require_endOfDay(); + var _index2 = require_endOfMonth(); + var _index3 = require_toDate(); + function isLastDayOfMonth(date) { + const _date = (0, _index3.toDate)(date); + return +(0, _index.endOfDay)(_date) === +(0, _index2.endOfMonth)(_date); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInMonths/index.js +// node_modules/date-fns/differenceInMonths.js var require_differenceInMonths = __commonJS({ - "node_modules/date-fns/differenceInMonths/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInMonths; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_differenceInCalendarMonths()); - var _index3 = _interopRequireDefault(require_compareAsc()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var _index5 = _interopRequireDefault(require_isLastDayOfMonth()); - function differenceInMonths(dirtyDateLeft, dirtyDateRight) { - (0, _index4.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - var sign = (0, _index3.default)(dateLeft, dateRight); - var difference = Math.abs((0, _index2.default)(dateLeft, dateRight)); - var result; + "node_modules/date-fns/differenceInMonths.js"(exports2) { + "use strict"; + exports2.differenceInMonths = differenceInMonths; + var _index = require_compareAsc(); + var _index2 = require_differenceInCalendarMonths(); + var _index3 = require_isLastDayOfMonth(); + var _index4 = require_toDate(); + function differenceInMonths(dateLeft, dateRight) { + const _dateLeft = (0, _index4.toDate)(dateLeft); + const _dateRight = (0, _index4.toDate)(dateRight); + const sign = (0, _index.compareAsc)(_dateLeft, _dateRight); + const difference = Math.abs( + (0, _index2.differenceInCalendarMonths)(_dateLeft, _dateRight) + ); + let result; if (difference < 1) { result = 0; } else { - if (dateLeft.getMonth() === 1 && dateLeft.getDate() > 27) { - dateLeft.setDate(30); + if (_dateLeft.getMonth() === 1 && _dateLeft.getDate() > 27) { + _dateLeft.setDate(30); } - dateLeft.setMonth(dateLeft.getMonth() - sign * difference); - var isLastMonthNotFull = (0, _index3.default)(dateLeft, dateRight) === -sign; - if ((0, _index5.default)((0, _index.default)(dirtyDateLeft)) && difference === 1 && (0, _index3.default)(dirtyDateLeft, dateRight) === 1) { + _dateLeft.setMonth(_dateLeft.getMonth() - sign * difference); + let isLastMonthNotFull = (0, _index.compareAsc)(_dateLeft, _dateRight) === -sign; + if ((0, _index3.isLastDayOfMonth)((0, _index4.toDate)(dateLeft)) && difference === 1 && (0, _index.compareAsc)(dateLeft, _dateRight) === 1) { isLastMonthNotFull = false; } result = sign * (difference - Number(isLastMonthNotFull)); } return result === 0 ? 0 : result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInQuarters/index.js +// node_modules/date-fns/differenceInQuarters.js var require_differenceInQuarters = __commonJS({ - "node_modules/date-fns/differenceInQuarters/index.js"(exports2, module2) { + "node_modules/date-fns/differenceInQuarters.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInQuarters; - var _index = _interopRequireDefault(require_differenceInMonths()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = require_roundingMethods(); + exports2.differenceInQuarters = differenceInQuarters; + var _index = require_getRoundingMethod(); + var _index2 = require_differenceInMonths(); function differenceInQuarters(dateLeft, dateRight, options) { - (0, _index2.default)(2, arguments); - var diff = (0, _index.default)(dateLeft, dateRight) / 3; - return (0, _index3.getRoundingMethod)(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff); + const diff = (0, _index2.differenceInMonths)(dateLeft, dateRight) / 3; + return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInSeconds/index.js +// node_modules/date-fns/differenceInSeconds.js var require_differenceInSeconds = __commonJS({ - "node_modules/date-fns/differenceInSeconds/index.js"(exports2, module2) { + "node_modules/date-fns/differenceInSeconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInSeconds; - var _index = _interopRequireDefault(require_differenceInMilliseconds()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = require_roundingMethods(); + exports2.differenceInSeconds = differenceInSeconds; + var _index = require_getRoundingMethod(); + var _index2 = require_differenceInMilliseconds(); function differenceInSeconds(dateLeft, dateRight, options) { - (0, _index2.default)(2, arguments); - var diff = (0, _index.default)(dateLeft, dateRight) / 1e3; - return (0, _index3.getRoundingMethod)(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff); + const diff = (0, _index2.differenceInMilliseconds)(dateLeft, dateRight) / 1e3; + return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInWeeks/index.js +// node_modules/date-fns/differenceInWeeks.js var require_differenceInWeeks = __commonJS({ - "node_modules/date-fns/differenceInWeeks/index.js"(exports2, module2) { + "node_modules/date-fns/differenceInWeeks.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInWeeks; - var _index = _interopRequireDefault(require_differenceInDays()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = require_roundingMethods(); + exports2.differenceInWeeks = differenceInWeeks; + var _index = require_getRoundingMethod(); + var _index2 = require_differenceInDays(); function differenceInWeeks(dateLeft, dateRight, options) { - (0, _index2.default)(2, arguments); - var diff = (0, _index.default)(dateLeft, dateRight) / 7; - return (0, _index3.getRoundingMethod)(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff); + const diff = (0, _index2.differenceInDays)(dateLeft, dateRight) / 7; + return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInYears/index.js +// node_modules/date-fns/differenceInYears.js var require_differenceInYears = __commonJS({ - "node_modules/date-fns/differenceInYears/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = differenceInYears; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_differenceInCalendarYears()); - var _index3 = _interopRequireDefault(require_compareAsc()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function differenceInYears(dirtyDateLeft, dirtyDateRight) { - (0, _index4.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - var sign = (0, _index3.default)(dateLeft, dateRight); - var difference = Math.abs((0, _index2.default)(dateLeft, dateRight)); - dateLeft.setFullYear(1584); - dateRight.setFullYear(1584); - var isLastYearNotFull = (0, _index3.default)(dateLeft, dateRight) === -sign; - var result = sign * (difference - Number(isLastYearNotFull)); + "node_modules/date-fns/differenceInYears.js"(exports2) { + "use strict"; + exports2.differenceInYears = differenceInYears; + var _index = require_compareAsc(); + var _index2 = require_differenceInCalendarYears(); + var _index3 = require_toDate(); + function differenceInYears(dateLeft, dateRight) { + const _dateLeft = (0, _index3.toDate)(dateLeft); + const _dateRight = (0, _index3.toDate)(dateRight); + const sign = (0, _index.compareAsc)(_dateLeft, _dateRight); + const difference = Math.abs( + (0, _index2.differenceInCalendarYears)(_dateLeft, _dateRight) + ); + _dateLeft.setFullYear(1584); + _dateRight.setFullYear(1584); + const isLastYearNotFull = (0, _index.compareAsc)(_dateLeft, _dateRight) === -sign; + const result = sign * (difference - +isLastYearNotFull); return result === 0 ? 0 : result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/eachDayOfInterval/index.js +// node_modules/date-fns/eachDayOfInterval.js var require_eachDayOfInterval = __commonJS({ - "node_modules/date-fns/eachDayOfInterval/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachDayOfInterval; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function eachDayOfInterval(dirtyInterval, options) { - var _options$step; - (0, _index2.default)(1, arguments); - var interval = dirtyInterval || {}; - var startDate = (0, _index.default)(interval.start); - var endDate = (0, _index.default)(interval.end); - var endTime = endDate.getTime(); - if (!(startDate.getTime() <= endTime)) { - throw new RangeError("Invalid interval"); - } - var dates = []; - var currentDate = startDate; + "node_modules/date-fns/eachDayOfInterval.js"(exports2) { + "use strict"; + exports2.eachDayOfInterval = eachDayOfInterval; + var _index = require_toDate(); + function eachDayOfInterval(interval, options) { + const startDate = (0, _index.toDate)(interval.start); + const endDate = (0, _index.toDate)(interval.end); + let reversed = +startDate > +endDate; + const endTime = reversed ? +startDate : +endDate; + const currentDate = reversed ? endDate : startDate; currentDate.setHours(0, 0, 0, 0); - var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1); - if (step < 1 || isNaN(step)) - throw new RangeError("`options.step` must be a number greater than 1"); - while (currentDate.getTime() <= endTime) { - dates.push((0, _index.default)(currentDate)); + let step = options?.step ?? 1; + if (!step) + return []; + if (step < 0) { + step = -step; + reversed = !reversed; + } + const dates = []; + while (+currentDate <= endTime) { + dates.push((0, _index.toDate)(currentDate)); currentDate.setDate(currentDate.getDate() + step); currentDate.setHours(0, 0, 0, 0); } - return dates; + return reversed ? dates.reverse() : dates; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/eachHourOfInterval/index.js +// node_modules/date-fns/eachHourOfInterval.js var require_eachHourOfInterval = __commonJS({ - "node_modules/date-fns/eachHourOfInterval/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachHourOfInterval; - var _index = _interopRequireDefault(require_addHours()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function eachHourOfInterval(dirtyInterval, options) { - var _options$step; - (0, _index3.default)(1, arguments); - var interval = dirtyInterval || {}; - var startDate = (0, _index2.default)(interval.start); - var endDate = (0, _index2.default)(interval.end); - var startTime = startDate.getTime(); - var endTime = endDate.getTime(); - if (!(startTime <= endTime)) { - throw new RangeError("Invalid interval"); - } - var dates = []; - var currentDate = startDate; + "node_modules/date-fns/eachHourOfInterval.js"(exports2) { + "use strict"; + exports2.eachHourOfInterval = eachHourOfInterval; + var _index = require_addHours(); + var _index2 = require_toDate(); + function eachHourOfInterval(interval, options) { + const startDate = (0, _index2.toDate)(interval.start); + const endDate = (0, _index2.toDate)(interval.end); + let reversed = +startDate > +endDate; + const endTime = reversed ? +startDate : +endDate; + let currentDate = reversed ? endDate : startDate; currentDate.setMinutes(0, 0, 0); - var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1); - if (step < 1 || isNaN(step)) - throw new RangeError("`options.step` must be a number greater than 1"); - while (currentDate.getTime() <= endTime) { - dates.push((0, _index2.default)(currentDate)); - currentDate = (0, _index.default)(currentDate, step); + let step = options?.step ?? 1; + if (!step) + return []; + if (step < 0) { + step = -step; + reversed = !reversed; + } + const dates = []; + while (+currentDate <= endTime) { + dates.push((0, _index2.toDate)(currentDate)); + currentDate = (0, _index.addHours)(currentDate, step); } - return dates; + return reversed ? dates.reverse() : dates; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfMinute/index.js +// node_modules/date-fns/startOfMinute.js var require_startOfMinute = __commonJS({ - "node_modules/date-fns/startOfMinute/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfMinute; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfMinute(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - date.setSeconds(0, 0); - return date; + "node_modules/date-fns/startOfMinute.js"(exports2) { + "use strict"; + exports2.startOfMinute = startOfMinute; + var _index = require_toDate(); + function startOfMinute(date) { + const _date = (0, _index.toDate)(date); + _date.setSeconds(0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/eachMinuteOfInterval/index.js +// node_modules/date-fns/eachMinuteOfInterval.js var require_eachMinuteOfInterval = __commonJS({ - "node_modules/date-fns/eachMinuteOfInterval/index.js"(exports2, module2) { + "node_modules/date-fns/eachMinuteOfInterval.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachMinuteOfInterval; - var _index = _interopRequireDefault(require_addMinutes()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_startOfMinute()); - var _index4 = _interopRequireDefault(require_requiredArgs()); + exports2.eachMinuteOfInterval = eachMinuteOfInterval; + var _index = require_addMinutes(); + var _index2 = require_startOfMinute(); + var _index3 = require_toDate(); function eachMinuteOfInterval(interval, options) { - var _options$step; - (0, _index4.default)(1, arguments); - var startDate = (0, _index3.default)((0, _index2.default)(interval.start)); - var endDate = (0, _index2.default)(interval.end); - var startTime = startDate.getTime(); - var endTime = endDate.getTime(); - if (startTime >= endTime) { - throw new RangeError("Invalid interval"); + const startDate = (0, _index2.startOfMinute)( + (0, _index3.toDate)(interval.start) + ); + const endDate = (0, _index3.toDate)(interval.end); + let reversed = +startDate > +endDate; + const endTime = reversed ? +startDate : +endDate; + let currentDate = reversed ? endDate : startDate; + let step = options?.step ?? 1; + if (!step) + return []; + if (step < 0) { + step = -step; + reversed = !reversed; } - var dates = []; - var currentDate = startDate; - var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1); - if (step < 1 || isNaN(step)) - throw new RangeError("`options.step` must be a number equal to or greater than 1"); - while (currentDate.getTime() <= endTime) { - dates.push((0, _index2.default)(currentDate)); - currentDate = (0, _index.default)(currentDate, step); + const dates = []; + while (+currentDate <= endTime) { + dates.push((0, _index3.toDate)(currentDate)); + currentDate = (0, _index.addMinutes)(currentDate, step); } - return dates; + return reversed ? dates.reverse() : dates; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/eachMonthOfInterval/index.js +// node_modules/date-fns/eachMonthOfInterval.js var require_eachMonthOfInterval = __commonJS({ - "node_modules/date-fns/eachMonthOfInterval/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachMonthOfInterval; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function eachMonthOfInterval(dirtyInterval) { - (0, _index2.default)(1, arguments); - var interval = dirtyInterval || {}; - var startDate = (0, _index.default)(interval.start); - var endDate = (0, _index.default)(interval.end); - var endTime = endDate.getTime(); - var dates = []; - if (!(startDate.getTime() <= endTime)) { - throw new RangeError("Invalid interval"); - } - var currentDate = startDate; + "node_modules/date-fns/eachMonthOfInterval.js"(exports2) { + "use strict"; + exports2.eachMonthOfInterval = eachMonthOfInterval; + var _index = require_toDate(); + function eachMonthOfInterval(interval, options) { + const startDate = (0, _index.toDate)(interval.start); + const endDate = (0, _index.toDate)(interval.end); + let reversed = +startDate > +endDate; + const endTime = reversed ? +startDate : +endDate; + const currentDate = reversed ? endDate : startDate; currentDate.setHours(0, 0, 0, 0); currentDate.setDate(1); - while (currentDate.getTime() <= endTime) { - dates.push((0, _index.default)(currentDate)); - currentDate.setMonth(currentDate.getMonth() + 1); + let step = options?.step ?? 1; + if (!step) + return []; + if (step < 0) { + step = -step; + reversed = !reversed; } - return dates; + const dates = []; + while (+currentDate <= endTime) { + dates.push((0, _index.toDate)(currentDate)); + currentDate.setMonth(currentDate.getMonth() + step); + } + return reversed ? dates.reverse() : dates; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfQuarter/index.js +// node_modules/date-fns/startOfQuarter.js var require_startOfQuarter = __commonJS({ - "node_modules/date-fns/startOfQuarter/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfQuarter; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfQuarter(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var currentMonth = date.getMonth(); - var month = currentMonth - currentMonth % 3; - date.setMonth(month, 1); - date.setHours(0, 0, 0, 0); - return date; + "node_modules/date-fns/startOfQuarter.js"(exports2) { + "use strict"; + exports2.startOfQuarter = startOfQuarter; + var _index = require_toDate(); + function startOfQuarter(date) { + const _date = (0, _index.toDate)(date); + const currentMonth = _date.getMonth(); + const month = currentMonth - currentMonth % 3; + _date.setMonth(month, 1); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/eachQuarterOfInterval/index.js +// node_modules/date-fns/eachQuarterOfInterval.js var require_eachQuarterOfInterval = __commonJS({ - "node_modules/date-fns/eachQuarterOfInterval/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachQuarterOfInterval; - var _index = _interopRequireDefault(require_addQuarters()); - var _index2 = _interopRequireDefault(require_startOfQuarter()); - var _index3 = _interopRequireDefault(require_toDate()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function eachQuarterOfInterval(dirtyInterval) { - (0, _index4.default)(1, arguments); - var interval = dirtyInterval || {}; - var startDate = (0, _index3.default)(interval.start); - var endDate = (0, _index3.default)(interval.end); - var endTime = endDate.getTime(); - if (!(startDate.getTime() <= endTime)) { - throw new RangeError("Invalid interval"); - } - var startDateQuarter = (0, _index2.default)(startDate); - var endDateQuarter = (0, _index2.default)(endDate); - endTime = endDateQuarter.getTime(); - var quarters = []; - var currentQuarter = startDateQuarter; - while (currentQuarter.getTime() <= endTime) { - quarters.push((0, _index3.default)(currentQuarter)); - currentQuarter = (0, _index.default)(currentQuarter, 1); - } - return quarters; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/eachWeekOfInterval/index.js + "node_modules/date-fns/eachQuarterOfInterval.js"(exports2) { + "use strict"; + exports2.eachQuarterOfInterval = eachQuarterOfInterval; + var _index = require_addQuarters(); + var _index2 = require_startOfQuarter(); + var _index3 = require_toDate(); + function eachQuarterOfInterval(interval, options) { + const startDate = (0, _index3.toDate)(interval.start); + const endDate = (0, _index3.toDate)(interval.end); + let reversed = +startDate > +endDate; + const endTime = reversed ? +(0, _index2.startOfQuarter)(startDate) : +(0, _index2.startOfQuarter)(endDate); + let currentDate = reversed ? (0, _index2.startOfQuarter)(endDate) : (0, _index2.startOfQuarter)(startDate); + let step = options?.step ?? 1; + if (!step) + return []; + if (step < 0) { + step = -step; + reversed = !reversed; + } + const dates = []; + while (+currentDate <= endTime) { + dates.push((0, _index3.toDate)(currentDate)); + currentDate = (0, _index.addQuarters)(currentDate, step); + } + return reversed ? dates.reverse() : dates; + } + } +}); + +// node_modules/date-fns/eachWeekOfInterval.js var require_eachWeekOfInterval = __commonJS({ - "node_modules/date-fns/eachWeekOfInterval/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachWeekOfInterval; - var _index = _interopRequireDefault(require_addWeeks()); - var _index2 = _interopRequireDefault(require_startOfWeek()); - var _index3 = _interopRequireDefault(require_toDate()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function eachWeekOfInterval(dirtyInterval, options) { - (0, _index4.default)(1, arguments); - var interval = dirtyInterval || {}; - var startDate = (0, _index3.default)(interval.start); - var endDate = (0, _index3.default)(interval.end); - var endTime = endDate.getTime(); - if (!(startDate.getTime() <= endTime)) { - throw new RangeError("Invalid interval"); - } - var startDateWeek = (0, _index2.default)(startDate, options); - var endDateWeek = (0, _index2.default)(endDate, options); + "node_modules/date-fns/eachWeekOfInterval.js"(exports2) { + "use strict"; + exports2.eachWeekOfInterval = eachWeekOfInterval; + var _index = require_addWeeks(); + var _index2 = require_startOfWeek(); + var _index3 = require_toDate(); + function eachWeekOfInterval(interval, options) { + const startDate = (0, _index3.toDate)(interval.start); + const endDate = (0, _index3.toDate)(interval.end); + let reversed = +startDate > +endDate; + const startDateWeek = reversed ? (0, _index2.startOfWeek)(endDate, options) : (0, _index2.startOfWeek)(startDate, options); + const endDateWeek = reversed ? (0, _index2.startOfWeek)(startDate, options) : (0, _index2.startOfWeek)(endDate, options); startDateWeek.setHours(15); endDateWeek.setHours(15); - endTime = endDateWeek.getTime(); - var weeks = []; - var currentWeek = startDateWeek; - while (currentWeek.getTime() <= endTime) { - currentWeek.setHours(0); - weeks.push((0, _index3.default)(currentWeek)); - currentWeek = (0, _index.default)(currentWeek, 1); - currentWeek.setHours(15); + const endTime = +endDateWeek.getTime(); + let currentDate = startDateWeek; + let step = options?.step ?? 1; + if (!step) + return []; + if (step < 0) { + step = -step; + reversed = !reversed; + } + const dates = []; + while (+currentDate <= endTime) { + currentDate.setHours(0); + dates.push((0, _index3.toDate)(currentDate)); + currentDate = (0, _index.addWeeks)(currentDate, step); + currentDate.setHours(15); } - return weeks; + return reversed ? dates.reverse() : dates; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/eachWeekendOfInterval/index.js +// node_modules/date-fns/eachWeekendOfInterval.js var require_eachWeekendOfInterval = __commonJS({ - "node_modules/date-fns/eachWeekendOfInterval/index.js"(exports2, module2) { + "node_modules/date-fns/eachWeekendOfInterval.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachWeekendOfInterval; - var _index = _interopRequireDefault(require_eachDayOfInterval()); - var _index2 = _interopRequireDefault(require_isSunday()); - var _index3 = _interopRequireDefault(require_isWeekend()); - var _index4 = _interopRequireDefault(require_requiredArgs()); + exports2.eachWeekendOfInterval = eachWeekendOfInterval; + var _index = require_eachDayOfInterval(); + var _index2 = require_isWeekend(); function eachWeekendOfInterval(interval) { - (0, _index4.default)(1, arguments); - var dateInterval = (0, _index.default)(interval); - var weekends = []; - var index = 0; + const dateInterval = (0, _index.eachDayOfInterval)(interval); + const weekends = []; + let index = 0; while (index < dateInterval.length) { - var date = dateInterval[index++]; - if ((0, _index3.default)(date)) { + const date = dateInterval[index++]; + if ((0, _index2.isWeekend)(date)) weekends.push(date); - if ((0, _index2.default)(date)) - index = index + 5; - } } return weekends; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfMonth/index.js +// node_modules/date-fns/startOfMonth.js var require_startOfMonth = __commonJS({ - "node_modules/date-fns/startOfMonth/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfMonth; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfMonth(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - date.setDate(1); - date.setHours(0, 0, 0, 0); - return date; + "node_modules/date-fns/startOfMonth.js"(exports2) { + "use strict"; + exports2.startOfMonth = startOfMonth; + var _index = require_toDate(); + function startOfMonth(date) { + const _date = (0, _index.toDate)(date); + _date.setDate(1); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/eachWeekendOfMonth/index.js +// node_modules/date-fns/eachWeekendOfMonth.js var require_eachWeekendOfMonth = __commonJS({ - "node_modules/date-fns/eachWeekendOfMonth/index.js"(exports2, module2) { + "node_modules/date-fns/eachWeekendOfMonth.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachWeekendOfMonth; - var _index = _interopRequireDefault(require_eachWeekendOfInterval()); - var _index2 = _interopRequireDefault(require_startOfMonth()); - var _index3 = _interopRequireDefault(require_endOfMonth()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function eachWeekendOfMonth(dirtyDate) { - (0, _index4.default)(1, arguments); - var startDate = (0, _index2.default)(dirtyDate); - if (isNaN(startDate.getTime())) - throw new RangeError("The passed date is invalid"); - var endDate = (0, _index3.default)(dirtyDate); - return (0, _index.default)({ - start: startDate, - end: endDate - }); + exports2.eachWeekendOfMonth = eachWeekendOfMonth; + var _index = require_eachWeekendOfInterval(); + var _index2 = require_endOfMonth(); + var _index3 = require_startOfMonth(); + function eachWeekendOfMonth(date) { + const start = (0, _index3.startOfMonth)(date); + const end = (0, _index2.endOfMonth)(date); + return (0, _index.eachWeekendOfInterval)({ start, end }); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfYear/index.js +// node_modules/date-fns/endOfYear.js var require_endOfYear = __commonJS({ - "node_modules/date-fns/endOfYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function endOfYear(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getFullYear(); - date.setFullYear(year + 1, 0, 0); - date.setHours(23, 59, 59, 999); - return date; + "node_modules/date-fns/endOfYear.js"(exports2) { + "use strict"; + exports2.endOfYear = endOfYear; + var _index = require_toDate(); + function endOfYear(date) { + const _date = (0, _index.toDate)(date); + const year = _date.getFullYear(); + _date.setFullYear(year + 1, 0, 0); + _date.setHours(23, 59, 59, 999); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfYear/index.js +// node_modules/date-fns/startOfYear.js var require_startOfYear = __commonJS({ - "node_modules/date-fns/startOfYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfYear(dirtyDate) { - (0, _index2.default)(1, arguments); - var cleanDate = (0, _index.default)(dirtyDate); - var date = /* @__PURE__ */ new Date(0); - date.setFullYear(cleanDate.getFullYear(), 0, 1); - date.setHours(0, 0, 0, 0); - return date; + "node_modules/date-fns/startOfYear.js"(exports2) { + "use strict"; + exports2.startOfYear = startOfYear; + var _index = require_toDate(); + var _index2 = require_constructFrom(); + function startOfYear(date) { + const cleanDate = (0, _index.toDate)(date); + const _date = (0, _index2.constructFrom)(date, 0); + _date.setFullYear(cleanDate.getFullYear(), 0, 1); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/eachWeekendOfYear/index.js +// node_modules/date-fns/eachWeekendOfYear.js var require_eachWeekendOfYear = __commonJS({ - "node_modules/date-fns/eachWeekendOfYear/index.js"(exports2, module2) { + "node_modules/date-fns/eachWeekendOfYear.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachWeekendOfYear; - var _index = _interopRequireDefault(require_eachWeekendOfInterval()); - var _index2 = _interopRequireDefault(require_endOfYear()); - var _index3 = _interopRequireDefault(require_startOfYear()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function eachWeekendOfYear(dirtyDate) { - (0, _index4.default)(1, arguments); - var startDate = (0, _index3.default)(dirtyDate); - var endDate = (0, _index2.default)(dirtyDate); - return (0, _index.default)({ - start: startDate, - end: endDate - }); + exports2.eachWeekendOfYear = eachWeekendOfYear; + var _index = require_eachWeekendOfInterval(); + var _index2 = require_endOfYear(); + var _index3 = require_startOfYear(); + function eachWeekendOfYear(date) { + const start = (0, _index3.startOfYear)(date); + const end = (0, _index2.endOfYear)(date); + return (0, _index.eachWeekendOfInterval)({ start, end }); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/eachYearOfInterval/index.js +// node_modules/date-fns/eachYearOfInterval.js var require_eachYearOfInterval = __commonJS({ - "node_modules/date-fns/eachYearOfInterval/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = eachYearOfInterval; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function eachYearOfInterval(dirtyInterval) { - (0, _index2.default)(1, arguments); - var interval = dirtyInterval || {}; - var startDate = (0, _index.default)(interval.start); - var endDate = (0, _index.default)(interval.end); - var endTime = endDate.getTime(); - if (!(startDate.getTime() <= endTime)) { - throw new RangeError("Invalid interval"); - } - var dates = []; - var currentDate = startDate; + "node_modules/date-fns/eachYearOfInterval.js"(exports2) { + "use strict"; + exports2.eachYearOfInterval = eachYearOfInterval; + var _index = require_toDate(); + function eachYearOfInterval(interval, options) { + const startDate = (0, _index.toDate)(interval.start); + const endDate = (0, _index.toDate)(interval.end); + let reversed = +startDate > +endDate; + const endTime = reversed ? +startDate : +endDate; + const currentDate = reversed ? endDate : startDate; currentDate.setHours(0, 0, 0, 0); currentDate.setMonth(0, 1); - while (currentDate.getTime() <= endTime) { - dates.push((0, _index.default)(currentDate)); - currentDate.setFullYear(currentDate.getFullYear() + 1); + let step = options?.step ?? 1; + if (!step) + return []; + if (step < 0) { + step = -step; + reversed = !reversed; + } + const dates = []; + while (+currentDate <= endTime) { + dates.push((0, _index.toDate)(currentDate)); + currentDate.setFullYear(currentDate.getFullYear() + step); } - return dates; + return reversed ? dates.reverse() : dates; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfDecade/index.js +// node_modules/date-fns/endOfDecade.js var require_endOfDecade = __commonJS({ - "node_modules/date-fns/endOfDecade/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfDecade; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function endOfDecade(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getFullYear(); - var decade = 9 + Math.floor(year / 10) * 10; - date.setFullYear(decade, 11, 31); - date.setHours(23, 59, 59, 999); - return date; + "node_modules/date-fns/endOfDecade.js"(exports2) { + "use strict"; + exports2.endOfDecade = endOfDecade; + var _index = require_toDate(); + function endOfDecade(date) { + const _date = (0, _index.toDate)(date); + const year = _date.getFullYear(); + const decade = 9 + Math.floor(year / 10) * 10; + _date.setFullYear(decade, 11, 31); + _date.setHours(23, 59, 59, 999); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfHour/index.js +// node_modules/date-fns/endOfHour.js var require_endOfHour = __commonJS({ - "node_modules/date-fns/endOfHour/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfHour; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function endOfHour(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - date.setMinutes(59, 59, 999); - return date; + "node_modules/date-fns/endOfHour.js"(exports2) { + "use strict"; + exports2.endOfHour = endOfHour; + var _index = require_toDate(); + function endOfHour(date) { + const _date = (0, _index.toDate)(date); + _date.setMinutes(59, 59, 999); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfWeek/index.js +// node_modules/date-fns/endOfWeek.js var require_endOfWeek = __commonJS({ - "node_modules/date-fns/endOfWeek/index.js"(exports2, module2) { + "node_modules/date-fns/endOfWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfWeek; - var _index = require_defaultOptions(); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_toInteger()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function endOfWeek(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index4.default)(1, arguments); - var defaultOptions = (0, _index.getDefaultOptions)(); - var weekStartsOn = (0, _index3.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - var date = (0, _index2.default)(dirtyDate); - var day = date.getDay(); - var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); - date.setDate(date.getDate() + diff); - date.setHours(23, 59, 59, 999); - return date; + exports2.endOfWeek = endOfWeek; + var _index = require_toDate(); + var _index2 = require_defaultOptions(); + function endOfWeek(date, options) { + const defaultOptions = (0, _index2.getDefaultOptions)(); + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; + const _date = (0, _index.toDate)(date); + const day = _date.getDay(); + const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); + _date.setDate(_date.getDate() + diff); + _date.setHours(23, 59, 59, 999); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfISOWeek/index.js +// node_modules/date-fns/endOfISOWeek.js var require_endOfISOWeek = __commonJS({ - "node_modules/date-fns/endOfISOWeek/index.js"(exports2, module2) { + "node_modules/date-fns/endOfISOWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfISOWeek; - var _index = _interopRequireDefault(require_endOfWeek()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function endOfISOWeek(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate, { - weekStartsOn: 1 - }); + exports2.endOfISOWeek = endOfISOWeek; + var _index = require_endOfWeek(); + function endOfISOWeek(date) { + return (0, _index.endOfWeek)(date, { weekStartsOn: 1 }); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfISOWeekYear/index.js +// node_modules/date-fns/endOfISOWeekYear.js var require_endOfISOWeekYear = __commonJS({ - "node_modules/date-fns/endOfISOWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfISOWeekYear; - var _index = _interopRequireDefault(require_getISOWeekYear()); - var _index2 = _interopRequireDefault(require_startOfISOWeek()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function endOfISOWeekYear(dirtyDate) { - (0, _index3.default)(1, arguments); - var year = (0, _index.default)(dirtyDate); - var fourthOfJanuaryOfNextYear = /* @__PURE__ */ new Date(0); + "node_modules/date-fns/endOfISOWeekYear.js"(exports2) { + "use strict"; + exports2.endOfISOWeekYear = endOfISOWeekYear; + var _index = require_getISOWeekYear(); + var _index2 = require_startOfISOWeek(); + var _index3 = require_constructFrom(); + function endOfISOWeekYear(date) { + const year = (0, _index.getISOWeekYear)(date); + const fourthOfJanuaryOfNextYear = (0, _index3.constructFrom)(date, 0); fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); - var date = (0, _index2.default)(fourthOfJanuaryOfNextYear); - date.setMilliseconds(date.getMilliseconds() - 1); - return date; + const _date = (0, _index2.startOfISOWeek)(fourthOfJanuaryOfNextYear); + _date.setMilliseconds(_date.getMilliseconds() - 1); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfMinute/index.js +// node_modules/date-fns/endOfMinute.js var require_endOfMinute = __commonJS({ - "node_modules/date-fns/endOfMinute/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfMinute; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function endOfMinute(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - date.setSeconds(59, 999); - return date; + "node_modules/date-fns/endOfMinute.js"(exports2) { + "use strict"; + exports2.endOfMinute = endOfMinute; + var _index = require_toDate(); + function endOfMinute(date) { + const _date = (0, _index.toDate)(date); + _date.setSeconds(59, 999); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfQuarter/index.js +// node_modules/date-fns/endOfQuarter.js var require_endOfQuarter = __commonJS({ - "node_modules/date-fns/endOfQuarter/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfQuarter; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function endOfQuarter(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var currentMonth = date.getMonth(); - var month = currentMonth - currentMonth % 3 + 3; - date.setMonth(month, 0); - date.setHours(23, 59, 59, 999); - return date; + "node_modules/date-fns/endOfQuarter.js"(exports2) { + "use strict"; + exports2.endOfQuarter = endOfQuarter; + var _index = require_toDate(); + function endOfQuarter(date) { + const _date = (0, _index.toDate)(date); + const currentMonth = _date.getMonth(); + const month = currentMonth - currentMonth % 3 + 3; + _date.setMonth(month, 0); + _date.setHours(23, 59, 59, 999); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfSecond/index.js +// node_modules/date-fns/endOfSecond.js var require_endOfSecond = __commonJS({ - "node_modules/date-fns/endOfSecond/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfSecond; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function endOfSecond(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - date.setMilliseconds(999); - return date; + "node_modules/date-fns/endOfSecond.js"(exports2) { + "use strict"; + exports2.endOfSecond = endOfSecond; + var _index = require_toDate(); + function endOfSecond(date) { + const _date = (0, _index.toDate)(date); + _date.setMilliseconds(999); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfToday/index.js +// node_modules/date-fns/endOfToday.js var require_endOfToday = __commonJS({ - "node_modules/date-fns/endOfToday/index.js"(exports2, module2) { + "node_modules/date-fns/endOfToday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfToday; - var _index = _interopRequireDefault(require_endOfDay()); + exports2.endOfToday = endOfToday; + var _index = require_endOfDay(); function endOfToday() { - return (0, _index.default)(Date.now()); + return (0, _index.endOfDay)(Date.now()); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfTomorrow/index.js +// node_modules/date-fns/endOfTomorrow.js var require_endOfTomorrow = __commonJS({ - "node_modules/date-fns/endOfTomorrow/index.js"(exports2, module2) { + "node_modules/date-fns/endOfTomorrow.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfTomorrow; + exports2.endOfTomorrow = endOfTomorrow; function endOfTomorrow() { - var now = /* @__PURE__ */ new Date(); - var year = now.getFullYear(); - var month = now.getMonth(); - var day = now.getDate(); - var date = /* @__PURE__ */ new Date(0); + const now = /* @__PURE__ */ new Date(); + const year = now.getFullYear(); + const month = now.getMonth(); + const day = now.getDate(); + const date = /* @__PURE__ */ new Date(0); date.setFullYear(year, month, day + 1); date.setHours(23, 59, 59, 999); return date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfYesterday/index.js +// node_modules/date-fns/endOfYesterday.js var require_endOfYesterday = __commonJS({ - "node_modules/date-fns/endOfYesterday/index.js"(exports2, module2) { + "node_modules/date-fns/endOfYesterday.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = endOfYesterday; + exports2.endOfYesterday = endOfYesterday; function endOfYesterday() { - var now = /* @__PURE__ */ new Date(); - var year = now.getFullYear(); - var month = now.getMonth(); - var day = now.getDate(); - var date = /* @__PURE__ */ new Date(0); + const now = /* @__PURE__ */ new Date(); + const year = now.getFullYear(); + const month = now.getMonth(); + const day = now.getDate(); + const date = /* @__PURE__ */ new Date(0); date.setFullYear(year, month, day - 1); date.setHours(23, 59, 59, 999); return date; } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/subMilliseconds/index.js -var require_subMilliseconds = __commonJS({ - "node_modules/date-fns/subMilliseconds/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subMilliseconds; - var _index = _interopRequireDefault(require_addMilliseconds()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); - function subMilliseconds(dirtyDate, dirtyAmount) { - (0, _index2.default)(2, arguments); - var amount = (0, _index3.default)(dirtyAmount); - return (0, _index.default)(dirtyDate, -amount); - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/getUTCDayOfYear/index.js -var require_getUTCDayOfYear = __commonJS({ - "node_modules/date-fns/_lib/getUTCDayOfYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getUTCDayOfYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_DAY = 864e5; - function getUTCDayOfYear(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var timestamp = date.getTime(); - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); - var startOfYearTimestamp = date.getTime(); - var difference = timestamp - startOfYearTimestamp; - return Math.floor(difference / MILLISECONDS_IN_DAY) + 1; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/startOfUTCISOWeek/index.js -var require_startOfUTCISOWeek = __commonJS({ - "node_modules/date-fns/_lib/startOfUTCISOWeek/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfUTCISOWeek; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfUTCISOWeek(dirtyDate) { - (0, _index2.default)(1, arguments); - var weekStartsOn = 1; - var date = (0, _index.default)(dirtyDate); - var day = date.getUTCDay(); - var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; - date.setUTCDate(date.getUTCDate() - diff); - date.setUTCHours(0, 0, 0, 0); - return date; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/getUTCISOWeekYear/index.js -var require_getUTCISOWeekYear = __commonJS({ - "node_modules/date-fns/_lib/getUTCISOWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getUTCISOWeekYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_startOfUTCISOWeek()); - function getUTCISOWeekYear(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getUTCFullYear(); - var fourthOfJanuaryOfNextYear = /* @__PURE__ */ new Date(0); - fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4); - fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0); - var startOfNextYear = (0, _index3.default)(fourthOfJanuaryOfNextYear); - var fourthOfJanuaryOfThisYear = /* @__PURE__ */ new Date(0); - fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4); - fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0); - var startOfThisYear = (0, _index3.default)(fourthOfJanuaryOfThisYear); - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; - } - } - module2.exports = exports2.default; } }); -// node_modules/date-fns/_lib/startOfUTCISOWeekYear/index.js -var require_startOfUTCISOWeekYear = __commonJS({ - "node_modules/date-fns/_lib/startOfUTCISOWeekYear/index.js"(exports2, module2) { +// node_modules/date-fns/locale/en-US/_lib/formatDistance.js +var require_formatDistance = __commonJS({ + "node_modules/date-fns/locale/en-US/_lib/formatDistance.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfUTCISOWeekYear; - var _index = _interopRequireDefault(require_getUTCISOWeekYear()); - var _index2 = _interopRequireDefault(require_startOfUTCISOWeek()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function startOfUTCISOWeekYear(dirtyDate) { - (0, _index3.default)(1, arguments); - var year = (0, _index.default)(dirtyDate); - var fourthOfJanuary = /* @__PURE__ */ new Date(0); - fourthOfJanuary.setUTCFullYear(year, 0, 4); - fourthOfJanuary.setUTCHours(0, 0, 0, 0); - var date = (0, _index2.default)(fourthOfJanuary); - return date; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/getUTCISOWeek/index.js -var require_getUTCISOWeek = __commonJS({ - "node_modules/date-fns/_lib/getUTCISOWeek/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getUTCISOWeek; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_startOfUTCISOWeek()); - var _index3 = _interopRequireDefault(require_startOfUTCISOWeekYear()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_WEEK = 6048e5; - function getUTCISOWeek(dirtyDate) { - (0, _index4.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var diff = (0, _index2.default)(date).getTime() - (0, _index3.default)(date).getTime(); - return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/startOfUTCWeek/index.js -var require_startOfUTCWeek = __commonJS({ - "node_modules/date-fns/_lib/startOfUTCWeek/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfUTCWeek; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); - var _index4 = require_defaultOptions(); - function startOfUTCWeek(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index2.default)(1, arguments); - var defaultOptions = (0, _index4.getDefaultOptions)(); - var weekStartsOn = (0, _index3.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - var date = (0, _index.default)(dirtyDate); - var day = date.getUTCDay(); - var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; - date.setUTCDate(date.getUTCDate() - diff); - date.setUTCHours(0, 0, 0, 0); - return date; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/getUTCWeekYear/index.js -var require_getUTCWeekYear = __commonJS({ - "node_modules/date-fns/_lib/getUTCWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getUTCWeekYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_startOfUTCWeek()); - var _index4 = _interopRequireDefault(require_toInteger()); - var _index5 = require_defaultOptions(); - function getUTCWeekYear(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getUTCFullYear(); - var defaultOptions = (0, _index5.getDefaultOptions)(); - var firstWeekContainsDate = (0, _index4.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); - } - var firstWeekOfNextYear = /* @__PURE__ */ new Date(0); - firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate); - firstWeekOfNextYear.setUTCHours(0, 0, 0, 0); - var startOfNextYear = (0, _index3.default)(firstWeekOfNextYear, options); - var firstWeekOfThisYear = /* @__PURE__ */ new Date(0); - firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate); - firstWeekOfThisYear.setUTCHours(0, 0, 0, 0); - var startOfThisYear = (0, _index3.default)(firstWeekOfThisYear, options); - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; + exports2.formatDistance = void 0; + var formatDistanceLocale = { + lessThanXSeconds: { + one: "less than a second", + other: "less than {{count}} seconds" + }, + xSeconds: { + one: "1 second", + other: "{{count}} seconds" + }, + halfAMinute: "half a minute", + lessThanXMinutes: { + one: "less than a minute", + other: "less than {{count}} minutes" + }, + xMinutes: { + one: "1 minute", + other: "{{count}} minutes" + }, + aboutXHours: { + one: "about 1 hour", + other: "about {{count}} hours" + }, + xHours: { + one: "1 hour", + other: "{{count}} hours" + }, + xDays: { + one: "1 day", + other: "{{count}} days" + }, + aboutXWeeks: { + one: "about 1 week", + other: "about {{count}} weeks" + }, + xWeeks: { + one: "1 week", + other: "{{count}} weeks" + }, + aboutXMonths: { + one: "about 1 month", + other: "about {{count}} months" + }, + xMonths: { + one: "1 month", + other: "{{count}} months" + }, + aboutXYears: { + one: "about 1 year", + other: "about {{count}} years" + }, + xYears: { + one: "1 year", + other: "{{count}} years" + }, + overXYears: { + one: "over 1 year", + other: "over {{count}} years" + }, + almostXYears: { + one: "almost 1 year", + other: "almost {{count}} years" + } + }; + var formatDistance = (token, count, options) => { + let result; + const tokenValue = formatDistanceLocale[token]; + if (typeof tokenValue === "string") { + result = tokenValue; + } else if (count === 1) { + result = tokenValue.one; } else { - return year - 1; + result = tokenValue.other.replace("{{count}}", count.toString()); } - } - module2.exports = exports2.default; + if (options?.addSuffix) { + if (options.comparison && options.comparison > 0) { + return "in " + result; + } else { + return result + " ago"; + } + } + return result; + }; + exports2.formatDistance = formatDistance; } }); -// node_modules/date-fns/_lib/startOfUTCWeekYear/index.js -var require_startOfUTCWeekYear = __commonJS({ - "node_modules/date-fns/_lib/startOfUTCWeekYear/index.js"(exports2, module2) { +// node_modules/date-fns/locale/_lib/buildFormatLongFn.js +var require_buildFormatLongFn = __commonJS({ + "node_modules/date-fns/locale/_lib/buildFormatLongFn.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfUTCWeekYear; - var _index = _interopRequireDefault(require_getUTCWeekYear()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_startOfUTCWeek()); - var _index4 = _interopRequireDefault(require_toInteger()); - var _index5 = require_defaultOptions(); - function startOfUTCWeekYear(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index2.default)(1, arguments); - var defaultOptions = (0, _index5.getDefaultOptions)(); - var firstWeekContainsDate = (0, _index4.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - var year = (0, _index.default)(dirtyDate, options); - var firstWeek = /* @__PURE__ */ new Date(0); - firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate); - firstWeek.setUTCHours(0, 0, 0, 0); - var date = (0, _index3.default)(firstWeek, options); - return date; + exports2.buildFormatLongFn = buildFormatLongFn; + function buildFormatLongFn(args) { + return (options = {}) => { + const width = options.width ? String(options.width) : args.defaultWidth; + const format = args.formats[width] || args.formats[args.defaultWidth]; + return format; + }; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/_lib/getUTCWeek/index.js -var require_getUTCWeek = __commonJS({ - "node_modules/date-fns/_lib/getUTCWeek/index.js"(exports2, module2) { +// node_modules/date-fns/locale/en-US/_lib/formatLong.js +var require_formatLong = __commonJS({ + "node_modules/date-fns/locale/en-US/_lib/formatLong.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getUTCWeek; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_startOfUTCWeek()); - var _index3 = _interopRequireDefault(require_startOfUTCWeekYear()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_WEEK = 6048e5; - function getUTCWeek(dirtyDate, options) { - (0, _index4.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var diff = (0, _index2.default)(date, options).getTime() - (0, _index3.default)(date, options).getTime(); - return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; - } - module2.exports = exports2.default; + exports2.formatLong = void 0; + var _index = require_buildFormatLongFn(); + var dateFormats = { + full: "EEEE, MMMM do, y", + long: "MMMM do, y", + medium: "MMM d, y", + short: "MM/dd/yyyy" + }; + var timeFormats = { + full: "h:mm:ss a zzzz", + long: "h:mm:ss a z", + medium: "h:mm:ss a", + short: "h:mm a" + }; + var dateTimeFormats = { + full: "{{date}} 'at' {{time}}", + long: "{{date}} 'at' {{time}}", + medium: "{{date}}, {{time}}", + short: "{{date}}, {{time}}" + }; + var formatLong = exports2.formatLong = { + date: (0, _index.buildFormatLongFn)({ + formats: dateFormats, + defaultWidth: "full" + }), + time: (0, _index.buildFormatLongFn)({ + formats: timeFormats, + defaultWidth: "full" + }), + dateTime: (0, _index.buildFormatLongFn)({ + formats: dateTimeFormats, + defaultWidth: "full" + }) + }; } }); -// node_modules/date-fns/_lib/addLeadingZeros/index.js -var require_addLeadingZeros = __commonJS({ - "node_modules/date-fns/_lib/addLeadingZeros/index.js"(exports2, module2) { +// node_modules/date-fns/locale/en-US/_lib/formatRelative.js +var require_formatRelative = __commonJS({ + "node_modules/date-fns/locale/en-US/_lib/formatRelative.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = addLeadingZeros; - function addLeadingZeros(number, targetLength) { - var sign = number < 0 ? "-" : ""; - var output = Math.abs(number).toString(); - while (output.length < targetLength) { - output = "0" + output; - } - return sign + output; - } - module2.exports = exports2.default; + exports2.formatRelative = void 0; + var formatRelativeLocale = { + lastWeek: "'last' eeee 'at' p", + yesterday: "'yesterday at' p", + today: "'today at' p", + tomorrow: "'tomorrow at' p", + nextWeek: "eeee 'at' p", + other: "P" + }; + var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token]; + exports2.formatRelative = formatRelative; } }); -// node_modules/date-fns/_lib/format/lightFormatters/index.js -var require_lightFormatters = __commonJS({ - "node_modules/date-fns/_lib/format/lightFormatters/index.js"(exports2, module2) { +// node_modules/date-fns/locale/_lib/buildLocalizeFn.js +var require_buildLocalizeFn = __commonJS({ + "node_modules/date-fns/locale/_lib/buildLocalizeFn.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var _index = _interopRequireDefault(require_addLeadingZeros()); - var formatters = { - // Year - y: function y(date, token) { - var signedYear = date.getUTCFullYear(); - var year = signedYear > 0 ? signedYear : 1 - signedYear; - return (0, _index.default)(token === "yy" ? year % 100 : year, token.length); - }, - // Month - M: function M(date, token) { - var month = date.getUTCMonth(); - return token === "M" ? String(month + 1) : (0, _index.default)(month + 1, 2); - }, - // Day of the month - d: function d(date, token) { - return (0, _index.default)(date.getUTCDate(), token.length); - }, - // AM or PM - a: function a(date, token) { - var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? "pm" : "am"; - switch (token) { - case "a": - case "aa": - return dayPeriodEnumValue.toUpperCase(); - case "aaa": - return dayPeriodEnumValue; - case "aaaaa": - return dayPeriodEnumValue[0]; - case "aaaa": - default: - return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; + exports2.buildLocalizeFn = buildLocalizeFn; + function buildLocalizeFn(args) { + return (value, options) => { + const context = options?.context ? String(options.context) : "standalone"; + let valuesArray; + if (context === "formatting" && args.formattingValues) { + const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; + const width = options?.width ? String(options.width) : defaultWidth; + valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; + } else { + const defaultWidth = args.defaultWidth; + const width = options?.width ? String(options.width) : args.defaultWidth; + valuesArray = args.values[width] || args.values[defaultWidth]; } - }, - // Hour [1-12] - h: function h(date, token) { - return (0, _index.default)(date.getUTCHours() % 12 || 12, token.length); - }, - // Hour [0-23] - H: function H(date, token) { - return (0, _index.default)(date.getUTCHours(), token.length); - }, - // Minute - m: function m(date, token) { - return (0, _index.default)(date.getUTCMinutes(), token.length); - }, - // Second - s: function s(date, token) { - return (0, _index.default)(date.getUTCSeconds(), token.length); - }, - // Fraction of second - S: function S(date, token) { - var numberOfDigits = token.length; - var milliseconds = date.getUTCMilliseconds(); - var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3)); - return (0, _index.default)(fractionalSeconds, token.length); - } - }; - var _default = formatters; - exports2.default = _default; - module2.exports = exports2.default; + const index = args.argumentCallback ? args.argumentCallback(value) : value; + return valuesArray[index]; + }; + } } }); -// node_modules/date-fns/_lib/format/formatters/index.js -var require_formatters = __commonJS({ - "node_modules/date-fns/_lib/format/formatters/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var _index = _interopRequireDefault(require_getUTCDayOfYear()); - var _index2 = _interopRequireDefault(require_getUTCISOWeek()); - var _index3 = _interopRequireDefault(require_getUTCISOWeekYear()); - var _index4 = _interopRequireDefault(require_getUTCWeek()); - var _index5 = _interopRequireDefault(require_getUTCWeekYear()); - var _index6 = _interopRequireDefault(require_addLeadingZeros()); - var _index7 = _interopRequireDefault(require_lightFormatters()); - var dayPeriodEnum = { - am: "am", - pm: "pm", - midnight: "midnight", - noon: "noon", - morning: "morning", - afternoon: "afternoon", - evening: "evening", - night: "night" +// node_modules/date-fns/locale/en-US/_lib/localize.js +var require_localize = __commonJS({ + "node_modules/date-fns/locale/en-US/_lib/localize.js"(exports2) { + "use strict"; + exports2.localize = void 0; + var _index = require_buildLocalizeFn(); + var eraValues = { + narrow: ["B", "A"], + abbreviated: ["BC", "AD"], + wide: ["Before Christ", "Anno Domini"] }; - var formatters = { - // Era - G: function G(date, token, localize) { - var era = date.getUTCFullYear() > 0 ? 1 : 0; - switch (token) { - case "G": - case "GG": - case "GGG": - return localize.era(era, { - width: "abbreviated" - }); - case "GGGGG": - return localize.era(era, { - width: "narrow" - }); - case "GGGG": - default: - return localize.era(era, { - width: "wide" - }); - } + var quarterValues = { + narrow: ["1", "2", "3", "4"], + abbreviated: ["Q1", "Q2", "Q3", "Q4"], + wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] + }; + var monthValues = { + narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], + abbreviated: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ], + wide: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ] + }; + var dayValues = { + narrow: ["S", "M", "T", "W", "T", "F", "S"], + short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], + abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + wide: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + ] + }; + var dayPeriodValues = { + narrow: { + am: "a", + pm: "p", + midnight: "mi", + noon: "n", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" }, - // Year - y: function y(date, token, localize) { - if (token === "yo") { - var signedYear = date.getUTCFullYear(); - var year = signedYear > 0 ? signedYear : 1 - signedYear; - return localize.ordinalNumber(year, { - unit: "year" - }); - } - return _index7.default.y(date, token); + abbreviated: { + am: "AM", + pm: "PM", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" }, - // Local week-numbering year - Y: function Y(date, token, localize, options) { - var signedWeekYear = (0, _index5.default)(date, options); - var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; + wide: { + am: "a.m.", + pm: "p.m.", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" + } + }; + var formattingDayPeriodValues = { + narrow: { + am: "a", + pm: "p", + midnight: "mi", + noon: "n", + morning: "in the morning", + afternoon: "in the afternoon", + evening: "in the evening", + night: "at night" + }, + abbreviated: { + am: "AM", + pm: "PM", + midnight: "midnight", + noon: "noon", + morning: "in the morning", + afternoon: "in the afternoon", + evening: "in the evening", + night: "at night" + }, + wide: { + am: "a.m.", + pm: "p.m.", + midnight: "midnight", + noon: "noon", + morning: "in the morning", + afternoon: "in the afternoon", + evening: "in the evening", + night: "at night" + } + }; + var ordinalNumber = (dirtyNumber, _options) => { + const number = Number(dirtyNumber); + const rem100 = number % 100; + if (rem100 > 20 || rem100 < 10) { + switch (rem100 % 10) { + case 1: + return number + "st"; + case 2: + return number + "nd"; + case 3: + return number + "rd"; + } + } + return number + "th"; + }; + var localize = exports2.localize = { + ordinalNumber, + era: (0, _index.buildLocalizeFn)({ + values: eraValues, + defaultWidth: "wide" + }), + quarter: (0, _index.buildLocalizeFn)({ + values: quarterValues, + defaultWidth: "wide", + argumentCallback: (quarter) => quarter - 1 + }), + month: (0, _index.buildLocalizeFn)({ + values: monthValues, + defaultWidth: "wide" + }), + day: (0, _index.buildLocalizeFn)({ + values: dayValues, + defaultWidth: "wide" + }), + dayPeriod: (0, _index.buildLocalizeFn)({ + values: dayPeriodValues, + defaultWidth: "wide", + formattingValues: formattingDayPeriodValues, + defaultFormattingWidth: "wide" + }) + }; + } +}); + +// node_modules/date-fns/locale/_lib/buildMatchFn.js +var require_buildMatchFn = __commonJS({ + "node_modules/date-fns/locale/_lib/buildMatchFn.js"(exports2) { + "use strict"; + exports2.buildMatchFn = buildMatchFn; + function buildMatchFn(args) { + return (string, options = {}) => { + const width = options.width; + const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; + const matchResult = string.match(matchPattern); + if (!matchResult) { + return null; + } + const matchedString = matchResult[0]; + const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; + const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type + findKey(parsePatterns, (pattern) => pattern.test(matchedString)) + ); + let value; + value = args.valueCallback ? args.valueCallback(key) : key; + value = options.valueCallback ? ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type + options.valueCallback(value) + ) : value; + const rest = string.slice(matchedString.length); + return { value, rest }; + }; + } + function findKey(object, predicate) { + for (const key in object) { + if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) { + return key; + } + } + return void 0; + } + function findIndex(array, predicate) { + for (let key = 0; key < array.length; key++) { + if (predicate(array[key])) { + return key; + } + } + return void 0; + } + } +}); + +// node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +var require_buildMatchPatternFn = __commonJS({ + "node_modules/date-fns/locale/_lib/buildMatchPatternFn.js"(exports2) { + "use strict"; + exports2.buildMatchPatternFn = buildMatchPatternFn; + function buildMatchPatternFn(args) { + return (string, options = {}) => { + const matchResult = string.match(args.matchPattern); + if (!matchResult) + return null; + const matchedString = matchResult[0]; + const parseResult = string.match(args.parsePattern); + if (!parseResult) + return null; + let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; + value = options.valueCallback ? options.valueCallback(value) : value; + const rest = string.slice(matchedString.length); + return { value, rest }; + }; + } + } +}); + +// node_modules/date-fns/locale/en-US/_lib/match.js +var require_match = __commonJS({ + "node_modules/date-fns/locale/en-US/_lib/match.js"(exports2) { + "use strict"; + exports2.match = void 0; + var _index = require_buildMatchFn(); + var _index2 = require_buildMatchPatternFn(); + var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; + var parseOrdinalNumberPattern = /\d+/i; + var matchEraPatterns = { + narrow: /^(b|a)/i, + abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, + wide: /^(before christ|before common era|anno domini|common era)/i + }; + var parseEraPatterns = { + any: [/^b/i, /^(a|c)/i] + }; + var matchQuarterPatterns = { + narrow: /^[1234]/i, + abbreviated: /^q[1234]/i, + wide: /^[1234](th|st|nd|rd)? quarter/i + }; + var parseQuarterPatterns = { + any: [/1/i, /2/i, /3/i, /4/i] + }; + var matchMonthPatterns = { + narrow: /^[jfmasond]/i, + abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, + wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i + }; + var parseMonthPatterns = { + narrow: [ + /^j/i, + /^f/i, + /^m/i, + /^a/i, + /^m/i, + /^j/i, + /^j/i, + /^a/i, + /^s/i, + /^o/i, + /^n/i, + /^d/i + ], + any: [ + /^ja/i, + /^f/i, + /^mar/i, + /^ap/i, + /^may/i, + /^jun/i, + /^jul/i, + /^au/i, + /^s/i, + /^o/i, + /^n/i, + /^d/i + ] + }; + var matchDayPatterns = { + narrow: /^[smtwf]/i, + short: /^(su|mo|tu|we|th|fr|sa)/i, + abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, + wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i + }; + var parseDayPatterns = { + narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], + any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] + }; + var matchDayPeriodPatterns = { + narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, + any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i + }; + var parseDayPeriodPatterns = { + any: { + am: /^a/i, + pm: /^p/i, + midnight: /^mi/i, + noon: /^no/i, + morning: /morning/i, + afternoon: /afternoon/i, + evening: /evening/i, + night: /night/i + } + }; + var match = exports2.match = { + ordinalNumber: (0, _index2.buildMatchPatternFn)({ + matchPattern: matchOrdinalNumberPattern, + parsePattern: parseOrdinalNumberPattern, + valueCallback: (value) => parseInt(value, 10) + }), + era: (0, _index.buildMatchFn)({ + matchPatterns: matchEraPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseEraPatterns, + defaultParseWidth: "any" + }), + quarter: (0, _index.buildMatchFn)({ + matchPatterns: matchQuarterPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseQuarterPatterns, + defaultParseWidth: "any", + valueCallback: (index) => index + 1 + }), + month: (0, _index.buildMatchFn)({ + matchPatterns: matchMonthPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseMonthPatterns, + defaultParseWidth: "any" + }), + day: (0, _index.buildMatchFn)({ + matchPatterns: matchDayPatterns, + defaultMatchWidth: "wide", + parsePatterns: parseDayPatterns, + defaultParseWidth: "any" + }), + dayPeriod: (0, _index.buildMatchFn)({ + matchPatterns: matchDayPeriodPatterns, + defaultMatchWidth: "any", + parsePatterns: parseDayPeriodPatterns, + defaultParseWidth: "any" + }) + }; + } +}); + +// node_modules/date-fns/locale/en-US.js +var require_en_US = __commonJS({ + "node_modules/date-fns/locale/en-US.js"(exports2) { + "use strict"; + exports2.enUS = void 0; + var _index = require_formatDistance(); + var _index2 = require_formatLong(); + var _index3 = require_formatRelative(); + var _index4 = require_localize(); + var _index5 = require_match(); + var enUS = exports2.enUS = { + code: "en-US", + formatDistance: _index.formatDistance, + formatLong: _index2.formatLong, + formatRelative: _index3.formatRelative, + localize: _index4.localize, + match: _index5.match, + options: { + weekStartsOn: 0, + firstWeekContainsDate: 1 + } + }; + } +}); + +// node_modules/date-fns/_lib/defaultLocale.js +var require_defaultLocale = __commonJS({ + "node_modules/date-fns/_lib/defaultLocale.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "defaultLocale", { + enumerable: true, + get: function() { + return _index.enUS; + } + }); + var _index = require_en_US(); + } +}); + +// node_modules/date-fns/getDayOfYear.js +var require_getDayOfYear = __commonJS({ + "node_modules/date-fns/getDayOfYear.js"(exports2) { + "use strict"; + exports2.getDayOfYear = getDayOfYear; + var _index = require_differenceInCalendarDays(); + var _index2 = require_startOfYear(); + var _index3 = require_toDate(); + function getDayOfYear(date) { + const _date = (0, _index3.toDate)(date); + const diff = (0, _index.differenceInCalendarDays)( + _date, + (0, _index2.startOfYear)(_date) + ); + const dayOfYear = diff + 1; + return dayOfYear; + } + } +}); + +// node_modules/date-fns/getISOWeek.js +var require_getISOWeek = __commonJS({ + "node_modules/date-fns/getISOWeek.js"(exports2) { + "use strict"; + exports2.getISOWeek = getISOWeek; + var _index = require_constants(); + var _index2 = require_startOfISOWeek(); + var _index3 = require_startOfISOWeekYear(); + var _index4 = require_toDate(); + function getISOWeek(date) { + const _date = (0, _index4.toDate)(date); + const diff = +(0, _index2.startOfISOWeek)(_date) - +(0, _index3.startOfISOWeekYear)(_date); + return Math.round(diff / _index.millisecondsInWeek) + 1; + } + } +}); + +// node_modules/date-fns/getWeekYear.js +var require_getWeekYear = __commonJS({ + "node_modules/date-fns/getWeekYear.js"(exports2) { + "use strict"; + exports2.getWeekYear = getWeekYear; + var _index = require_constructFrom(); + var _index2 = require_startOfWeek(); + var _index3 = require_toDate(); + var _index4 = require_defaultOptions(); + function getWeekYear(date, options) { + const _date = (0, _index3.toDate)(date); + const year = _date.getFullYear(); + const defaultOptions = (0, _index4.getDefaultOptions)(); + const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; + const firstWeekOfNextYear = (0, _index.constructFrom)(date, 0); + firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); + firstWeekOfNextYear.setHours(0, 0, 0, 0); + const startOfNextYear = (0, _index2.startOfWeek)( + firstWeekOfNextYear, + options + ); + const firstWeekOfThisYear = (0, _index.constructFrom)(date, 0); + firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); + firstWeekOfThisYear.setHours(0, 0, 0, 0); + const startOfThisYear = (0, _index2.startOfWeek)( + firstWeekOfThisYear, + options + ); + if (_date.getTime() >= startOfNextYear.getTime()) { + return year + 1; + } else if (_date.getTime() >= startOfThisYear.getTime()) { + return year; + } else { + return year - 1; + } + } + } +}); + +// node_modules/date-fns/startOfWeekYear.js +var require_startOfWeekYear = __commonJS({ + "node_modules/date-fns/startOfWeekYear.js"(exports2) { + "use strict"; + exports2.startOfWeekYear = startOfWeekYear; + var _index = require_constructFrom(); + var _index2 = require_getWeekYear(); + var _index3 = require_startOfWeek(); + var _index4 = require_defaultOptions(); + function startOfWeekYear(date, options) { + const defaultOptions = (0, _index4.getDefaultOptions)(); + const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; + const year = (0, _index2.getWeekYear)(date, options); + const firstWeek = (0, _index.constructFrom)(date, 0); + firstWeek.setFullYear(year, 0, firstWeekContainsDate); + firstWeek.setHours(0, 0, 0, 0); + const _date = (0, _index3.startOfWeek)(firstWeek, options); + return _date; + } + } +}); + +// node_modules/date-fns/getWeek.js +var require_getWeek = __commonJS({ + "node_modules/date-fns/getWeek.js"(exports2) { + "use strict"; + exports2.getWeek = getWeek; + var _index = require_constants(); + var _index2 = require_startOfWeek(); + var _index3 = require_startOfWeekYear(); + var _index4 = require_toDate(); + function getWeek(date, options) { + const _date = (0, _index4.toDate)(date); + const diff = +(0, _index2.startOfWeek)(_date, options) - +(0, _index3.startOfWeekYear)(_date, options); + return Math.round(diff / _index.millisecondsInWeek) + 1; + } + } +}); + +// node_modules/date-fns/_lib/addLeadingZeros.js +var require_addLeadingZeros = __commonJS({ + "node_modules/date-fns/_lib/addLeadingZeros.js"(exports2) { + "use strict"; + exports2.addLeadingZeros = addLeadingZeros; + function addLeadingZeros(number, targetLength) { + const sign = number < 0 ? "-" : ""; + const output = Math.abs(number).toString().padStart(targetLength, "0"); + return sign + output; + } + } +}); + +// node_modules/date-fns/_lib/format/lightFormatters.js +var require_lightFormatters = __commonJS({ + "node_modules/date-fns/_lib/format/lightFormatters.js"(exports2) { + "use strict"; + exports2.lightFormatters = void 0; + var _index = require_addLeadingZeros(); + var lightFormatters = exports2.lightFormatters = { + // Year + y(date, token) { + const signedYear = date.getFullYear(); + const year = signedYear > 0 ? signedYear : 1 - signedYear; + return (0, _index.addLeadingZeros)( + token === "yy" ? year % 100 : year, + token.length + ); + }, + // Month + M(date, token) { + const month = date.getMonth(); + return token === "M" ? String(month + 1) : (0, _index.addLeadingZeros)(month + 1, 2); + }, + // Day of the month + d(date, token) { + return (0, _index.addLeadingZeros)(date.getDate(), token.length); + }, + // AM or PM + a(date, token) { + const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; + switch (token) { + case "a": + case "aa": + return dayPeriodEnumValue.toUpperCase(); + case "aaa": + return dayPeriodEnumValue; + case "aaaaa": + return dayPeriodEnumValue[0]; + case "aaaa": + default: + return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; + } + }, + // Hour [1-12] + h(date, token) { + return (0, _index.addLeadingZeros)( + date.getHours() % 12 || 12, + token.length + ); + }, + // Hour [0-23] + H(date, token) { + return (0, _index.addLeadingZeros)(date.getHours(), token.length); + }, + // Minute + m(date, token) { + return (0, _index.addLeadingZeros)(date.getMinutes(), token.length); + }, + // Second + s(date, token) { + return (0, _index.addLeadingZeros)(date.getSeconds(), token.length); + }, + // Fraction of second + S(date, token) { + const numberOfDigits = token.length; + const milliseconds = date.getMilliseconds(); + const fractionalSeconds = Math.trunc( + milliseconds * Math.pow(10, numberOfDigits - 3) + ); + return (0, _index.addLeadingZeros)(fractionalSeconds, token.length); + } + }; + } +}); + +// node_modules/date-fns/_lib/format/formatters.js +var require_formatters = __commonJS({ + "node_modules/date-fns/_lib/format/formatters.js"(exports2) { + "use strict"; + exports2.formatters = void 0; + var _index = require_getDayOfYear(); + var _index2 = require_getISOWeek(); + var _index3 = require_getISOWeekYear(); + var _index4 = require_getWeek(); + var _index5 = require_getWeekYear(); + var _index6 = require_addLeadingZeros(); + var _index7 = require_lightFormatters(); + var dayPeriodEnum = { + am: "am", + pm: "pm", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" + }; + var formatters = exports2.formatters = { + // Era + G: function(date, token, localize) { + const era = date.getFullYear() > 0 ? 1 : 0; + switch (token) { + case "G": + case "GG": + case "GGG": + return localize.era(era, { width: "abbreviated" }); + case "GGGGG": + return localize.era(era, { width: "narrow" }); + case "GGGG": + default: + return localize.era(era, { width: "wide" }); + } + }, + // Year + y: function(date, token, localize) { + if (token === "yo") { + const signedYear = date.getFullYear(); + const year = signedYear > 0 ? signedYear : 1 - signedYear; + return localize.ordinalNumber(year, { unit: "year" }); + } + return _index7.lightFormatters.y(date, token); + }, + // Local week-numbering year + Y: function(date, token, localize, options) { + const signedWeekYear = (0, _index5.getWeekYear)(date, options); + const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; if (token === "YY") { - var twoDigitYear = weekYear % 100; - return (0, _index6.default)(twoDigitYear, 2); + const twoDigitYear = weekYear % 100; + return (0, _index6.addLeadingZeros)(twoDigitYear, 2); } if (token === "Yo") { - return localize.ordinalNumber(weekYear, { - unit: "year" - }); + return localize.ordinalNumber(weekYear, { unit: "year" }); } - return (0, _index6.default)(weekYear, token.length); + return (0, _index6.addLeadingZeros)(weekYear, token.length); }, // ISO week-numbering year - R: function R(date, token) { - var isoWeekYear = (0, _index3.default)(date); - return (0, _index6.default)(isoWeekYear, token.length); + R: function(date, token) { + const isoWeekYear = (0, _index3.getISOWeekYear)(date); + return (0, _index6.addLeadingZeros)(isoWeekYear, token.length); }, // Extended year. This is a single number designating the year of this calendar system. // The main difference between `y` and `u` localizers are B.C. years: @@ -5394,22 +5135,20 @@ var require_formatters = __commonJS({ // | BC 2 | 2 | -1 | // Also `yy` always returns the last two digits of a year, // while `uu` pads single digit years to 2 characters and returns other years unchanged. - u: function u(date, token) { - var year = date.getUTCFullYear(); - return (0, _index6.default)(year, token.length); + u: function(date, token) { + const year = date.getFullYear(); + return (0, _index6.addLeadingZeros)(year, token.length); }, // Quarter - Q: function Q(date, token, localize) { - var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); + Q: function(date, token, localize) { + const quarter = Math.ceil((date.getMonth() + 1) / 3); switch (token) { case "Q": return String(quarter); case "QQ": - return (0, _index6.default)(quarter, 2); + return (0, _index6.addLeadingZeros)(quarter, 2); case "Qo": - return localize.ordinalNumber(quarter, { - unit: "quarter" - }); + return localize.ordinalNumber(quarter, { unit: "quarter" }); case "QQQ": return localize.quarter(quarter, { width: "abbreviated", @@ -5429,17 +5168,15 @@ var require_formatters = __commonJS({ } }, // Stand-alone quarter - q: function q(date, token, localize) { - var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); + q: function(date, token, localize) { + const quarter = Math.ceil((date.getMonth() + 1) / 3); switch (token) { case "q": return String(quarter); case "qq": - return (0, _index6.default)(quarter, 2); + return (0, _index6.addLeadingZeros)(quarter, 2); case "qo": - return localize.ordinalNumber(quarter, { - unit: "quarter" - }); + return localize.ordinalNumber(quarter, { unit: "quarter" }); case "qqq": return localize.quarter(quarter, { width: "abbreviated", @@ -5459,16 +5196,14 @@ var require_formatters = __commonJS({ } }, // Month - M: function M(date, token, localize) { - var month = date.getUTCMonth(); + M: function(date, token, localize) { + const month = date.getMonth(); switch (token) { case "M": case "MM": - return _index7.default.M(date, token); + return _index7.lightFormatters.M(date, token); case "Mo": - return localize.ordinalNumber(month + 1, { - unit: "month" - }); + return localize.ordinalNumber(month + 1, { unit: "month" }); case "MMM": return localize.month(month, { width: "abbreviated", @@ -5481,24 +5216,19 @@ var require_formatters = __commonJS({ }); case "MMMM": default: - return localize.month(month, { - width: "wide", - context: "formatting" - }); + return localize.month(month, { width: "wide", context: "formatting" }); } }, // Stand-alone month - L: function L(date, token, localize) { - var month = date.getUTCMonth(); + L: function(date, token, localize) { + const month = date.getMonth(); switch (token) { case "L": return String(month + 1); case "LL": - return (0, _index6.default)(month + 1, 2); + return (0, _index6.addLeadingZeros)(month + 1, 2); case "Lo": - return localize.ordinalNumber(month + 1, { - unit: "month" - }); + return localize.ordinalNumber(month + 1, { unit: "month" }); case "LLL": return localize.month(month, { width: "abbreviated", @@ -5511,54 +5241,43 @@ var require_formatters = __commonJS({ }); case "LLLL": default: - return localize.month(month, { - width: "wide", - context: "standalone" - }); + return localize.month(month, { width: "wide", context: "standalone" }); } }, // Local week of year - w: function w(date, token, localize, options) { - var week = (0, _index4.default)(date, options); + w: function(date, token, localize, options) { + const week = (0, _index4.getWeek)(date, options); if (token === "wo") { - return localize.ordinalNumber(week, { - unit: "week" - }); + return localize.ordinalNumber(week, { unit: "week" }); } - return (0, _index6.default)(week, token.length); + return (0, _index6.addLeadingZeros)(week, token.length); }, // ISO week of year - I: function I(date, token, localize) { - var isoWeek = (0, _index2.default)(date); + I: function(date, token, localize) { + const isoWeek = (0, _index2.getISOWeek)(date); if (token === "Io") { - return localize.ordinalNumber(isoWeek, { - unit: "week" - }); + return localize.ordinalNumber(isoWeek, { unit: "week" }); } - return (0, _index6.default)(isoWeek, token.length); + return (0, _index6.addLeadingZeros)(isoWeek, token.length); }, // Day of the month - d: function d(date, token, localize) { + d: function(date, token, localize) { if (token === "do") { - return localize.ordinalNumber(date.getUTCDate(), { - unit: "date" - }); + return localize.ordinalNumber(date.getDate(), { unit: "date" }); } - return _index7.default.d(date, token); + return _index7.lightFormatters.d(date, token); }, // Day of year - D: function D(date, token, localize) { - var dayOfYear = (0, _index.default)(date); + D: function(date, token, localize) { + const dayOfYear = (0, _index.getDayOfYear)(date); if (token === "Do") { - return localize.ordinalNumber(dayOfYear, { - unit: "dayOfYear" - }); + return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); } - return (0, _index6.default)(dayOfYear, token.length); + return (0, _index6.addLeadingZeros)(dayOfYear, token.length); }, // Day of week - E: function E(date, token, localize) { - var dayOfWeek = date.getUTCDay(); + E: function(date, token, localize) { + const dayOfWeek = date.getDay(); switch (token) { case "E": case "EE": @@ -5586,18 +5305,16 @@ var require_formatters = __commonJS({ } }, // Local day of week - e: function e(date, token, localize, options) { - var dayOfWeek = date.getUTCDay(); - var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + e: function(date, token, localize, options) { + const dayOfWeek = date.getDay(); + const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; switch (token) { case "e": return String(localDayOfWeek); case "ee": - return (0, _index6.default)(localDayOfWeek, 2); + return (0, _index6.addLeadingZeros)(localDayOfWeek, 2); case "eo": - return localize.ordinalNumber(localDayOfWeek, { - unit: "day" - }); + return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); case "eee": return localize.day(dayOfWeek, { width: "abbreviated", @@ -5622,18 +5339,16 @@ var require_formatters = __commonJS({ } }, // Stand-alone local day of week - c: function c(date, token, localize, options) { - var dayOfWeek = date.getUTCDay(); - var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + c: function(date, token, localize, options) { + const dayOfWeek = date.getDay(); + const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; switch (token) { case "c": return String(localDayOfWeek); case "cc": - return (0, _index6.default)(localDayOfWeek, token.length); + return (0, _index6.addLeadingZeros)(localDayOfWeek, token.length); case "co": - return localize.ordinalNumber(localDayOfWeek, { - unit: "day" - }); + return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); case "ccc": return localize.day(dayOfWeek, { width: "abbreviated", @@ -5658,18 +5373,16 @@ var require_formatters = __commonJS({ } }, // ISO day of week - i: function i(date, token, localize) { - var dayOfWeek = date.getUTCDay(); - var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; + i: function(date, token, localize) { + const dayOfWeek = date.getDay(); + const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; switch (token) { case "i": return String(isoDayOfWeek); case "ii": - return (0, _index6.default)(isoDayOfWeek, token.length); + return (0, _index6.addLeadingZeros)(isoDayOfWeek, token.length); case "io": - return localize.ordinalNumber(isoDayOfWeek, { - unit: "day" - }); + return localize.ordinalNumber(isoDayOfWeek, { unit: "day" }); case "iii": return localize.day(dayOfWeek, { width: "abbreviated", @@ -5694,9 +5407,9 @@ var require_formatters = __commonJS({ } }, // AM or PM - a: function a(date, token, localize) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; + a: function(date, token, localize) { + const hours = date.getHours(); + const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; switch (token) { case "a": case "aa": @@ -5723,9 +5436,9 @@ var require_formatters = __commonJS({ } }, // AM, PM, midnight, noon - b: function b(date, token, localize) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue; + b: function(date, token, localize) { + const hours = date.getHours(); + let dayPeriodEnumValue; if (hours === 12) { dayPeriodEnumValue = dayPeriodEnum.noon; } else if (hours === 0) { @@ -5759,9 +5472,9 @@ var require_formatters = __commonJS({ } }, // in the morning, in the afternoon, in the evening, at night - B: function B(date, token, localize) { - var hours = date.getUTCHours(); - var dayPeriodEnumValue; + B: function(date, token, localize) { + const hours = date.getHours(); + let dayPeriodEnumValue; if (hours >= 17) { dayPeriodEnumValue = dayPeriodEnum.evening; } else if (hours >= 12) { @@ -5780,1118 +5493,392 @@ var require_formatters = __commonJS({ context: "formatting" }); case "BBBBB": - return localize.dayPeriod(dayPeriodEnumValue, { - width: "narrow", - context: "formatting" - }); - case "BBBB": - default: - return localize.dayPeriod(dayPeriodEnumValue, { - width: "wide", - context: "formatting" - }); - } - }, - // Hour [1-12] - h: function h(date, token, localize) { - if (token === "ho") { - var hours = date.getUTCHours() % 12; - if (hours === 0) - hours = 12; - return localize.ordinalNumber(hours, { - unit: "hour" - }); - } - return _index7.default.h(date, token); - }, - // Hour [0-23] - H: function H(date, token, localize) { - if (token === "Ho") { - return localize.ordinalNumber(date.getUTCHours(), { - unit: "hour" - }); - } - return _index7.default.H(date, token); - }, - // Hour [0-11] - K: function K(date, token, localize) { - var hours = date.getUTCHours() % 12; - if (token === "Ko") { - return localize.ordinalNumber(hours, { - unit: "hour" - }); - } - return (0, _index6.default)(hours, token.length); - }, - // Hour [1-24] - k: function k(date, token, localize) { - var hours = date.getUTCHours(); - if (hours === 0) - hours = 24; - if (token === "ko") { - return localize.ordinalNumber(hours, { - unit: "hour" - }); - } - return (0, _index6.default)(hours, token.length); - }, - // Minute - m: function m(date, token, localize) { - if (token === "mo") { - return localize.ordinalNumber(date.getUTCMinutes(), { - unit: "minute" - }); - } - return _index7.default.m(date, token); - }, - // Second - s: function s(date, token, localize) { - if (token === "so") { - return localize.ordinalNumber(date.getUTCSeconds(), { - unit: "second" - }); - } - return _index7.default.s(date, token); - }, - // Fraction of second - S: function S(date, token) { - return _index7.default.S(date, token); - }, - // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) - X: function X(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - if (timezoneOffset === 0) { - return "Z"; - } - switch (token) { - case "X": - return formatTimezoneWithOptionalMinutes(timezoneOffset); - case "XXXX": - case "XX": - return formatTimezone(timezoneOffset); - case "XXXXX": - case "XXX": - default: - return formatTimezone(timezoneOffset, ":"); - } - }, - // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) - x: function x(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - switch (token) { - case "x": - return formatTimezoneWithOptionalMinutes(timezoneOffset); - case "xxxx": - case "xx": - return formatTimezone(timezoneOffset); - case "xxxxx": - case "xxx": - default: - return formatTimezone(timezoneOffset, ":"); - } - }, - // Timezone (GMT) - O: function O(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - switch (token) { - case "O": - case "OO": - case "OOO": - return "GMT" + formatTimezoneShort(timezoneOffset, ":"); - case "OOOO": - default: - return "GMT" + formatTimezone(timezoneOffset, ":"); - } - }, - // Timezone (specific non-location) - z: function z(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timezoneOffset = originalDate.getTimezoneOffset(); - switch (token) { - case "z": - case "zz": - case "zzz": - return "GMT" + formatTimezoneShort(timezoneOffset, ":"); - case "zzzz": - default: - return "GMT" + formatTimezone(timezoneOffset, ":"); - } - }, - // Seconds timestamp - t: function t(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timestamp = Math.floor(originalDate.getTime() / 1e3); - return (0, _index6.default)(timestamp, token.length); - }, - // Milliseconds timestamp - T: function T(date, token, _localize, options) { - var originalDate = options._originalDate || date; - var timestamp = originalDate.getTime(); - return (0, _index6.default)(timestamp, token.length); - } - }; - function formatTimezoneShort(offset, dirtyDelimiter) { - var sign = offset > 0 ? "-" : "+"; - var absOffset = Math.abs(offset); - var hours = Math.floor(absOffset / 60); - var minutes = absOffset % 60; - if (minutes === 0) { - return sign + String(hours); - } - var delimiter = dirtyDelimiter || ""; - return sign + String(hours) + delimiter + (0, _index6.default)(minutes, 2); - } - function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) { - if (offset % 60 === 0) { - var sign = offset > 0 ? "-" : "+"; - return sign + (0, _index6.default)(Math.abs(offset) / 60, 2); - } - return formatTimezone(offset, dirtyDelimiter); - } - function formatTimezone(offset, dirtyDelimiter) { - var delimiter = dirtyDelimiter || ""; - var sign = offset > 0 ? "-" : "+"; - var absOffset = Math.abs(offset); - var hours = (0, _index6.default)(Math.floor(absOffset / 60), 2); - var minutes = (0, _index6.default)(absOffset % 60, 2); - return sign + hours + delimiter + minutes; - } - var _default = formatters; - exports2.default = _default; - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/format/longFormatters/index.js -var require_longFormatters = __commonJS({ - "node_modules/date-fns/_lib/format/longFormatters/index.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var dateLongFormatter = function dateLongFormatter2(pattern, formatLong) { - switch (pattern) { - case "P": - return formatLong.date({ - width: "short" - }); - case "PP": - return formatLong.date({ - width: "medium" - }); - case "PPP": - return formatLong.date({ - width: "long" - }); - case "PPPP": - default: - return formatLong.date({ - width: "full" - }); - } - }; - var timeLongFormatter = function timeLongFormatter2(pattern, formatLong) { - switch (pattern) { - case "p": - return formatLong.time({ - width: "short" - }); - case "pp": - return formatLong.time({ - width: "medium" - }); - case "ppp": - return formatLong.time({ - width: "long" - }); - case "pppp": - default: - return formatLong.time({ - width: "full" - }); - } - }; - var dateTimeLongFormatter = function dateTimeLongFormatter2(pattern, formatLong) { - var matchResult = pattern.match(/(P+)(p+)?/) || []; - var datePattern = matchResult[1]; - var timePattern = matchResult[2]; - if (!timePattern) { - return dateLongFormatter(pattern, formatLong); - } - var dateTimeFormat; - switch (datePattern) { - case "P": - dateTimeFormat = formatLong.dateTime({ - width: "short" - }); - break; - case "PP": - dateTimeFormat = formatLong.dateTime({ - width: "medium" - }); - break; - case "PPP": - dateTimeFormat = formatLong.dateTime({ - width: "long" - }); - break; - case "PPPP": - default: - dateTimeFormat = formatLong.dateTime({ - width: "full" - }); - break; - } - return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong)); - }; - var longFormatters = { - p: timeLongFormatter, - P: dateTimeLongFormatter - }; - var _default = longFormatters; - exports2.default = _default; - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/protectedTokens/index.js -var require_protectedTokens = __commonJS({ - "node_modules/date-fns/_lib/protectedTokens/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.isProtectedDayOfYearToken = isProtectedDayOfYearToken; - exports2.isProtectedWeekYearToken = isProtectedWeekYearToken; - exports2.throwProtectedError = throwProtectedError; - var protectedDayOfYearTokens = ["D", "DD"]; - var protectedWeekYearTokens = ["YY", "YYYY"]; - function isProtectedDayOfYearToken(token) { - return protectedDayOfYearTokens.indexOf(token) !== -1; - } - function isProtectedWeekYearToken(token) { - return protectedWeekYearTokens.indexOf(token) !== -1; - } - function throwProtectedError(token, format, input) { - if (token === "YYYY") { - throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } else if (token === "YY") { - throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } else if (token === "D") { - throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } else if (token === "DD") { - throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); - } - } - } -}); - -// node_modules/date-fns/locale/en-US/_lib/formatDistance/index.js -var require_formatDistance = __commonJS({ - "node_modules/date-fns/locale/en-US/_lib/formatDistance/index.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var formatDistanceLocale = { - lessThanXSeconds: { - one: "less than a second", - other: "less than {{count}} seconds" - }, - xSeconds: { - one: "1 second", - other: "{{count}} seconds" - }, - halfAMinute: "half a minute", - lessThanXMinutes: { - one: "less than a minute", - other: "less than {{count}} minutes" - }, - xMinutes: { - one: "1 minute", - other: "{{count}} minutes" - }, - aboutXHours: { - one: "about 1 hour", - other: "about {{count}} hours" - }, - xHours: { - one: "1 hour", - other: "{{count}} hours" - }, - xDays: { - one: "1 day", - other: "{{count}} days" - }, - aboutXWeeks: { - one: "about 1 week", - other: "about {{count}} weeks" - }, - xWeeks: { - one: "1 week", - other: "{{count}} weeks" - }, - aboutXMonths: { - one: "about 1 month", - other: "about {{count}} months" - }, - xMonths: { - one: "1 month", - other: "{{count}} months" - }, - aboutXYears: { - one: "about 1 year", - other: "about {{count}} years" + return localize.dayPeriod(dayPeriodEnumValue, { + width: "narrow", + context: "formatting" + }); + case "BBBB": + default: + return localize.dayPeriod(dayPeriodEnumValue, { + width: "wide", + context: "formatting" + }); + } }, - xYears: { - one: "1 year", - other: "{{count}} years" + // Hour [1-12] + h: function(date, token, localize) { + if (token === "ho") { + let hours = date.getHours() % 12; + if (hours === 0) + hours = 12; + return localize.ordinalNumber(hours, { unit: "hour" }); + } + return _index7.lightFormatters.h(date, token); }, - overXYears: { - one: "over 1 year", - other: "over {{count}} years" + // Hour [0-23] + H: function(date, token, localize) { + if (token === "Ho") { + return localize.ordinalNumber(date.getHours(), { unit: "hour" }); + } + return _index7.lightFormatters.H(date, token); }, - almostXYears: { - one: "almost 1 year", - other: "almost {{count}} years" - } - }; - var formatDistance = function formatDistance2(token, count, options) { - var result; - var tokenValue = formatDistanceLocale[token]; - if (typeof tokenValue === "string") { - result = tokenValue; - } else if (count === 1) { - result = tokenValue.one; - } else { - result = tokenValue.other.replace("{{count}}", count.toString()); - } - if (options !== null && options !== void 0 && options.addSuffix) { - if (options.comparison && options.comparison > 0) { - return "in " + result; - } else { - return result + " ago"; + // Hour [0-11] + K: function(date, token, localize) { + const hours = date.getHours() % 12; + if (token === "Ko") { + return localize.ordinalNumber(hours, { unit: "hour" }); } - } - return result; - }; - var _default = formatDistance; - exports2.default = _default; - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/locale/_lib/buildFormatLongFn/index.js -var require_buildFormatLongFn = __commonJS({ - "node_modules/date-fns/locale/_lib/buildFormatLongFn/index.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = buildFormatLongFn; - function buildFormatLongFn(args) { - return function() { - var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; - var width = options.width ? String(options.width) : args.defaultWidth; - var format = args.formats[width] || args.formats[args.defaultWidth]; - return format; - }; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/locale/en-US/_lib/formatLong/index.js -var require_formatLong = __commonJS({ - "node_modules/date-fns/locale/en-US/_lib/formatLong/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var _index = _interopRequireDefault(require_buildFormatLongFn()); - var dateFormats = { - full: "EEEE, MMMM do, y", - long: "MMMM do, y", - medium: "MMM d, y", - short: "MM/dd/yyyy" - }; - var timeFormats = { - full: "h:mm:ss a zzzz", - long: "h:mm:ss a z", - medium: "h:mm:ss a", - short: "h:mm a" - }; - var dateTimeFormats = { - full: "{{date}} 'at' {{time}}", - long: "{{date}} 'at' {{time}}", - medium: "{{date}}, {{time}}", - short: "{{date}}, {{time}}" - }; - var formatLong = { - date: (0, _index.default)({ - formats: dateFormats, - defaultWidth: "full" - }), - time: (0, _index.default)({ - formats: timeFormats, - defaultWidth: "full" - }), - dateTime: (0, _index.default)({ - formats: dateTimeFormats, - defaultWidth: "full" - }) - }; - var _default = formatLong; - exports2.default = _default; - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/locale/en-US/_lib/formatRelative/index.js -var require_formatRelative = __commonJS({ - "node_modules/date-fns/locale/en-US/_lib/formatRelative/index.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var formatRelativeLocale = { - lastWeek: "'last' eeee 'at' p", - yesterday: "'yesterday at' p", - today: "'today at' p", - tomorrow: "'tomorrow at' p", - nextWeek: "eeee 'at' p", - other: "P" - }; - var formatRelative = function formatRelative2(token, _date, _baseDate, _options) { - return formatRelativeLocale[token]; - }; - var _default = formatRelative; - exports2.default = _default; - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/locale/_lib/buildLocalizeFn/index.js -var require_buildLocalizeFn = __commonJS({ - "node_modules/date-fns/locale/_lib/buildLocalizeFn/index.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = buildLocalizeFn; - function buildLocalizeFn(args) { - return function(dirtyIndex, options) { - var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone"; - var valuesArray; - if (context === "formatting" && args.formattingValues) { - var defaultWidth = args.defaultFormattingWidth || args.defaultWidth; - var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth; - valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; - } else { - var _defaultWidth = args.defaultWidth; - var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth; - valuesArray = args.values[_width] || args.values[_defaultWidth]; + return (0, _index6.addLeadingZeros)(hours, token.length); + }, + // Hour [1-24] + k: function(date, token, localize) { + let hours = date.getHours(); + if (hours === 0) + hours = 24; + if (token === "ko") { + return localize.ordinalNumber(hours, { unit: "hour" }); } - var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; - return valuesArray[index]; - }; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/locale/en-US/_lib/localize/index.js -var require_localize = __commonJS({ - "node_modules/date-fns/locale/en-US/_lib/localize/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var _index = _interopRequireDefault(require_buildLocalizeFn()); - var eraValues = { - narrow: ["B", "A"], - abbreviated: ["BC", "AD"], - wide: ["Before Christ", "Anno Domini"] - }; - var quarterValues = { - narrow: ["1", "2", "3", "4"], - abbreviated: ["Q1", "Q2", "Q3", "Q4"], - wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] - }; - var monthValues = { - narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], - abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], - wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] - }; - var dayValues = { - narrow: ["S", "M", "T", "W", "T", "F", "S"], - short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], - abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], - wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] - }; - var dayPeriodValues = { - narrow: { - am: "a", - pm: "p", - midnight: "mi", - noon: "n", - morning: "morning", - afternoon: "afternoon", - evening: "evening", - night: "night" + return (0, _index6.addLeadingZeros)(hours, token.length); }, - abbreviated: { - am: "AM", - pm: "PM", - midnight: "midnight", - noon: "noon", - morning: "morning", - afternoon: "afternoon", - evening: "evening", - night: "night" + // Minute + m: function(date, token, localize) { + if (token === "mo") { + return localize.ordinalNumber(date.getMinutes(), { unit: "minute" }); + } + return _index7.lightFormatters.m(date, token); }, - wide: { - am: "a.m.", - pm: "p.m.", - midnight: "midnight", - noon: "noon", - morning: "morning", - afternoon: "afternoon", - evening: "evening", - night: "night" - } - }; - var formattingDayPeriodValues = { - narrow: { - am: "a", - pm: "p", - midnight: "mi", - noon: "n", - morning: "in the morning", - afternoon: "in the afternoon", - evening: "in the evening", - night: "at night" + // Second + s: function(date, token, localize) { + if (token === "so") { + return localize.ordinalNumber(date.getSeconds(), { unit: "second" }); + } + return _index7.lightFormatters.s(date, token); }, - abbreviated: { - am: "AM", - pm: "PM", - midnight: "midnight", - noon: "noon", - morning: "in the morning", - afternoon: "in the afternoon", - evening: "in the evening", - night: "at night" + // Fraction of second + S: function(date, token) { + return _index7.lightFormatters.S(date, token); }, - wide: { - am: "a.m.", - pm: "p.m.", - midnight: "midnight", - noon: "noon", - morning: "in the morning", - afternoon: "in the afternoon", - evening: "in the evening", - night: "at night" - } - }; - var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) { - var number = Number(dirtyNumber); - var rem100 = number % 100; - if (rem100 > 20 || rem100 < 10) { - switch (rem100 % 10) { - case 1: - return number + "st"; - case 2: - return number + "nd"; - case 3: - return number + "rd"; + // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) + X: function(date, token, _localize) { + const timezoneOffset = date.getTimezoneOffset(); + if (timezoneOffset === 0) { + return "Z"; } - } - return number + "th"; - }; - var localize = { - ordinalNumber, - era: (0, _index.default)({ - values: eraValues, - defaultWidth: "wide" - }), - quarter: (0, _index.default)({ - values: quarterValues, - defaultWidth: "wide", - argumentCallback: function argumentCallback(quarter) { - return quarter - 1; + switch (token) { + case "X": + return formatTimezoneWithOptionalMinutes(timezoneOffset); + case "XXXX": + case "XX": + return formatTimezone(timezoneOffset); + case "XXXXX": + case "XXX": + default: + return formatTimezone(timezoneOffset, ":"); + } + }, + // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) + x: function(date, token, _localize) { + const timezoneOffset = date.getTimezoneOffset(); + switch (token) { + case "x": + return formatTimezoneWithOptionalMinutes(timezoneOffset); + case "xxxx": + case "xx": + return formatTimezone(timezoneOffset); + case "xxxxx": + case "xxx": + default: + return formatTimezone(timezoneOffset, ":"); } - }), - month: (0, _index.default)({ - values: monthValues, - defaultWidth: "wide" - }), - day: (0, _index.default)({ - values: dayValues, - defaultWidth: "wide" - }), - dayPeriod: (0, _index.default)({ - values: dayPeriodValues, - defaultWidth: "wide", - formattingValues: formattingDayPeriodValues, - defaultFormattingWidth: "wide" - }) - }; - var _default = localize; - exports2.default = _default; - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/locale/_lib/buildMatchFn/index.js -var require_buildMatchFn = __commonJS({ - "node_modules/date-fns/locale/_lib/buildMatchFn/index.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = buildMatchFn; - function buildMatchFn(args) { - return function(string) { - var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - var width = options.width; - var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; - var matchResult = string.match(matchPattern); - if (!matchResult) { - return null; + }, + // Timezone (GMT) + O: function(date, token, _localize) { + const timezoneOffset = date.getTimezoneOffset(); + switch (token) { + case "O": + case "OO": + case "OOO": + return "GMT" + formatTimezoneShort(timezoneOffset, ":"); + case "OOOO": + default: + return "GMT" + formatTimezone(timezoneOffset, ":"); } - var matchedString = matchResult[0]; - var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; - var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) { - return pattern.test(matchedString); - }) : findKey(parsePatterns, function(pattern) { - return pattern.test(matchedString); - }); - var value; - value = args.valueCallback ? args.valueCallback(key) : key; - value = options.valueCallback ? options.valueCallback(value) : value; - var rest = string.slice(matchedString.length); - return { - value, - rest - }; - }; - } - function findKey(object, predicate) { - for (var key in object) { - if (object.hasOwnProperty(key) && predicate(object[key])) { - return key; + }, + // Timezone (specific non-location) + z: function(date, token, _localize) { + const timezoneOffset = date.getTimezoneOffset(); + switch (token) { + case "z": + case "zz": + case "zzz": + return "GMT" + formatTimezoneShort(timezoneOffset, ":"); + case "zzzz": + default: + return "GMT" + formatTimezone(timezoneOffset, ":"); } + }, + // Seconds timestamp + t: function(date, token, _localize) { + const timestamp = Math.trunc(date.getTime() / 1e3); + return (0, _index6.addLeadingZeros)(timestamp, token.length); + }, + // Milliseconds timestamp + T: function(date, token, _localize) { + const timestamp = date.getTime(); + return (0, _index6.addLeadingZeros)(timestamp, token.length); } - return void 0; + }; + function formatTimezoneShort(offset, delimiter = "") { + const sign = offset > 0 ? "-" : "+"; + const absOffset = Math.abs(offset); + const hours = Math.trunc(absOffset / 60); + const minutes = absOffset % 60; + if (minutes === 0) { + return sign + String(hours); + } + return sign + String(hours) + delimiter + (0, _index6.addLeadingZeros)(minutes, 2); } - function findIndex(array, predicate) { - for (var key = 0; key < array.length; key++) { - if (predicate(array[key])) { - return key; - } + function formatTimezoneWithOptionalMinutes(offset, delimiter) { + if (offset % 60 === 0) { + const sign = offset > 0 ? "-" : "+"; + return sign + (0, _index6.addLeadingZeros)(Math.abs(offset) / 60, 2); } - return void 0; + return formatTimezone(offset, delimiter); } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/locale/_lib/buildMatchPatternFn/index.js -var require_buildMatchPatternFn = __commonJS({ - "node_modules/date-fns/locale/_lib/buildMatchPatternFn/index.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = buildMatchPatternFn; - function buildMatchPatternFn(args) { - return function(string) { - var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; - var matchResult = string.match(args.matchPattern); - if (!matchResult) - return null; - var matchedString = matchResult[0]; - var parseResult = string.match(args.parsePattern); - if (!parseResult) - return null; - var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; - value = options.valueCallback ? options.valueCallback(value) : value; - var rest = string.slice(matchedString.length); - return { - value, - rest - }; - }; + function formatTimezone(offset, delimiter = "") { + const sign = offset > 0 ? "-" : "+"; + const absOffset = Math.abs(offset); + const hours = (0, _index6.addLeadingZeros)(Math.trunc(absOffset / 60), 2); + const minutes = (0, _index6.addLeadingZeros)(absOffset % 60, 2); + return sign + hours + delimiter + minutes; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/locale/en-US/_lib/match/index.js -var require_match = __commonJS({ - "node_modules/date-fns/locale/en-US/_lib/match/index.js"(exports2, module2) { +// node_modules/date-fns/_lib/format/longFormatters.js +var require_longFormatters = __commonJS({ + "node_modules/date-fns/_lib/format/longFormatters.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var _index = _interopRequireDefault(require_buildMatchFn()); - var _index2 = _interopRequireDefault(require_buildMatchPatternFn()); - var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; - var parseOrdinalNumberPattern = /\d+/i; - var matchEraPatterns = { - narrow: /^(b|a)/i, - abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, - wide: /^(before christ|before common era|anno domini|common era)/i - }; - var parseEraPatterns = { - any: [/^b/i, /^(a|c)/i] - }; - var matchQuarterPatterns = { - narrow: /^[1234]/i, - abbreviated: /^q[1234]/i, - wide: /^[1234](th|st|nd|rd)? quarter/i - }; - var parseQuarterPatterns = { - any: [/1/i, /2/i, /3/i, /4/i] - }; - var matchMonthPatterns = { - narrow: /^[jfmasond]/i, - abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, - wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i - }; - var parseMonthPatterns = { - narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i], - any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i] - }; - var matchDayPatterns = { - narrow: /^[smtwf]/i, - short: /^(su|mo|tu|we|th|fr|sa)/i, - abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, - wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i - }; - var parseDayPatterns = { - narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], - any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] - }; - var matchDayPeriodPatterns = { - narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, - any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i - }; - var parseDayPeriodPatterns = { - any: { - am: /^a/i, - pm: /^p/i, - midnight: /^mi/i, - noon: /^no/i, - morning: /morning/i, - afternoon: /afternoon/i, - evening: /evening/i, - night: /night/i + exports2.longFormatters = void 0; + var dateLongFormatter = (pattern, formatLong) => { + switch (pattern) { + case "P": + return formatLong.date({ width: "short" }); + case "PP": + return formatLong.date({ width: "medium" }); + case "PPP": + return formatLong.date({ width: "long" }); + case "PPPP": + default: + return formatLong.date({ width: "full" }); } }; - var match = { - ordinalNumber: (0, _index2.default)({ - matchPattern: matchOrdinalNumberPattern, - parsePattern: parseOrdinalNumberPattern, - valueCallback: function valueCallback(value) { - return parseInt(value, 10); - } - }), - era: (0, _index.default)({ - matchPatterns: matchEraPatterns, - defaultMatchWidth: "wide", - parsePatterns: parseEraPatterns, - defaultParseWidth: "any" - }), - quarter: (0, _index.default)({ - matchPatterns: matchQuarterPatterns, - defaultMatchWidth: "wide", - parsePatterns: parseQuarterPatterns, - defaultParseWidth: "any", - valueCallback: function valueCallback(index) { - return index + 1; - } - }), - month: (0, _index.default)({ - matchPatterns: matchMonthPatterns, - defaultMatchWidth: "wide", - parsePatterns: parseMonthPatterns, - defaultParseWidth: "any" - }), - day: (0, _index.default)({ - matchPatterns: matchDayPatterns, - defaultMatchWidth: "wide", - parsePatterns: parseDayPatterns, - defaultParseWidth: "any" - }), - dayPeriod: (0, _index.default)({ - matchPatterns: matchDayPeriodPatterns, - defaultMatchWidth: "any", - parsePatterns: parseDayPeriodPatterns, - defaultParseWidth: "any" - }) + var timeLongFormatter = (pattern, formatLong) => { + switch (pattern) { + case "p": + return formatLong.time({ width: "short" }); + case "pp": + return formatLong.time({ width: "medium" }); + case "ppp": + return formatLong.time({ width: "long" }); + case "pppp": + default: + return formatLong.time({ width: "full" }); + } }; - var _default = match; - exports2.default = _default; - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/locale/en-US/index.js -var require_en_US = __commonJS({ - "node_modules/date-fns/locale/en-US/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var _index = _interopRequireDefault(require_formatDistance()); - var _index2 = _interopRequireDefault(require_formatLong()); - var _index3 = _interopRequireDefault(require_formatRelative()); - var _index4 = _interopRequireDefault(require_localize()); - var _index5 = _interopRequireDefault(require_match()); - var locale = { - code: "en-US", - formatDistance: _index.default, - formatLong: _index2.default, - formatRelative: _index3.default, - localize: _index4.default, - match: _index5.default, - options: { - weekStartsOn: 0, - firstWeekContainsDate: 1 + var dateTimeLongFormatter = (pattern, formatLong) => { + const matchResult = pattern.match(/(P+)(p+)?/) || []; + const datePattern = matchResult[1]; + const timePattern = matchResult[2]; + if (!timePattern) { + return dateLongFormatter(pattern, formatLong); + } + let dateTimeFormat; + switch (datePattern) { + case "P": + dateTimeFormat = formatLong.dateTime({ width: "short" }); + break; + case "PP": + dateTimeFormat = formatLong.dateTime({ width: "medium" }); + break; + case "PPP": + dateTimeFormat = formatLong.dateTime({ width: "long" }); + break; + case "PPPP": + default: + dateTimeFormat = formatLong.dateTime({ width: "full" }); + break; } + return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong)); + }; + var longFormatters = exports2.longFormatters = { + p: timeLongFormatter, + P: dateTimeLongFormatter }; - var _default = locale; - exports2.default = _default; - module2.exports = exports2.default; } }); -// node_modules/date-fns/_lib/defaultLocale/index.js -var require_defaultLocale = __commonJS({ - "node_modules/date-fns/_lib/defaultLocale/index.js"(exports2, module2) { +// node_modules/date-fns/_lib/protectedTokens.js +var require_protectedTokens = __commonJS({ + "node_modules/date-fns/_lib/protectedTokens.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = void 0; - var _index = _interopRequireDefault(require_en_US()); - var _default = _index.default; - exports2.default = _default; - module2.exports = exports2.default; + exports2.isProtectedDayOfYearToken = isProtectedDayOfYearToken; + exports2.isProtectedWeekYearToken = isProtectedWeekYearToken; + exports2.warnOrThrowProtectedError = warnOrThrowProtectedError; + var dayOfYearTokenRE = /^D+$/; + var weekYearTokenRE = /^Y+$/; + var throwTokens = ["D", "DD", "YY", "YYYY"]; + function isProtectedDayOfYearToken(token) { + return dayOfYearTokenRE.test(token); + } + function isProtectedWeekYearToken(token) { + return weekYearTokenRE.test(token); + } + function warnOrThrowProtectedError(token, format, input) { + const _message = message(token, format, input); + console.warn(_message); + if (throwTokens.includes(token)) + throw new RangeError(_message); + } + function message(token, format, input) { + const subject = token[0] === "Y" ? "years" : "days of the month"; + return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`; + } } }); -// node_modules/date-fns/format/index.js +// node_modules/date-fns/format.js var require_format = __commonJS({ - "node_modules/date-fns/format/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = format; - var _index = _interopRequireDefault(require_isValid()); - var _index2 = _interopRequireDefault(require_subMilliseconds()); - var _index3 = _interopRequireDefault(require_toDate()); - var _index4 = _interopRequireDefault(require_formatters()); - var _index5 = _interopRequireDefault(require_longFormatters()); - var _index6 = _interopRequireDefault(require_getTimezoneOffsetInMilliseconds()); - var _index7 = require_protectedTokens(); - var _index8 = _interopRequireDefault(require_toInteger()); - var _index9 = _interopRequireDefault(require_requiredArgs()); - var _index10 = require_defaultOptions(); - var _index11 = _interopRequireDefault(require_defaultLocale()); + "node_modules/date-fns/format.js"(exports2) { + "use strict"; + exports2.format = exports2.formatDate = format; + Object.defineProperty(exports2, "formatters", { + enumerable: true, + get: function() { + return _index3.formatters; + } + }); + Object.defineProperty(exports2, "longFormatters", { + enumerable: true, + get: function() { + return _index4.longFormatters; + } + }); + var _index = require_defaultLocale(); + var _index2 = require_defaultOptions(); + var _index3 = require_formatters(); + var _index4 = require_longFormatters(); + var _index5 = require_protectedTokens(); + var _index6 = require_isValid(); + var _index7 = require_toDate(); var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; var escapedStringRegExp = /^'([^]*?)'?$/; var doubleQuoteRegExp = /''/g; var unescapedLatinCharacterRegExp = /[a-zA-Z]/; - function format(dirtyDate, dirtyFormatStr, options) { - var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4; - (0, _index9.default)(2, arguments); - var formatStr = String(dirtyFormatStr); - var defaultOptions = (0, _index10.getDefaultOptions)(); - var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : _index11.default; - var firstWeekContainsDate = (0, _index8.default)((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); - } - var weekStartsOn = (0, _index8.default)((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - if (!locale.localize) { - throw new RangeError("locale must contain localize property"); - } - if (!locale.formatLong) { - throw new RangeError("locale must contain formatLong property"); - } - var originalDate = (0, _index3.default)(dirtyDate); - if (!(0, _index.default)(originalDate)) { + function format(date, formatStr, options) { + const defaultOptions = (0, _index2.getDefaultOptions)(); + const locale = options?.locale ?? defaultOptions.locale ?? _index.defaultLocale; + const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; + const originalDate = (0, _index7.toDate)(date); + if (!(0, _index6.isValid)(originalDate)) { throw new RangeError("Invalid time value"); } - var timezoneOffset = (0, _index6.default)(originalDate); - var utcDate = (0, _index2.default)(originalDate, timezoneOffset); - var formatterOptions = { - firstWeekContainsDate, - weekStartsOn, - locale, - _originalDate: originalDate - }; - var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) { - var firstCharacter = substring[0]; + let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => { + const firstCharacter = substring[0]; if (firstCharacter === "p" || firstCharacter === "P") { - var longFormatter = _index5.default[firstCharacter]; + const longFormatter = _index4.longFormatters[firstCharacter]; return longFormatter(substring, locale.formatLong); } return substring; - }).join("").match(formattingTokensRegExp).map(function(substring) { + }).join("").match(formattingTokensRegExp).map((substring) => { if (substring === "''") { - return "'"; + return { isToken: false, value: "'" }; } - var firstCharacter = substring[0]; + const firstCharacter = substring[0]; if (firstCharacter === "'") { - return cleanEscapedString(substring); + return { isToken: false, value: cleanEscapedString(substring) }; } - var formatter = _index4.default[firstCharacter]; - if (formatter) { - if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && (0, _index7.isProtectedWeekYearToken)(substring)) { - (0, _index7.throwProtectedError)(substring, dirtyFormatStr, String(dirtyDate)); - } - if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && (0, _index7.isProtectedDayOfYearToken)(substring)) { - (0, _index7.throwProtectedError)(substring, dirtyFormatStr, String(dirtyDate)); - } - return formatter(utcDate, substring, locale.localize, formatterOptions); + if (_index3.formatters[firstCharacter]) { + return { isToken: true, value: substring }; } if (firstCharacter.match(unescapedLatinCharacterRegExp)) { - throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"); + throw new RangeError( + "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" + ); } - return substring; + return { isToken: false, value: substring }; + }); + if (locale.localize.preprocessor) { + parts = locale.localize.preprocessor(originalDate, parts); + } + const formatterOptions = { + firstWeekContainsDate, + weekStartsOn, + locale + }; + return parts.map((part) => { + if (!part.isToken) + return part.value; + const token = part.value; + if (!options?.useAdditionalWeekYearTokens && (0, _index5.isProtectedWeekYearToken)(token) || !options?.useAdditionalDayOfYearTokens && (0, _index5.isProtectedDayOfYearToken)(token)) { + (0, _index5.warnOrThrowProtectedError)(token, formatStr, String(date)); + } + const formatter = _index3.formatters[token[0]]; + return formatter(originalDate, token, locale.localize, formatterOptions); }).join(""); - return result; } function cleanEscapedString(input) { - var matched = input.match(escapedStringRegExp); + const matched = input.match(escapedStringRegExp); if (!matched) { return input; } - return matched[1].replace(doubleQuoteRegExp, "'"); - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/assign/index.js -var require_assign = __commonJS({ - "node_modules/date-fns/_lib/assign/index.js"(exports2, module2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = assign; - function assign(target, object) { - if (target == null) { - throw new TypeError("assign requires that input parameter not be null or undefined"); - } - for (var property in object) { - if (Object.prototype.hasOwnProperty.call(object, property)) { - ; - target[property] = object[property]; - } - } - return target; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/_lib/cloneObject/index.js -var require_cloneObject = __commonJS({ - "node_modules/date-fns/_lib/cloneObject/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = cloneObject; - var _index = _interopRequireDefault(require_assign()); - function cloneObject(object) { - return (0, _index.default)({}, object); + return matched[1].replace(doubleQuoteRegExp, "'"); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatDistance/index.js +// node_modules/date-fns/formatDistance.js var require_formatDistance2 = __commonJS({ - "node_modules/date-fns/formatDistance/index.js"(exports2, module2) { + "node_modules/date-fns/formatDistance.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatDistance; - var _index = require_defaultOptions(); - var _index2 = _interopRequireDefault(require_compareAsc()); - var _index3 = _interopRequireDefault(require_differenceInMonths()); - var _index4 = _interopRequireDefault(require_differenceInSeconds()); - var _index5 = _interopRequireDefault(require_defaultLocale()); - var _index6 = _interopRequireDefault(require_toDate()); - var _index7 = _interopRequireDefault(require_cloneObject()); - var _index8 = _interopRequireDefault(require_assign()); - var _index9 = _interopRequireDefault(require_getTimezoneOffsetInMilliseconds()); - var _index10 = _interopRequireDefault(require_requiredArgs()); - var MINUTES_IN_DAY = 1440; - var MINUTES_IN_ALMOST_TWO_DAYS = 2520; - var MINUTES_IN_MONTH = 43200; - var MINUTES_IN_TWO_MONTHS = 86400; - function formatDistance(dirtyDate, dirtyBaseDate, options) { - var _ref, _options$locale; - (0, _index10.default)(2, arguments); - var defaultOptions = (0, _index.getDefaultOptions)(); - var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : _index5.default; - if (!locale.formatDistance) { - throw new RangeError("locale must contain formatDistance property"); - } - var comparison = (0, _index2.default)(dirtyDate, dirtyBaseDate); + exports2.formatDistance = formatDistance; + var _index = require_compareAsc(); + var _index2 = require_constants(); + var _index3 = require_differenceInMonths(); + var _index4 = require_differenceInSeconds(); + var _index5 = require_toDate(); + var _index6 = require_defaultLocale(); + var _index7 = require_defaultOptions(); + var _index8 = require_getTimezoneOffsetInMilliseconds(); + function formatDistance(date, baseDate, options) { + const defaultOptions = (0, _index7.getDefaultOptions)(); + const locale = options?.locale ?? defaultOptions.locale ?? _index6.defaultLocale; + const minutesInAlmostTwoDays = 2520; + const comparison = (0, _index.compareAsc)(date, baseDate); if (isNaN(comparison)) { throw new RangeError("Invalid time value"); } - var localizeOptions = (0, _index8.default)((0, _index7.default)(options), { - addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix), + const localizeOptions = Object.assign({}, options, { + addSuffix: options?.addSuffix, comparison }); - var dateLeft; - var dateRight; + let dateLeft; + let dateRight; if (comparison > 0) { - dateLeft = (0, _index6.default)(dirtyBaseDate); - dateRight = (0, _index6.default)(dirtyDate); + dateLeft = (0, _index5.toDate)(baseDate); + dateRight = (0, _index5.toDate)(date); } else { - dateLeft = (0, _index6.default)(dirtyDate); - dateRight = (0, _index6.default)(dirtyBaseDate); + dateLeft = (0, _index5.toDate)(date); + dateRight = (0, _index5.toDate)(baseDate); } - var seconds = (0, _index4.default)(dateRight, dateLeft); - var offsetInSeconds = ((0, _index9.default)(dateRight) - (0, _index9.default)(dateLeft)) / 1e3; - var minutes = Math.round((seconds - offsetInSeconds) / 60); - var months; + const seconds = (0, _index4.differenceInSeconds)(dateRight, dateLeft); + const offsetInSeconds = ((0, _index8.getTimezoneOffsetInMilliseconds)(dateRight) - (0, _index8.getTimezoneOffsetInMilliseconds)(dateLeft)) / 1e3; + const minutes = Math.round((seconds - offsetInSeconds) / 60); + let months; if (minutes < 2) { - if (options !== null && options !== void 0 && options.includeSeconds) { + if (options?.includeSeconds) { if (seconds < 5) { return locale.formatDistance("lessThanXSeconds", 5, localizeOptions); } else if (seconds < 10) { @@ -6916,25 +5903,25 @@ var require_formatDistance2 = __commonJS({ return locale.formatDistance("xMinutes", minutes, localizeOptions); } else if (minutes < 90) { return locale.formatDistance("aboutXHours", 1, localizeOptions); - } else if (minutes < MINUTES_IN_DAY) { - var hours = Math.round(minutes / 60); + } else if (minutes < _index2.minutesInDay) { + const hours = Math.round(minutes / 60); return locale.formatDistance("aboutXHours", hours, localizeOptions); - } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) { + } else if (minutes < minutesInAlmostTwoDays) { return locale.formatDistance("xDays", 1, localizeOptions); - } else if (minutes < MINUTES_IN_MONTH) { - var days = Math.round(minutes / MINUTES_IN_DAY); + } else if (minutes < _index2.minutesInMonth) { + const days = Math.round(minutes / _index2.minutesInDay); return locale.formatDistance("xDays", days, localizeOptions); - } else if (minutes < MINUTES_IN_TWO_MONTHS) { - months = Math.round(minutes / MINUTES_IN_MONTH); + } else if (minutes < _index2.minutesInMonth * 2) { + months = Math.round(minutes / _index2.minutesInMonth); return locale.formatDistance("aboutXMonths", months, localizeOptions); } - months = (0, _index3.default)(dateRight, dateLeft); + months = (0, _index3.differenceInMonths)(dateRight, dateLeft); if (months < 12) { - var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH); + const nearestMonth = Math.round(minutes / _index2.minutesInMonth); return locale.formatDistance("xMonths", nearestMonth, localizeOptions); } else { - var monthsSinceStartOfYear = months % 12; - var years = Math.floor(months / 12); + const monthsSinceStartOfYear = months % 12; + const years = Math.trunc(months / 12); if (monthsSinceStartOfYear < 3) { return locale.formatDistance("aboutXYears", years, localizeOptions); } else if (monthsSinceStartOfYear < 9) { @@ -6944,458 +5931,377 @@ var require_formatDistance2 = __commonJS({ } } } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatDistanceStrict/index.js +// node_modules/date-fns/formatDistanceStrict.js var require_formatDistanceStrict = __commonJS({ - "node_modules/date-fns/formatDistanceStrict/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatDistanceStrict; - var _index = require_defaultOptions(); - var _index2 = _interopRequireDefault(require_getTimezoneOffsetInMilliseconds()); - var _index3 = _interopRequireDefault(require_compareAsc()); - var _index4 = _interopRequireDefault(require_toDate()); - var _index5 = _interopRequireDefault(require_cloneObject()); - var _index6 = _interopRequireDefault(require_assign()); - var _index7 = _interopRequireDefault(require_defaultLocale()); - var _index8 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_MINUTE = 1e3 * 60; - var MINUTES_IN_DAY = 60 * 24; - var MINUTES_IN_MONTH = MINUTES_IN_DAY * 30; - var MINUTES_IN_YEAR = MINUTES_IN_DAY * 365; - function formatDistanceStrict(dirtyDate, dirtyBaseDate, options) { - var _ref, _options$locale, _options$roundingMeth; - (0, _index8.default)(2, arguments); - var defaultOptions = (0, _index.getDefaultOptions)(); - var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : _index7.default; - if (!locale.formatDistance) { - throw new RangeError("locale must contain localize.formatDistance property"); - } - var comparison = (0, _index3.default)(dirtyDate, dirtyBaseDate); + "node_modules/date-fns/formatDistanceStrict.js"(exports2) { + "use strict"; + exports2.formatDistanceStrict = formatDistanceStrict; + var _index = require_defaultLocale(); + var _index2 = require_defaultOptions(); + var _index3 = require_getRoundingMethod(); + var _index4 = require_getTimezoneOffsetInMilliseconds(); + var _index5 = require_compareAsc(); + var _index6 = require_constants(); + var _index7 = require_toDate(); + function formatDistanceStrict(date, baseDate, options) { + const defaultOptions = (0, _index2.getDefaultOptions)(); + const locale = options?.locale ?? defaultOptions.locale ?? _index.defaultLocale; + const comparison = (0, _index5.compareAsc)(date, baseDate); if (isNaN(comparison)) { throw new RangeError("Invalid time value"); } - var localizeOptions = (0, _index6.default)((0, _index5.default)(options), { - addSuffix: Boolean(options === null || options === void 0 ? void 0 : options.addSuffix), + const localizeOptions = Object.assign({}, options, { + addSuffix: options?.addSuffix, comparison }); - var dateLeft; - var dateRight; + let dateLeft; + let dateRight; if (comparison > 0) { - dateLeft = (0, _index4.default)(dirtyBaseDate); - dateRight = (0, _index4.default)(dirtyDate); - } else { - dateLeft = (0, _index4.default)(dirtyDate); - dateRight = (0, _index4.default)(dirtyBaseDate); - } - var roundingMethod = String((_options$roundingMeth = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth !== void 0 ? _options$roundingMeth : "round"); - var roundingMethodFn; - if (roundingMethod === "floor") { - roundingMethodFn = Math.floor; - } else if (roundingMethod === "ceil") { - roundingMethodFn = Math.ceil; - } else if (roundingMethod === "round") { - roundingMethodFn = Math.round; + dateLeft = (0, _index7.toDate)(baseDate); + dateRight = (0, _index7.toDate)(date); } else { - throw new RangeError("roundingMethod must be 'floor', 'ceil' or 'round'"); - } - var milliseconds = dateRight.getTime() - dateLeft.getTime(); - var minutes = milliseconds / MILLISECONDS_IN_MINUTE; - var timezoneOffset = (0, _index2.default)(dateRight) - (0, _index2.default)(dateLeft); - var dstNormalizedMinutes = (milliseconds - timezoneOffset) / MILLISECONDS_IN_MINUTE; - var defaultUnit = options === null || options === void 0 ? void 0 : options.unit; - var unit; + dateLeft = (0, _index7.toDate)(date); + dateRight = (0, _index7.toDate)(baseDate); + } + const roundingMethod = (0, _index3.getRoundingMethod)( + options?.roundingMethod ?? "round" + ); + const milliseconds = dateRight.getTime() - dateLeft.getTime(); + const minutes = milliseconds / _index6.millisecondsInMinute; + const timezoneOffset = (0, _index4.getTimezoneOffsetInMilliseconds)(dateRight) - (0, _index4.getTimezoneOffsetInMilliseconds)(dateLeft); + const dstNormalizedMinutes = (milliseconds - timezoneOffset) / _index6.millisecondsInMinute; + const defaultUnit = options?.unit; + let unit; if (!defaultUnit) { if (minutes < 1) { unit = "second"; } else if (minutes < 60) { unit = "minute"; - } else if (minutes < MINUTES_IN_DAY) { + } else if (minutes < _index6.minutesInDay) { unit = "hour"; - } else if (dstNormalizedMinutes < MINUTES_IN_MONTH) { + } else if (dstNormalizedMinutes < _index6.minutesInMonth) { unit = "day"; - } else if (dstNormalizedMinutes < MINUTES_IN_YEAR) { + } else if (dstNormalizedMinutes < _index6.minutesInYear) { unit = "month"; } else { unit = "year"; } } else { - unit = String(defaultUnit); + unit = defaultUnit; } if (unit === "second") { - var seconds = roundingMethodFn(milliseconds / 1e3); + const seconds = roundingMethod(milliseconds / 1e3); return locale.formatDistance("xSeconds", seconds, localizeOptions); } else if (unit === "minute") { - var roundedMinutes = roundingMethodFn(minutes); + const roundedMinutes = roundingMethod(minutes); return locale.formatDistance("xMinutes", roundedMinutes, localizeOptions); } else if (unit === "hour") { - var hours = roundingMethodFn(minutes / 60); + const hours = roundingMethod(minutes / 60); return locale.formatDistance("xHours", hours, localizeOptions); } else if (unit === "day") { - var days = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_DAY); + const days = roundingMethod(dstNormalizedMinutes / _index6.minutesInDay); return locale.formatDistance("xDays", days, localizeOptions); } else if (unit === "month") { - var months = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_MONTH); + const months = roundingMethod( + dstNormalizedMinutes / _index6.minutesInMonth + ); return months === 12 && defaultUnit !== "month" ? locale.formatDistance("xYears", 1, localizeOptions) : locale.formatDistance("xMonths", months, localizeOptions); - } else if (unit === "year") { - var years = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_YEAR); + } else { + const years = roundingMethod(dstNormalizedMinutes / _index6.minutesInYear); return locale.formatDistance("xYears", years, localizeOptions); } - throw new RangeError("unit must be 'second', 'minute', 'hour', 'day', 'month' or 'year'"); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatDistanceToNow/index.js +// node_modules/date-fns/formatDistanceToNow.js var require_formatDistanceToNow = __commonJS({ - "node_modules/date-fns/formatDistanceToNow/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatDistanceToNow; - var _index = _interopRequireDefault(require_formatDistance2()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function formatDistanceToNow(dirtyDate, options) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate, Date.now(), options); + "node_modules/date-fns/formatDistanceToNow.js"(exports2) { + "use strict"; + exports2.formatDistanceToNow = formatDistanceToNow; + var _index = require_constructNow(); + var _index2 = require_formatDistance2(); + function formatDistanceToNow(date, options) { + return (0, _index2.formatDistance)( + date, + (0, _index.constructNow)(date), + options + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatDistanceToNowStrict/index.js +// node_modules/date-fns/formatDistanceToNowStrict.js var require_formatDistanceToNowStrict = __commonJS({ - "node_modules/date-fns/formatDistanceToNowStrict/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatDistanceToNowStrict; - var _index = _interopRequireDefault(require_formatDistanceStrict()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function formatDistanceToNowStrict(dirtyDate, options) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate, Date.now(), options); + "node_modules/date-fns/formatDistanceToNowStrict.js"(exports2) { + "use strict"; + exports2.formatDistanceToNowStrict = formatDistanceToNowStrict; + var _index = require_formatDistanceStrict(); + var _index2 = require_constructNow(); + function formatDistanceToNowStrict(date, options) { + return (0, _index.formatDistanceStrict)( + date, + (0, _index2.constructNow)(date), + options + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatDuration/index.js +// node_modules/date-fns/formatDuration.js var require_formatDuration = __commonJS({ - "node_modules/date-fns/formatDuration/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatDuration; - var _index = require_defaultOptions(); - var _index2 = _interopRequireDefault(require_defaultLocale()); - var defaultFormat = ["years", "months", "weeks", "days", "hours", "minutes", "seconds"]; + "node_modules/date-fns/formatDuration.js"(exports2) { + "use strict"; + exports2.formatDuration = formatDuration; + var _index = require_defaultLocale(); + var _index2 = require_defaultOptions(); + var defaultFormat = [ + "years", + "months", + "weeks", + "days", + "hours", + "minutes", + "seconds" + ]; function formatDuration(duration, options) { - var _ref, _options$locale, _options$format, _options$zero, _options$delimiter; - if (arguments.length < 1) { - throw new TypeError("1 argument required, but only ".concat(arguments.length, " present")); - } - var defaultOptions = (0, _index.getDefaultOptions)(); - var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : _index2.default; - var format = (_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : defaultFormat; - var zero = (_options$zero = options === null || options === void 0 ? void 0 : options.zero) !== null && _options$zero !== void 0 ? _options$zero : false; - var delimiter = (_options$delimiter = options === null || options === void 0 ? void 0 : options.delimiter) !== null && _options$delimiter !== void 0 ? _options$delimiter : " "; + const defaultOptions = (0, _index2.getDefaultOptions)(); + const locale = options?.locale ?? defaultOptions.locale ?? _index.defaultLocale; + const format = options?.format ?? defaultFormat; + const zero = options?.zero ?? false; + const delimiter = options?.delimiter ?? " "; if (!locale.formatDistance) { return ""; } - var result = format.reduce(function(acc, unit) { - var token = "x".concat(unit.replace(/(^.)/, function(m) { - return m.toUpperCase(); - })); - var value = duration[unit]; - if (typeof value === "number" && (zero || duration[unit])) { + const result = format.reduce((acc, unit) => { + const token = `x${unit.replace(/(^.)/, (m) => m.toUpperCase())}`; + const value = duration[unit]; + if (value !== void 0 && (zero || duration[unit])) { return acc.concat(locale.formatDistance(token, value)); } return acc; }, []).join(delimiter); return result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatISO/index.js +// node_modules/date-fns/formatISO.js var require_formatISO = __commonJS({ - "node_modules/date-fns/formatISO/index.js"(exports2, module2) { + "node_modules/date-fns/formatISO.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatISO; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_addLeadingZeros()); - var _index3 = _interopRequireDefault(require_requiredArgs()); + exports2.formatISO = formatISO; + var _index = require_toDate(); + var _index2 = require_addLeadingZeros(); function formatISO(date, options) { - var _options$format, _options$representati; - (0, _index3.default)(1, arguments); - var originalDate = (0, _index.default)(date); - if (isNaN(originalDate.getTime())) { + const _date = (0, _index.toDate)(date); + if (isNaN(_date.getTime())) { throw new RangeError("Invalid time value"); } - var format = String((_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : "extended"); - var representation = String((_options$representati = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati !== void 0 ? _options$representati : "complete"); - if (format !== "extended" && format !== "basic") { - throw new RangeError("format must be 'extended' or 'basic'"); - } - if (representation !== "date" && representation !== "time" && representation !== "complete") { - throw new RangeError("representation must be 'date', 'time', or 'complete'"); - } - var result = ""; - var tzOffset = ""; - var dateDelimiter = format === "extended" ? "-" : ""; - var timeDelimiter = format === "extended" ? ":" : ""; + const format = options?.format ?? "extended"; + const representation = options?.representation ?? "complete"; + let result = ""; + let tzOffset = ""; + const dateDelimiter = format === "extended" ? "-" : ""; + const timeDelimiter = format === "extended" ? ":" : ""; if (representation !== "time") { - var day = (0, _index2.default)(originalDate.getDate(), 2); - var month = (0, _index2.default)(originalDate.getMonth() + 1, 2); - var year = (0, _index2.default)(originalDate.getFullYear(), 4); - result = "".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day); + const day = (0, _index2.addLeadingZeros)(_date.getDate(), 2); + const month = (0, _index2.addLeadingZeros)(_date.getMonth() + 1, 2); + const year = (0, _index2.addLeadingZeros)(_date.getFullYear(), 4); + result = `${year}${dateDelimiter}${month}${dateDelimiter}${day}`; } if (representation !== "date") { - var offset = originalDate.getTimezoneOffset(); + const offset = _date.getTimezoneOffset(); if (offset !== 0) { - var absoluteOffset = Math.abs(offset); - var hourOffset = (0, _index2.default)(Math.floor(absoluteOffset / 60), 2); - var minuteOffset = (0, _index2.default)(absoluteOffset % 60, 2); - var sign = offset < 0 ? "+" : "-"; - tzOffset = "".concat(sign).concat(hourOffset, ":").concat(minuteOffset); + const absoluteOffset = Math.abs(offset); + const hourOffset = (0, _index2.addLeadingZeros)( + Math.trunc(absoluteOffset / 60), + 2 + ); + const minuteOffset = (0, _index2.addLeadingZeros)(absoluteOffset % 60, 2); + const sign = offset < 0 ? "+" : "-"; + tzOffset = `${sign}${hourOffset}:${minuteOffset}`; } else { tzOffset = "Z"; } - var hour = (0, _index2.default)(originalDate.getHours(), 2); - var minute = (0, _index2.default)(originalDate.getMinutes(), 2); - var second = (0, _index2.default)(originalDate.getSeconds(), 2); - var separator = result === "" ? "" : "T"; - var time = [hour, minute, second].join(timeDelimiter); - result = "".concat(result).concat(separator).concat(time).concat(tzOffset); + const hour = (0, _index2.addLeadingZeros)(_date.getHours(), 2); + const minute = (0, _index2.addLeadingZeros)(_date.getMinutes(), 2); + const second = (0, _index2.addLeadingZeros)(_date.getSeconds(), 2); + const separator = result === "" ? "" : "T"; + const time = [hour, minute, second].join(timeDelimiter); + result = `${result}${separator}${time}${tzOffset}`; } return result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatISO9075/index.js +// node_modules/date-fns/formatISO9075.js var require_formatISO9075 = __commonJS({ - "node_modules/date-fns/formatISO9075/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatISO9075; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_isValid()); - var _index3 = _interopRequireDefault(require_addLeadingZeros()); - function formatISO9075(dirtyDate, options) { - var _options$format, _options$representati; - if (arguments.length < 1) { - throw new TypeError("1 argument required, but only ".concat(arguments.length, " present")); - } - var originalDate = (0, _index.default)(dirtyDate); - if (!(0, _index2.default)(originalDate)) { + "node_modules/date-fns/formatISO9075.js"(exports2) { + "use strict"; + exports2.formatISO9075 = formatISO9075; + var _index = require_isValid(); + var _index2 = require_toDate(); + var _index3 = require_addLeadingZeros(); + function formatISO9075(date, options) { + const _date = (0, _index2.toDate)(date); + if (!(0, _index.isValid)(_date)) { throw new RangeError("Invalid time value"); } - var format = String((_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : "extended"); - var representation = String((_options$representati = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati !== void 0 ? _options$representati : "complete"); - if (format !== "extended" && format !== "basic") { - throw new RangeError("format must be 'extended' or 'basic'"); - } - if (representation !== "date" && representation !== "time" && representation !== "complete") { - throw new RangeError("representation must be 'date', 'time', or 'complete'"); - } - var result = ""; - var dateDelimiter = format === "extended" ? "-" : ""; - var timeDelimiter = format === "extended" ? ":" : ""; + const format = options?.format ?? "extended"; + const representation = options?.representation ?? "complete"; + let result = ""; + const dateDelimiter = format === "extended" ? "-" : ""; + const timeDelimiter = format === "extended" ? ":" : ""; if (representation !== "time") { - var day = (0, _index3.default)(originalDate.getDate(), 2); - var month = (0, _index3.default)(originalDate.getMonth() + 1, 2); - var year = (0, _index3.default)(originalDate.getFullYear(), 4); - result = "".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day); + const day = (0, _index3.addLeadingZeros)(_date.getDate(), 2); + const month = (0, _index3.addLeadingZeros)(_date.getMonth() + 1, 2); + const year = (0, _index3.addLeadingZeros)(_date.getFullYear(), 4); + result = `${year}${dateDelimiter}${month}${dateDelimiter}${day}`; } if (representation !== "date") { - var hour = (0, _index3.default)(originalDate.getHours(), 2); - var minute = (0, _index3.default)(originalDate.getMinutes(), 2); - var second = (0, _index3.default)(originalDate.getSeconds(), 2); - var separator = result === "" ? "" : " "; - result = "".concat(result).concat(separator).concat(hour).concat(timeDelimiter).concat(minute).concat(timeDelimiter).concat(second); + const hour = (0, _index3.addLeadingZeros)(_date.getHours(), 2); + const minute = (0, _index3.addLeadingZeros)(_date.getMinutes(), 2); + const second = (0, _index3.addLeadingZeros)(_date.getSeconds(), 2); + const separator = result === "" ? "" : " "; + result = `${result}${separator}${hour}${timeDelimiter}${minute}${timeDelimiter}${second}`; } return result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatISODuration/index.js +// node_modules/date-fns/formatISODuration.js var require_formatISODuration = __commonJS({ - "node_modules/date-fns/formatISODuration/index.js"(exports2, module2) { + "node_modules/date-fns/formatISODuration.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatISODuration; - var _typeof2 = _interopRequireDefault(require_typeof()); - var _index = _interopRequireDefault(require_requiredArgs()); + exports2.formatISODuration = formatISODuration; function formatISODuration(duration) { - (0, _index.default)(1, arguments); - if ((0, _typeof2.default)(duration) !== "object") - throw new Error("Duration must be an object"); - var _duration$years = duration.years, years = _duration$years === void 0 ? 0 : _duration$years, _duration$months = duration.months, months = _duration$months === void 0 ? 0 : _duration$months, _duration$days = duration.days, days = _duration$days === void 0 ? 0 : _duration$days, _duration$hours = duration.hours, hours = _duration$hours === void 0 ? 0 : _duration$hours, _duration$minutes = duration.minutes, minutes = _duration$minutes === void 0 ? 0 : _duration$minutes, _duration$seconds = duration.seconds, seconds = _duration$seconds === void 0 ? 0 : _duration$seconds; - return "P".concat(years, "Y").concat(months, "M").concat(days, "DT").concat(hours, "H").concat(minutes, "M").concat(seconds, "S"); + const { + years = 0, + months = 0, + days = 0, + hours = 0, + minutes = 0, + seconds = 0 + } = duration; + return `P${years}Y${months}M${days}DT${hours}H${minutes}M${seconds}S`; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatRFC3339/index.js +// node_modules/date-fns/formatRFC3339.js var require_formatRFC3339 = __commonJS({ - "node_modules/date-fns/formatRFC3339/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatRFC3339; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_isValid()); - var _index3 = _interopRequireDefault(require_addLeadingZeros()); - var _index4 = _interopRequireDefault(require_toInteger()); - function formatRFC3339(dirtyDate, options) { - var _options$fractionDigi; - if (arguments.length < 1) { - throw new TypeError("1 arguments required, but only ".concat(arguments.length, " present")); - } - var originalDate = (0, _index.default)(dirtyDate); - if (!(0, _index2.default)(originalDate)) { + "node_modules/date-fns/formatRFC3339.js"(exports2) { + "use strict"; + exports2.formatRFC3339 = formatRFC3339; + var _index = require_isValid(); + var _index2 = require_toDate(); + var _index3 = require_addLeadingZeros(); + function formatRFC3339(date, options) { + const _date = (0, _index2.toDate)(date); + if (!(0, _index.isValid)(_date)) { throw new RangeError("Invalid time value"); } - var fractionDigits = Number((_options$fractionDigi = options === null || options === void 0 ? void 0 : options.fractionDigits) !== null && _options$fractionDigi !== void 0 ? _options$fractionDigi : 0); - if (!(fractionDigits >= 0 && fractionDigits <= 3)) { - throw new RangeError("fractionDigits must be between 0 and 3 inclusively"); - } - var day = (0, _index3.default)(originalDate.getDate(), 2); - var month = (0, _index3.default)(originalDate.getMonth() + 1, 2); - var year = originalDate.getFullYear(); - var hour = (0, _index3.default)(originalDate.getHours(), 2); - var minute = (0, _index3.default)(originalDate.getMinutes(), 2); - var second = (0, _index3.default)(originalDate.getSeconds(), 2); - var fractionalSecond = ""; + const fractionDigits = options?.fractionDigits ?? 0; + const day = (0, _index3.addLeadingZeros)(_date.getDate(), 2); + const month = (0, _index3.addLeadingZeros)(_date.getMonth() + 1, 2); + const year = _date.getFullYear(); + const hour = (0, _index3.addLeadingZeros)(_date.getHours(), 2); + const minute = (0, _index3.addLeadingZeros)(_date.getMinutes(), 2); + const second = (0, _index3.addLeadingZeros)(_date.getSeconds(), 2); + let fractionalSecond = ""; if (fractionDigits > 0) { - var milliseconds = originalDate.getMilliseconds(); - var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, fractionDigits - 3)); - fractionalSecond = "." + (0, _index3.default)(fractionalSeconds, fractionDigits); + const milliseconds = _date.getMilliseconds(); + const fractionalSeconds = Math.trunc( + milliseconds * Math.pow(10, fractionDigits - 3) + ); + fractionalSecond = "." + (0, _index3.addLeadingZeros)(fractionalSeconds, fractionDigits); } - var offset = ""; - var tzOffset = originalDate.getTimezoneOffset(); + let offset = ""; + const tzOffset = _date.getTimezoneOffset(); if (tzOffset !== 0) { - var absoluteOffset = Math.abs(tzOffset); - var hourOffset = (0, _index3.default)((0, _index4.default)(absoluteOffset / 60), 2); - var minuteOffset = (0, _index3.default)(absoluteOffset % 60, 2); - var sign = tzOffset < 0 ? "+" : "-"; - offset = "".concat(sign).concat(hourOffset, ":").concat(minuteOffset); + const absoluteOffset = Math.abs(tzOffset); + const hourOffset = (0, _index3.addLeadingZeros)( + Math.trunc(absoluteOffset / 60), + 2 + ); + const minuteOffset = (0, _index3.addLeadingZeros)(absoluteOffset % 60, 2); + const sign = tzOffset < 0 ? "+" : "-"; + offset = `${sign}${hourOffset}:${minuteOffset}`; } else { offset = "Z"; } - return "".concat(year, "-").concat(month, "-").concat(day, "T").concat(hour, ":").concat(minute, ":").concat(second).concat(fractionalSecond).concat(offset); + return `${year}-${month}-${day}T${hour}:${minute}:${second}${fractionalSecond}${offset}`; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatRFC7231/index.js +// node_modules/date-fns/formatRFC7231.js var require_formatRFC7231 = __commonJS({ - "node_modules/date-fns/formatRFC7231/index.js"(exports2, module2) { + "node_modules/date-fns/formatRFC7231.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatRFC7231; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_isValid()); - var _index3 = _interopRequireDefault(require_addLeadingZeros()); + exports2.formatRFC7231 = formatRFC7231; + var _index = require_isValid(); + var _index2 = require_toDate(); + var _index3 = require_addLeadingZeros(); var days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; - var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; - function formatRFC7231(dirtyDate) { - if (arguments.length < 1) { - throw new TypeError("1 arguments required, but only ".concat(arguments.length, " present")); - } - var originalDate = (0, _index.default)(dirtyDate); - if (!(0, _index2.default)(originalDate)) { + var months = [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ]; + function formatRFC7231(date) { + const _date = (0, _index2.toDate)(date); + if (!(0, _index.isValid)(_date)) { throw new RangeError("Invalid time value"); } - var dayName = days[originalDate.getUTCDay()]; - var dayOfMonth = (0, _index3.default)(originalDate.getUTCDate(), 2); - var monthName = months[originalDate.getUTCMonth()]; - var year = originalDate.getUTCFullYear(); - var hour = (0, _index3.default)(originalDate.getUTCHours(), 2); - var minute = (0, _index3.default)(originalDate.getUTCMinutes(), 2); - var second = (0, _index3.default)(originalDate.getUTCSeconds(), 2); - return "".concat(dayName, ", ").concat(dayOfMonth, " ").concat(monthName, " ").concat(year, " ").concat(hour, ":").concat(minute, ":").concat(second, " GMT"); + const dayName = days[_date.getUTCDay()]; + const dayOfMonth = (0, _index3.addLeadingZeros)(_date.getUTCDate(), 2); + const monthName = months[_date.getUTCMonth()]; + const year = _date.getUTCFullYear(); + const hour = (0, _index3.addLeadingZeros)(_date.getUTCHours(), 2); + const minute = (0, _index3.addLeadingZeros)(_date.getUTCMinutes(), 2); + const second = (0, _index3.addLeadingZeros)(_date.getUTCSeconds(), 2); + return `${dayName}, ${dayOfMonth} ${monthName} ${year} ${hour}:${minute}:${second} GMT`; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/formatRelative/index.js +// node_modules/date-fns/formatRelative.js var require_formatRelative2 = __commonJS({ - "node_modules/date-fns/formatRelative/index.js"(exports2, module2) { + "node_modules/date-fns/formatRelative.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = formatRelative; - var _index = require_defaultOptions(); - var _index2 = _interopRequireDefault(require_differenceInCalendarDays()); - var _index3 = _interopRequireDefault(require_format()); - var _index4 = _interopRequireDefault(require_defaultLocale()); - var _index5 = _interopRequireDefault(require_subMilliseconds()); - var _index6 = _interopRequireDefault(require_toDate()); - var _index7 = _interopRequireDefault(require_getTimezoneOffsetInMilliseconds()); - var _index8 = _interopRequireDefault(require_requiredArgs()); - var _index9 = _interopRequireDefault(require_toInteger()); - function formatRelative(dirtyDate, dirtyBaseDate, options) { - var _ref, _options$locale, _ref2, _ref3, _ref4, _options$weekStartsOn, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2; - (0, _index8.default)(2, arguments); - var date = (0, _index6.default)(dirtyDate); - var baseDate = (0, _index6.default)(dirtyBaseDate); - var defaultOptions = (0, _index.getDefaultOptions)(); - var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : _index4.default; - var weekStartsOn = (0, _index9.default)((_ref2 = (_ref3 = (_ref4 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.weekStartsOn) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : 0); - if (!locale.localize) { - throw new RangeError("locale must contain localize property"); - } - if (!locale.formatLong) { - throw new RangeError("locale must contain formatLong property"); - } - if (!locale.formatRelative) { - throw new RangeError("locale must contain formatRelative property"); - } - var diff = (0, _index2.default)(date, baseDate); + exports2.formatRelative = formatRelative; + var _index = require_differenceInCalendarDays(); + var _index2 = require_format(); + var _index3 = require_toDate(); + var _index4 = require_defaultLocale(); + var _index5 = require_defaultOptions(); + function formatRelative(date, baseDate, options) { + const _date = (0, _index3.toDate)(date); + const _baseDate = (0, _index3.toDate)(baseDate); + const defaultOptions = (0, _index5.getDefaultOptions)(); + const locale = options?.locale ?? defaultOptions.locale ?? _index4.defaultLocale; + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; + const diff = (0, _index.differenceInCalendarDays)(_date, _baseDate); if (isNaN(diff)) { throw new RangeError("Invalid time value"); } - var token; + let token; if (diff < -6) { token = "other"; } else if (diff < -1) { @@ -7411,1353 +6317,688 @@ var require_formatRelative2 = __commonJS({ } else { token = "other"; } - var utcDate = (0, _index5.default)(date, (0, _index7.default)(date)); - var utcBaseDate = (0, _index5.default)(baseDate, (0, _index7.default)(baseDate)); - var formatStr = locale.formatRelative(token, utcDate, utcBaseDate, { - locale, - weekStartsOn - }); - return (0, _index3.default)(date, formatStr, { + const formatStr = locale.formatRelative(token, _date, _baseDate, { locale, weekStartsOn }); + return (0, _index2.format)(_date, formatStr, { locale, weekStartsOn }); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/fromUnixTime/index.js +// node_modules/date-fns/fromUnixTime.js var require_fromUnixTime = __commonJS({ - "node_modules/date-fns/fromUnixTime/index.js"(exports2, module2) { + "node_modules/date-fns/fromUnixTime.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = fromUnixTime; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_toInteger()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function fromUnixTime(dirtyUnixTime) { - (0, _index3.default)(1, arguments); - var unixTime = (0, _index2.default)(dirtyUnixTime); - return (0, _index.default)(unixTime * 1e3); + exports2.fromUnixTime = fromUnixTime; + var _index = require_toDate(); + function fromUnixTime(unixTime) { + return (0, _index.toDate)(unixTime * 1e3); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getDate/index.js +// node_modules/date-fns/getDate.js var require_getDate = __commonJS({ - "node_modules/date-fns/getDate/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getDate; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getDate(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var dayOfMonth = date.getDate(); + "node_modules/date-fns/getDate.js"(exports2) { + "use strict"; + exports2.getDate = getDate; + var _index = require_toDate(); + function getDate(date) { + const _date = (0, _index.toDate)(date); + const dayOfMonth = _date.getDate(); return dayOfMonth; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getDay/index.js +// node_modules/date-fns/getDay.js var require_getDay = __commonJS({ - "node_modules/date-fns/getDay/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getDay; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getDay(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var day = date.getDay(); + "node_modules/date-fns/getDay.js"(exports2) { + "use strict"; + exports2.getDay = getDay; + var _index = require_toDate(); + function getDay(date) { + const _date = (0, _index.toDate)(date); + const day = _date.getDay(); return day; } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/getDayOfYear/index.js -var require_getDayOfYear = __commonJS({ - "node_modules/date-fns/getDayOfYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getDayOfYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_startOfYear()); - var _index3 = _interopRequireDefault(require_differenceInCalendarDays()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function getDayOfYear(dirtyDate) { - (0, _index4.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var diff = (0, _index3.default)(date, (0, _index2.default)(date)); - var dayOfYear = diff + 1; - return dayOfYear; - } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getDaysInMonth/index.js +// node_modules/date-fns/getDaysInMonth.js var require_getDaysInMonth = __commonJS({ - "node_modules/date-fns/getDaysInMonth/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getDaysInMonth; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getDaysInMonth(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getFullYear(); - var monthIndex = date.getMonth(); - var lastDayOfMonth = /* @__PURE__ */ new Date(0); + "node_modules/date-fns/getDaysInMonth.js"(exports2) { + "use strict"; + exports2.getDaysInMonth = getDaysInMonth; + var _index = require_toDate(); + var _index2 = require_constructFrom(); + function getDaysInMonth(date) { + const _date = (0, _index.toDate)(date); + const year = _date.getFullYear(); + const monthIndex = _date.getMonth(); + const lastDayOfMonth = (0, _index2.constructFrom)(date, 0); lastDayOfMonth.setFullYear(year, monthIndex + 1, 0); lastDayOfMonth.setHours(0, 0, 0, 0); return lastDayOfMonth.getDate(); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isLeapYear/index.js +// node_modules/date-fns/isLeapYear.js var require_isLeapYear = __commonJS({ - "node_modules/date-fns/isLeapYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isLeapYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isLeapYear(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getFullYear(); + "node_modules/date-fns/isLeapYear.js"(exports2) { + "use strict"; + exports2.isLeapYear = isLeapYear; + var _index = require_toDate(); + function isLeapYear(date) { + const _date = (0, _index.toDate)(date); + const year = _date.getFullYear(); return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getDaysInYear/index.js +// node_modules/date-fns/getDaysInYear.js var require_getDaysInYear = __commonJS({ - "node_modules/date-fns/getDaysInYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getDaysInYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_isLeapYear()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function getDaysInYear(dirtyDate) { - (0, _index3.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - if (String(new Date(date)) === "Invalid Date") { + "node_modules/date-fns/getDaysInYear.js"(exports2) { + "use strict"; + exports2.getDaysInYear = getDaysInYear; + var _index = require_isLeapYear(); + var _index2 = require_toDate(); + function getDaysInYear(date) { + const _date = (0, _index2.toDate)(date); + if (String(new Date(_date)) === "Invalid Date") { return NaN; } - return (0, _index2.default)(date) ? 366 : 365; + return (0, _index.isLeapYear)(_date) ? 366 : 365; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getDecade/index.js +// node_modules/date-fns/getDecade.js var require_getDecade = __commonJS({ - "node_modules/date-fns/getDecade/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getDecade; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getDecade(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getFullYear(); - var decade = Math.floor(year / 10) * 10; + "node_modules/date-fns/getDecade.js"(exports2) { + "use strict"; + exports2.getDecade = getDecade; + var _index = require_toDate(); + function getDecade(date) { + const _date = (0, _index.toDate)(date); + const year = _date.getFullYear(); + const decade = Math.floor(year / 10) * 10; return decade; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getDefaultOptions/index.js +// node_modules/date-fns/getDefaultOptions.js var require_getDefaultOptions = __commonJS({ - "node_modules/date-fns/getDefaultOptions/index.js"(exports2, module2) { + "node_modules/date-fns/getDefaultOptions.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getDefaultOptions; + exports2.getDefaultOptions = getDefaultOptions; var _index = require_defaultOptions(); - var _index2 = _interopRequireDefault(require_assign()); function getDefaultOptions() { - return (0, _index2.default)({}, (0, _index.getDefaultOptions)()); + return Object.assign({}, (0, _index.getDefaultOptions)()); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getHours/index.js +// node_modules/date-fns/getHours.js var require_getHours = __commonJS({ - "node_modules/date-fns/getHours/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getHours; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getHours(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var hours = date.getHours(); + "node_modules/date-fns/getHours.js"(exports2) { + "use strict"; + exports2.getHours = getHours; + var _index = require_toDate(); + function getHours(date) { + const _date = (0, _index.toDate)(date); + const hours = _date.getHours(); return hours; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getISODay/index.js +// node_modules/date-fns/getISODay.js var require_getISODay = __commonJS({ - "node_modules/date-fns/getISODay/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getISODay; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getISODay(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var day = date.getDay(); + "node_modules/date-fns/getISODay.js"(exports2) { + "use strict"; + exports2.getISODay = getISODay; + var _index = require_toDate(); + function getISODay(date) { + const _date = (0, _index.toDate)(date); + let day = _date.getDay(); if (day === 0) { day = 7; } return day; } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/getISOWeek/index.js -var require_getISOWeek = __commonJS({ - "node_modules/date-fns/getISOWeek/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getISOWeek; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_startOfISOWeek()); - var _index3 = _interopRequireDefault(require_startOfISOWeekYear()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_WEEK = 6048e5; - function getISOWeek(dirtyDate) { - (0, _index4.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var diff = (0, _index2.default)(date).getTime() - (0, _index3.default)(date).getTime(); - return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; - } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getISOWeeksInYear/index.js +// node_modules/date-fns/getISOWeeksInYear.js var require_getISOWeeksInYear = __commonJS({ - "node_modules/date-fns/getISOWeeksInYear/index.js"(exports2, module2) { + "node_modules/date-fns/getISOWeeksInYear.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getISOWeeksInYear; - var _index = _interopRequireDefault(require_startOfISOWeekYear()); - var _index2 = _interopRequireDefault(require_addWeeks()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_WEEK = 6048e5; - function getISOWeeksInYear(dirtyDate) { - (0, _index3.default)(1, arguments); - var thisYear = (0, _index.default)(dirtyDate); - var nextYear = (0, _index.default)((0, _index2.default)(thisYear, 60)); - var diff = nextYear.valueOf() - thisYear.valueOf(); - return Math.round(diff / MILLISECONDS_IN_WEEK); + exports2.getISOWeeksInYear = getISOWeeksInYear; + var _index = require_addWeeks(); + var _index2 = require_constants(); + var _index3 = require_startOfISOWeekYear(); + function getISOWeeksInYear(date) { + const thisYear = (0, _index3.startOfISOWeekYear)(date); + const nextYear = (0, _index3.startOfISOWeekYear)( + (0, _index.addWeeks)(thisYear, 60) + ); + const diff = +nextYear - +thisYear; + return Math.round(diff / _index2.millisecondsInWeek); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getMilliseconds/index.js +// node_modules/date-fns/getMilliseconds.js var require_getMilliseconds = __commonJS({ - "node_modules/date-fns/getMilliseconds/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getMilliseconds; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getMilliseconds(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var milliseconds = date.getMilliseconds(); + "node_modules/date-fns/getMilliseconds.js"(exports2) { + "use strict"; + exports2.getMilliseconds = getMilliseconds; + var _index = require_toDate(); + function getMilliseconds(date) { + const _date = (0, _index.toDate)(date); + const milliseconds = _date.getMilliseconds(); return milliseconds; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getMinutes/index.js +// node_modules/date-fns/getMinutes.js var require_getMinutes = __commonJS({ - "node_modules/date-fns/getMinutes/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getMinutes; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getMinutes(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var minutes = date.getMinutes(); + "node_modules/date-fns/getMinutes.js"(exports2) { + "use strict"; + exports2.getMinutes = getMinutes; + var _index = require_toDate(); + function getMinutes(date) { + const _date = (0, _index.toDate)(date); + const minutes = _date.getMinutes(); return minutes; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getMonth/index.js +// node_modules/date-fns/getMonth.js var require_getMonth = __commonJS({ - "node_modules/date-fns/getMonth/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getMonth; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getMonth(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var month = date.getMonth(); + "node_modules/date-fns/getMonth.js"(exports2) { + "use strict"; + exports2.getMonth = getMonth; + var _index = require_toDate(); + function getMonth(date) { + const _date = (0, _index.toDate)(date); + const month = _date.getMonth(); return month; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getOverlappingDaysInIntervals/index.js +// node_modules/date-fns/getOverlappingDaysInIntervals.js var require_getOverlappingDaysInIntervals = __commonJS({ - "node_modules/date-fns/getOverlappingDaysInIntervals/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getOverlappingDaysInIntervals; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1e3; - function getOverlappingDaysInIntervals(dirtyIntervalLeft, dirtyIntervalRight) { - (0, _index2.default)(2, arguments); - var intervalLeft = dirtyIntervalLeft || {}; - var intervalRight = dirtyIntervalRight || {}; - var leftStartTime = (0, _index.default)(intervalLeft.start).getTime(); - var leftEndTime = (0, _index.default)(intervalLeft.end).getTime(); - var rightStartTime = (0, _index.default)(intervalRight.start).getTime(); - var rightEndTime = (0, _index.default)(intervalRight.end).getTime(); - if (!(leftStartTime <= leftEndTime && rightStartTime <= rightEndTime)) { - throw new RangeError("Invalid interval"); - } - var isOverlapping = leftStartTime < rightEndTime && rightStartTime < leftEndTime; - if (!isOverlapping) { + "node_modules/date-fns/getOverlappingDaysInIntervals.js"(exports2) { + "use strict"; + exports2.getOverlappingDaysInIntervals = getOverlappingDaysInIntervals; + var _index = require_getTimezoneOffsetInMilliseconds(); + var _index2 = require_constants(); + var _index3 = require_toDate(); + function getOverlappingDaysInIntervals(intervalLeft, intervalRight) { + const [leftStart, leftEnd] = [ + +(0, _index3.toDate)(intervalLeft.start), + +(0, _index3.toDate)(intervalLeft.end) + ].sort((a, b) => a - b); + const [rightStart, rightEnd] = [ + +(0, _index3.toDate)(intervalRight.start), + +(0, _index3.toDate)(intervalRight.end) + ].sort((a, b) => a - b); + const isOverlapping = leftStart < rightEnd && rightStart < leftEnd; + if (!isOverlapping) return 0; - } - var overlapStartDate = rightStartTime < leftStartTime ? leftStartTime : rightStartTime; - var overlapEndDate = rightEndTime > leftEndTime ? leftEndTime : rightEndTime; - var differenceInMs = overlapEndDate - overlapStartDate; - return Math.ceil(differenceInMs / MILLISECONDS_IN_DAY); + const overlapLeft = rightStart < leftStart ? leftStart : rightStart; + const left = overlapLeft - (0, _index.getTimezoneOffsetInMilliseconds)(overlapLeft); + const overlapRight = rightEnd > leftEnd ? leftEnd : rightEnd; + const right = overlapRight - (0, _index.getTimezoneOffsetInMilliseconds)(overlapRight); + return Math.ceil((right - left) / _index2.millisecondsInDay); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getSeconds/index.js +// node_modules/date-fns/getSeconds.js var require_getSeconds = __commonJS({ - "node_modules/date-fns/getSeconds/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getSeconds; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getSeconds(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var seconds = date.getSeconds(); + "node_modules/date-fns/getSeconds.js"(exports2) { + "use strict"; + exports2.getSeconds = getSeconds; + var _index = require_toDate(); + function getSeconds(date) { + const _date = (0, _index.toDate)(date); + const seconds = _date.getSeconds(); return seconds; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getTime/index.js +// node_modules/date-fns/getTime.js var require_getTime = __commonJS({ - "node_modules/date-fns/getTime/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getTime; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getTime(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var timestamp = date.getTime(); + "node_modules/date-fns/getTime.js"(exports2) { + "use strict"; + exports2.getTime = getTime; + var _index = require_toDate(); + function getTime(date) { + const _date = (0, _index.toDate)(date); + const timestamp = _date.getTime(); return timestamp; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getUnixTime/index.js +// node_modules/date-fns/getUnixTime.js var require_getUnixTime = __commonJS({ - "node_modules/date-fns/getUnixTime/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getUnixTime; - var _index = _interopRequireDefault(require_getTime()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getUnixTime(dirtyDate) { - (0, _index2.default)(1, arguments); - return Math.floor((0, _index.default)(dirtyDate) / 1e3); - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/getWeekYear/index.js -var require_getWeekYear = __commonJS({ - "node_modules/date-fns/getWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getWeekYear; - var _index = _interopRequireDefault(require_startOfWeek()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_toInteger()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var _index5 = require_defaultOptions(); - function getWeekYear(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index4.default)(1, arguments); - var date = (0, _index2.default)(dirtyDate); - var year = date.getFullYear(); - var defaultOptions = (0, _index5.getDefaultOptions)(); - var firstWeekContainsDate = (0, _index3.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); - } - var firstWeekOfNextYear = /* @__PURE__ */ new Date(0); - firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); - firstWeekOfNextYear.setHours(0, 0, 0, 0); - var startOfNextYear = (0, _index.default)(firstWeekOfNextYear, options); - var firstWeekOfThisYear = /* @__PURE__ */ new Date(0); - firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); - firstWeekOfThisYear.setHours(0, 0, 0, 0); - var startOfThisYear = (0, _index.default)(firstWeekOfThisYear, options); - if (date.getTime() >= startOfNextYear.getTime()) { - return year + 1; - } else if (date.getTime() >= startOfThisYear.getTime()) { - return year; - } else { - return year - 1; - } - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/startOfWeekYear/index.js -var require_startOfWeekYear = __commonJS({ - "node_modules/date-fns/startOfWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfWeekYear; - var _index = _interopRequireDefault(require_getWeekYear()); - var _index2 = _interopRequireDefault(require_startOfWeek()); - var _index3 = _interopRequireDefault(require_toInteger()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var _index5 = require_defaultOptions(); - function startOfWeekYear(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index4.default)(1, arguments); - var defaultOptions = (0, _index5.getDefaultOptions)(); - var firstWeekContainsDate = (0, _index3.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - var year = (0, _index.default)(dirtyDate, options); - var firstWeek = /* @__PURE__ */ new Date(0); - firstWeek.setFullYear(year, 0, firstWeekContainsDate); - firstWeek.setHours(0, 0, 0, 0); - var date = (0, _index2.default)(firstWeek, options); - return date; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/getWeek/index.js -var require_getWeek = __commonJS({ - "node_modules/date-fns/getWeek/index.js"(exports2, module2) { + "node_modules/date-fns/getUnixTime.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getWeek; - var _index = _interopRequireDefault(require_startOfWeek()); - var _index2 = _interopRequireDefault(require_startOfWeekYear()); - var _index3 = _interopRequireDefault(require_toDate()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var MILLISECONDS_IN_WEEK = 6048e5; - function getWeek(dirtyDate, options) { - (0, _index4.default)(1, arguments); - var date = (0, _index3.default)(dirtyDate); - var diff = (0, _index.default)(date, options).getTime() - (0, _index2.default)(date, options).getTime(); - return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; + exports2.getUnixTime = getUnixTime; + var _index = require_toDate(); + function getUnixTime(date) { + return Math.trunc(+(0, _index.toDate)(date) / 1e3); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getWeekOfMonth/index.js +// node_modules/date-fns/getWeekOfMonth.js var require_getWeekOfMonth = __commonJS({ - "node_modules/date-fns/getWeekOfMonth/index.js"(exports2, module2) { + "node_modules/date-fns/getWeekOfMonth.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getWeekOfMonth; - var _index = require_defaultOptions(); - var _index2 = _interopRequireDefault(require_getDate()); - var _index3 = _interopRequireDefault(require_getDay()); - var _index4 = _interopRequireDefault(require_startOfMonth()); - var _index5 = _interopRequireDefault(require_requiredArgs()); - var _index6 = _interopRequireDefault(require_toInteger()); + exports2.getWeekOfMonth = getWeekOfMonth; + var _index = require_getDate(); + var _index2 = require_getDay(); + var _index3 = require_startOfMonth(); + var _index4 = require_defaultOptions(); function getWeekOfMonth(date, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index5.default)(1, arguments); - var defaultOptions = (0, _index.getDefaultOptions)(); - var weekStartsOn = (0, _index6.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - var currentDayOfMonth = (0, _index2.default)(date); + const defaultOptions = (0, _index4.getDefaultOptions)(); + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; + const currentDayOfMonth = (0, _index.getDate)(date); if (isNaN(currentDayOfMonth)) return NaN; - var startWeekDay = (0, _index3.default)((0, _index4.default)(date)); - var lastDayOfFirstWeek = weekStartsOn - startWeekDay; + const startWeekDay = (0, _index2.getDay)((0, _index3.startOfMonth)(date)); + let lastDayOfFirstWeek = weekStartsOn - startWeekDay; if (lastDayOfFirstWeek <= 0) lastDayOfFirstWeek += 7; - var remainingDaysAfterFirstWeek = currentDayOfMonth - lastDayOfFirstWeek; + const remainingDaysAfterFirstWeek = currentDayOfMonth - lastDayOfFirstWeek; return Math.ceil(remainingDaysAfterFirstWeek / 7) + 1; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfMonth/index.js +// node_modules/date-fns/lastDayOfMonth.js var require_lastDayOfMonth = __commonJS({ - "node_modules/date-fns/lastDayOfMonth/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = lastDayOfMonth; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function lastDayOfMonth(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var month = date.getMonth(); - date.setFullYear(date.getFullYear(), month + 1, 0); - date.setHours(0, 0, 0, 0); - return date; + "node_modules/date-fns/lastDayOfMonth.js"(exports2) { + "use strict"; + exports2.lastDayOfMonth = lastDayOfMonth; + var _index = require_toDate(); + function lastDayOfMonth(date) { + const _date = (0, _index.toDate)(date); + const month = _date.getMonth(); + _date.setFullYear(_date.getFullYear(), month + 1, 0); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getWeeksInMonth/index.js +// node_modules/date-fns/getWeeksInMonth.js var require_getWeeksInMonth = __commonJS({ - "node_modules/date-fns/getWeeksInMonth/index.js"(exports2, module2) { + "node_modules/date-fns/getWeeksInMonth.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getWeeksInMonth; - var _index = _interopRequireDefault(require_differenceInCalendarWeeks()); - var _index2 = _interopRequireDefault(require_lastDayOfMonth()); - var _index3 = _interopRequireDefault(require_startOfMonth()); - var _index4 = _interopRequireDefault(require_requiredArgs()); + exports2.getWeeksInMonth = getWeeksInMonth; + var _index = require_differenceInCalendarWeeks(); + var _index2 = require_lastDayOfMonth(); + var _index3 = require_startOfMonth(); function getWeeksInMonth(date, options) { - (0, _index4.default)(1, arguments); - return (0, _index.default)((0, _index2.default)(date), (0, _index3.default)(date), options) + 1; + return (0, _index.differenceInCalendarWeeks)( + (0, _index2.lastDayOfMonth)(date), + (0, _index3.startOfMonth)(date), + options + ) + 1; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/getYear/index.js +// node_modules/date-fns/getYear.js var require_getYear = __commonJS({ - "node_modules/date-fns/getYear/index.js"(exports2, module2) { + "node_modules/date-fns/getYear.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = getYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function getYear(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getFullYear(); + exports2.getYear = getYear; + var _index = require_toDate(); + function getYear(date) { + return (0, _index.toDate)(date).getFullYear(); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/hoursToMilliseconds/index.js +// node_modules/date-fns/hoursToMilliseconds.js var require_hoursToMilliseconds = __commonJS({ - "node_modules/date-fns/hoursToMilliseconds/index.js"(exports2, module2) { + "node_modules/date-fns/hoursToMilliseconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = hoursToMilliseconds; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.hoursToMilliseconds = hoursToMilliseconds; + var _index = require_constants(); function hoursToMilliseconds(hours) { - (0, _index.default)(1, arguments); - return Math.floor(hours * _index2.millisecondsInHour); + return Math.trunc(hours * _index.millisecondsInHour); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/hoursToMinutes/index.js +// node_modules/date-fns/hoursToMinutes.js var require_hoursToMinutes = __commonJS({ - "node_modules/date-fns/hoursToMinutes/index.js"(exports2, module2) { + "node_modules/date-fns/hoursToMinutes.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = hoursToMinutes; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.hoursToMinutes = hoursToMinutes; + var _index = require_constants(); function hoursToMinutes(hours) { - (0, _index.default)(1, arguments); - return Math.floor(hours * _index2.minutesInHour); + return Math.trunc(hours * _index.minutesInHour); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/hoursToSeconds/index.js +// node_modules/date-fns/hoursToSeconds.js var require_hoursToSeconds = __commonJS({ - "node_modules/date-fns/hoursToSeconds/index.js"(exports2, module2) { + "node_modules/date-fns/hoursToSeconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = hoursToSeconds; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.hoursToSeconds = hoursToSeconds; + var _index = require_constants(); function hoursToSeconds(hours) { - (0, _index.default)(1, arguments); - return Math.floor(hours * _index2.secondsInHour); + return Math.trunc(hours * _index.secondsInHour); + } + } +}); + +// node_modules/date-fns/interval.js +var require_interval = __commonJS({ + "node_modules/date-fns/interval.js"(exports2) { + "use strict"; + exports2.interval = interval; + var _index = require_toDate(); + function interval(start, end, options) { + const _start = (0, _index.toDate)(start); + if (isNaN(+_start)) + throw new TypeError("Start date is invalid"); + const _end = (0, _index.toDate)(end); + if (isNaN(+_end)) + throw new TypeError("End date is invalid"); + if (options?.assertPositive && +_start > +_end) + throw new TypeError("End date must be after start date"); + return { start: _start, end: _end }; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/intervalToDuration/index.js +// node_modules/date-fns/intervalToDuration.js var require_intervalToDuration = __commonJS({ - "node_modules/date-fns/intervalToDuration/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = intervalToDuration; - var _index = _interopRequireDefault(require_compareAsc()); - var _index2 = _interopRequireDefault(require_add()); - var _index3 = _interopRequireDefault(require_differenceInDays()); - var _index4 = _interopRequireDefault(require_differenceInHours()); - var _index5 = _interopRequireDefault(require_differenceInMinutes()); - var _index6 = _interopRequireDefault(require_differenceInMonths()); - var _index7 = _interopRequireDefault(require_differenceInSeconds()); - var _index8 = _interopRequireDefault(require_differenceInYears()); - var _index9 = _interopRequireDefault(require_toDate()); - var _index10 = _interopRequireDefault(require_requiredArgs()); + "node_modules/date-fns/intervalToDuration.js"(exports2) { + "use strict"; + exports2.intervalToDuration = intervalToDuration; + var _index = require_add(); + var _index2 = require_differenceInDays(); + var _index3 = require_differenceInHours(); + var _index4 = require_differenceInMinutes(); + var _index5 = require_differenceInMonths(); + var _index6 = require_differenceInSeconds(); + var _index7 = require_differenceInYears(); + var _index8 = require_toDate(); function intervalToDuration(interval) { - (0, _index10.default)(1, arguments); - var start = (0, _index9.default)(interval.start); - var end = (0, _index9.default)(interval.end); - if (isNaN(start.getTime())) - throw new RangeError("Start Date is invalid"); - if (isNaN(end.getTime())) - throw new RangeError("End Date is invalid"); - var duration = {}; - duration.years = Math.abs((0, _index8.default)(end, start)); - var sign = (0, _index.default)(end, start); - var remainingMonths = (0, _index2.default)(start, { - years: sign * duration.years - }); - duration.months = Math.abs((0, _index6.default)(end, remainingMonths)); - var remainingDays = (0, _index2.default)(remainingMonths, { - months: sign * duration.months - }); - duration.days = Math.abs((0, _index3.default)(end, remainingDays)); - var remainingHours = (0, _index2.default)(remainingDays, { - days: sign * duration.days - }); - duration.hours = Math.abs((0, _index4.default)(end, remainingHours)); - var remainingMinutes = (0, _index2.default)(remainingHours, { - hours: sign * duration.hours - }); - duration.minutes = Math.abs((0, _index5.default)(end, remainingMinutes)); - var remainingSeconds = (0, _index2.default)(remainingMinutes, { - minutes: sign * duration.minutes - }); - duration.seconds = Math.abs((0, _index7.default)(end, remainingSeconds)); + const start = (0, _index8.toDate)(interval.start); + const end = (0, _index8.toDate)(interval.end); + const duration = {}; + const years = (0, _index7.differenceInYears)(end, start); + if (years) + duration.years = years; + const remainingMonths = (0, _index.add)(start, { years: duration.years }); + const months = (0, _index5.differenceInMonths)(end, remainingMonths); + if (months) + duration.months = months; + const remainingDays = (0, _index.add)(remainingMonths, { + months: duration.months + }); + const days = (0, _index2.differenceInDays)(end, remainingDays); + if (days) + duration.days = days; + const remainingHours = (0, _index.add)(remainingDays, { + days: duration.days + }); + const hours = (0, _index3.differenceInHours)(end, remainingHours); + if (hours) + duration.hours = hours; + const remainingMinutes = (0, _index.add)(remainingHours, { + hours: duration.hours + }); + const minutes = (0, _index4.differenceInMinutes)(end, remainingMinutes); + if (minutes) + duration.minutes = minutes; + const remainingSeconds = (0, _index.add)(remainingMinutes, { + minutes: duration.minutes + }); + const seconds = (0, _index6.differenceInSeconds)(end, remainingSeconds); + if (seconds) + duration.seconds = seconds; return duration; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/intlFormat/index.js +// node_modules/date-fns/intlFormat.js var require_intlFormat = __commonJS({ - "node_modules/date-fns/intlFormat/index.js"(exports2, module2) { + "node_modules/date-fns/intlFormat.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = intlFormat; - var _index = _interopRequireDefault(require_requiredArgs()); + exports2.intlFormat = intlFormat; + var _index = require_toDate(); function intlFormat(date, formatOrLocale, localeOptions) { - var _localeOptions; - (0, _index.default)(1, arguments); - var formatOptions; + let formatOptions; if (isFormatOptions(formatOrLocale)) { formatOptions = formatOrLocale; } else { localeOptions = formatOrLocale; } - return new Intl.DateTimeFormat((_localeOptions = localeOptions) === null || _localeOptions === void 0 ? void 0 : _localeOptions.locale, formatOptions).format(date); + return new Intl.DateTimeFormat(localeOptions?.locale, formatOptions).format( + (0, _index.toDate)(date) + ); } function isFormatOptions(opts) { return opts !== void 0 && !("locale" in opts); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/intlFormatDistance/index.js +// node_modules/date-fns/intlFormatDistance.js var require_intlFormatDistance = __commonJS({ - "node_modules/date-fns/intlFormatDistance/index.js"(exports2, module2) { + "node_modules/date-fns/intlFormatDistance.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = intlFormatDistance; + exports2.intlFormatDistance = intlFormatDistance; var _index = require_constants(); - var _index2 = _interopRequireDefault(require_differenceInCalendarDays()); - var _index3 = _interopRequireDefault(require_differenceInCalendarMonths()); - var _index4 = _interopRequireDefault(require_differenceInCalendarQuarters()); - var _index5 = _interopRequireDefault(require_differenceInCalendarWeeks()); - var _index6 = _interopRequireDefault(require_differenceInCalendarYears()); - var _index7 = _interopRequireDefault(require_differenceInHours()); - var _index8 = _interopRequireDefault(require_differenceInMinutes()); - var _index9 = _interopRequireDefault(require_differenceInSeconds()); - var _index10 = _interopRequireDefault(require_toDate()); - var _index11 = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_differenceInCalendarDays(); + var _index3 = require_differenceInCalendarMonths(); + var _index4 = require_differenceInCalendarQuarters(); + var _index5 = require_differenceInCalendarWeeks(); + var _index6 = require_differenceInCalendarYears(); + var _index7 = require_differenceInHours(); + var _index8 = require_differenceInMinutes(); + var _index9 = require_differenceInSeconds(); + var _index10 = require_toDate(); function intlFormatDistance(date, baseDate, options) { - (0, _index11.default)(2, arguments); - var value = 0; - var unit; - var dateLeft = (0, _index10.default)(date); - var dateRight = (0, _index10.default)(baseDate); - if (!(options !== null && options !== void 0 && options.unit)) { - var diffInSeconds = (0, _index9.default)(dateLeft, dateRight); + let value = 0; + let unit; + const dateLeft = (0, _index10.toDate)(date); + const dateRight = (0, _index10.toDate)(baseDate); + if (!options?.unit) { + const diffInSeconds = (0, _index9.differenceInSeconds)(dateLeft, dateRight); if (Math.abs(diffInSeconds) < _index.secondsInMinute) { - value = (0, _index9.default)(dateLeft, dateRight); + value = (0, _index9.differenceInSeconds)(dateLeft, dateRight); unit = "second"; } else if (Math.abs(diffInSeconds) < _index.secondsInHour) { - value = (0, _index8.default)(dateLeft, dateRight); + value = (0, _index8.differenceInMinutes)(dateLeft, dateRight); unit = "minute"; - } else if (Math.abs(diffInSeconds) < _index.secondsInDay && Math.abs((0, _index2.default)(dateLeft, dateRight)) < 1) { - value = (0, _index7.default)(dateLeft, dateRight); + } else if (Math.abs(diffInSeconds) < _index.secondsInDay && Math.abs((0, _index2.differenceInCalendarDays)(dateLeft, dateRight)) < 1) { + value = (0, _index7.differenceInHours)(dateLeft, dateRight); unit = "hour"; - } else if (Math.abs(diffInSeconds) < _index.secondsInWeek && (value = (0, _index2.default)(dateLeft, dateRight)) && Math.abs(value) < 7) { + } else if (Math.abs(diffInSeconds) < _index.secondsInWeek && (value = (0, _index2.differenceInCalendarDays)(dateLeft, dateRight)) && Math.abs(value) < 7) { unit = "day"; } else if (Math.abs(diffInSeconds) < _index.secondsInMonth) { - value = (0, _index5.default)(dateLeft, dateRight); + value = (0, _index5.differenceInCalendarWeeks)(dateLeft, dateRight); unit = "week"; } else if (Math.abs(diffInSeconds) < _index.secondsInQuarter) { - value = (0, _index3.default)(dateLeft, dateRight); + value = (0, _index3.differenceInCalendarMonths)(dateLeft, dateRight); unit = "month"; } else if (Math.abs(diffInSeconds) < _index.secondsInYear) { - if ((0, _index4.default)(dateLeft, dateRight) < 4) { - value = (0, _index4.default)(dateLeft, dateRight); + if ((0, _index4.differenceInCalendarQuarters)(dateLeft, dateRight) < 4) { + value = (0, _index4.differenceInCalendarQuarters)(dateLeft, dateRight); unit = "quarter"; } else { - value = (0, _index6.default)(dateLeft, dateRight); + value = (0, _index6.differenceInCalendarYears)(dateLeft, dateRight); unit = "year"; } } else { - value = (0, _index6.default)(dateLeft, dateRight); + value = (0, _index6.differenceInCalendarYears)(dateLeft, dateRight); unit = "year"; } } else { - unit = options === null || options === void 0 ? void 0 : options.unit; + unit = options?.unit; if (unit === "second") { - value = (0, _index9.default)(dateLeft, dateRight); + value = (0, _index9.differenceInSeconds)(dateLeft, dateRight); } else if (unit === "minute") { - value = (0, _index8.default)(dateLeft, dateRight); + value = (0, _index8.differenceInMinutes)(dateLeft, dateRight); } else if (unit === "hour") { - value = (0, _index7.default)(dateLeft, dateRight); + value = (0, _index7.differenceInHours)(dateLeft, dateRight); } else if (unit === "day") { - value = (0, _index2.default)(dateLeft, dateRight); + value = (0, _index2.differenceInCalendarDays)(dateLeft, dateRight); } else if (unit === "week") { - value = (0, _index5.default)(dateLeft, dateRight); + value = (0, _index5.differenceInCalendarWeeks)(dateLeft, dateRight); } else if (unit === "month") { - value = (0, _index3.default)(dateLeft, dateRight); + value = (0, _index3.differenceInCalendarMonths)(dateLeft, dateRight); } else if (unit === "quarter") { - value = (0, _index4.default)(dateLeft, dateRight); + value = (0, _index4.differenceInCalendarQuarters)(dateLeft, dateRight); } else if (unit === "year") { - value = (0, _index6.default)(dateLeft, dateRight); + value = (0, _index6.differenceInCalendarYears)(dateLeft, dateRight); } } - var rtf = new Intl.RelativeTimeFormat(options === null || options === void 0 ? void 0 : options.locale, { - localeMatcher: options === null || options === void 0 ? void 0 : options.localeMatcher, - numeric: (options === null || options === void 0 ? void 0 : options.numeric) || "auto", - style: options === null || options === void 0 ? void 0 : options.style + const rtf = new Intl.RelativeTimeFormat(options?.locale, { + localeMatcher: options?.localeMatcher, + numeric: options?.numeric || "auto", + style: options?.style }); return rtf.format(value, unit); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isAfter/index.js +// node_modules/date-fns/isAfter.js var require_isAfter = __commonJS({ - "node_modules/date-fns/isAfter/index.js"(exports2, module2) { + "node_modules/date-fns/isAfter.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isAfter; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isAfter(dirtyDate, dirtyDateToCompare) { - (0, _index2.default)(2, arguments); - var date = (0, _index.default)(dirtyDate); - var dateToCompare = (0, _index.default)(dirtyDateToCompare); - return date.getTime() > dateToCompare.getTime(); + exports2.isAfter = isAfter; + var _index = require_toDate(); + function isAfter(date, dateToCompare) { + const _date = (0, _index.toDate)(date); + const _dateToCompare = (0, _index.toDate)(dateToCompare); + return _date.getTime() > _dateToCompare.getTime(); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isBefore/index.js +// node_modules/date-fns/isBefore.js var require_isBefore = __commonJS({ - "node_modules/date-fns/isBefore/index.js"(exports2, module2) { + "node_modules/date-fns/isBefore.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isBefore; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isBefore(dirtyDate, dirtyDateToCompare) { - (0, _index2.default)(2, arguments); - var date = (0, _index.default)(dirtyDate); - var dateToCompare = (0, _index.default)(dirtyDateToCompare); - return date.getTime() < dateToCompare.getTime(); + exports2.isBefore = isBefore; + var _index = require_toDate(); + function isBefore(date, dateToCompare) { + const _date = (0, _index.toDate)(date); + const _dateToCompare = (0, _index.toDate)(dateToCompare); + return +_date < +_dateToCompare; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isEqual/index.js +// node_modules/date-fns/isEqual.js var require_isEqual = __commonJS({ - "node_modules/date-fns/isEqual/index.js"(exports2, module2) { + "node_modules/date-fns/isEqual.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isEqual; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isEqual(dirtyLeftDate, dirtyRightDate) { - (0, _index2.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyLeftDate); - var dateRight = (0, _index.default)(dirtyRightDate); - return dateLeft.getTime() === dateRight.getTime(); + exports2.isEqual = isEqual; + var _index = require_toDate(); + function isEqual(leftDate, rightDate) { + const _dateLeft = (0, _index.toDate)(leftDate); + const _dateRight = (0, _index.toDate)(rightDate); + return +_dateLeft === +_dateRight; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isExists/index.js +// node_modules/date-fns/isExists.js var require_isExists = __commonJS({ - "node_modules/date-fns/isExists/index.js"(exports2, module2) { + "node_modules/date-fns/isExists.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isExists; + exports2.isExists = isExists; function isExists(year, month, day) { - if (arguments.length < 3) { - throw new TypeError("3 argument required, but only " + arguments.length + " present"); - } - var date = new Date(year, month, day); + const date = new Date(year, month, day); return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isFirstDayOfMonth/index.js +// node_modules/date-fns/isFirstDayOfMonth.js var require_isFirstDayOfMonth = __commonJS({ - "node_modules/date-fns/isFirstDayOfMonth/index.js"(exports2, module2) { + "node_modules/date-fns/isFirstDayOfMonth.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isFirstDayOfMonth; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isFirstDayOfMonth(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getDate() === 1; + exports2.isFirstDayOfMonth = isFirstDayOfMonth; + var _index = require_toDate(); + function isFirstDayOfMonth(date) { + return (0, _index.toDate)(date).getDate() === 1; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isFriday/index.js +// node_modules/date-fns/isFriday.js var require_isFriday = __commonJS({ - "node_modules/date-fns/isFriday/index.js"(exports2, module2) { + "node_modules/date-fns/isFriday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isFriday; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isFriday(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getDay() === 5; + exports2.isFriday = isFriday; + var _index = require_toDate(); + function isFriday(date) { + return (0, _index.toDate)(date).getDay() === 5; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isFuture/index.js +// node_modules/date-fns/isFuture.js var require_isFuture = __commonJS({ - "node_modules/date-fns/isFuture/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isFuture; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isFuture(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getTime() > Date.now(); - } - module2.exports = exports2.default; - } -}); - -// node_modules/@babel/runtime/helpers/arrayLikeToArray.js -var require_arrayLikeToArray = __commonJS({ - "node_modules/@babel/runtime/helpers/arrayLikeToArray.js"(exports2, module2) { - function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) - len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) - arr2[i] = arr[i]; - return arr2; - } - module2.exports = _arrayLikeToArray, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js -var require_unsupportedIterableToArray = __commonJS({ - "node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"(exports2, module2) { - var arrayLikeToArray = require_arrayLikeToArray(); - function _unsupportedIterableToArray(o, minLen) { - if (!o) - return; - if (typeof o === "string") - return arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) - n = o.constructor.name; - if (n === "Map" || n === "Set") - return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) - return arrayLikeToArray(o, minLen); - } - module2.exports = _unsupportedIterableToArray, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js -var require_createForOfIteratorHelper = __commonJS({ - "node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js"(exports2, module2) { - var unsupportedIterableToArray = require_unsupportedIterableToArray(); - function _createForOfIteratorHelper(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (!it) { - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) - o = it; - var i = 0; - var F = function F2() { - }; - return { - s: F, - n: function n() { - if (i >= o.length) - return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function e(_e) { - throw _e; - }, - f: F - }; - } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - var normalCompletion = true, didErr = false, err; - return { - s: function s() { - it = it.call(o); - }, - n: function n() { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function e(_e2) { - didErr = true; - err = _e2; - }, - f: function f() { - try { - if (!normalCompletion && it["return"] != null) - it["return"](); - } finally { - if (didErr) - throw err; - } - } - }; - } - module2.exports = _createForOfIteratorHelper, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/assertThisInitialized.js -var require_assertThisInitialized = __commonJS({ - "node_modules/@babel/runtime/helpers/assertThisInitialized.js"(exports2, module2) { - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self; - } - module2.exports = _assertThisInitialized, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/setPrototypeOf.js -var require_setPrototypeOf = __commonJS({ - "node_modules/@babel/runtime/helpers/setPrototypeOf.js"(exports2, module2) { - function _setPrototypeOf(o, p) { - module2.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { - o2.__proto__ = p2; - return o2; - }, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - return _setPrototypeOf(o, p); - } - module2.exports = _setPrototypeOf, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/inherits.js -var require_inherits = __commonJS({ - "node_modules/@babel/runtime/helpers/inherits.js"(exports2, module2) { - var setPrototypeOf = require_setPrototypeOf(); - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - Object.defineProperty(subClass, "prototype", { - writable: false - }); - if (superClass) - setPrototypeOf(subClass, superClass); - } - module2.exports = _inherits, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/getPrototypeOf.js -var require_getPrototypeOf = __commonJS({ - "node_modules/@babel/runtime/helpers/getPrototypeOf.js"(exports2, module2) { - function _getPrototypeOf(o) { - module2.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { - return o2.__proto__ || Object.getPrototypeOf(o2); - }, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - return _getPrototypeOf(o); - } - module2.exports = _getPrototypeOf, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js -var require_isNativeReflectConstruct = __commonJS({ - "node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js"(exports2, module2) { - function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) - return false; - if (Reflect.construct.sham) - return false; - if (typeof Proxy === "function") - return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { - })); - return true; - } catch (e) { - return false; - } - } - module2.exports = _isNativeReflectConstruct, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/possibleConstructorReturn.js -var require_possibleConstructorReturn = __commonJS({ - "node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"(exports2, module2) { - var _typeof = require_typeof()["default"]; - var assertThisInitialized = require_assertThisInitialized(); - function _possibleConstructorReturn(self, call) { - if (call && (_typeof(call) === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - return assertThisInitialized(self); - } - module2.exports = _possibleConstructorReturn, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/createSuper.js -var require_createSuper = __commonJS({ - "node_modules/@babel/runtime/helpers/createSuper.js"(exports2, module2) { - var getPrototypeOf = require_getPrototypeOf(); - var isNativeReflectConstruct = require_isNativeReflectConstruct(); - var possibleConstructorReturn = require_possibleConstructorReturn(); - function _createSuper(Derived) { - var hasNativeReflectConstruct = isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = getPrototypeOf(Derived), result; - if (hasNativeReflectConstruct) { - var NewTarget = getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - return possibleConstructorReturn(this, result); - }; - } - module2.exports = _createSuper, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/classCallCheck.js -var require_classCallCheck = __commonJS({ - "node_modules/@babel/runtime/helpers/classCallCheck.js"(exports2, module2) { - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - module2.exports = _classCallCheck, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/toPrimitive.js -var require_toPrimitive = __commonJS({ - "node_modules/@babel/runtime/helpers/toPrimitive.js"(exports2, module2) { - var _typeof = require_typeof()["default"]; - function _toPrimitive(input, hint) { - if (_typeof(input) !== "object" || input === null) - return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== void 0) { - var res = prim.call(input, hint || "default"); - if (_typeof(res) !== "object") - return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return (hint === "string" ? String : Number)(input); - } - module2.exports = _toPrimitive, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/toPropertyKey.js -var require_toPropertyKey = __commonJS({ - "node_modules/@babel/runtime/helpers/toPropertyKey.js"(exports2, module2) { - var _typeof = require_typeof()["default"]; - var toPrimitive = require_toPrimitive(); - function _toPropertyKey(arg) { - var key = toPrimitive(arg, "string"); - return _typeof(key) === "symbol" ? key : String(key); - } - module2.exports = _toPropertyKey, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; - } -}); - -// node_modules/@babel/runtime/helpers/createClass.js -var require_createClass = __commonJS({ - "node_modules/@babel/runtime/helpers/createClass.js"(exports2, module2) { - var toPropertyKey = require_toPropertyKey(); - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor); - } - } - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - if (staticProps) - _defineProperties(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - writable: false - }); - return Constructor; + "node_modules/date-fns/isFuture.js"(exports2) { + "use strict"; + exports2.isFuture = isFuture; + var _index = require_toDate(); + function isFuture(date) { + return +(0, _index.toDate)(date) > Date.now(); } - module2.exports = _createClass, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; } }); -// node_modules/@babel/runtime/helpers/defineProperty.js -var require_defineProperty = __commonJS({ - "node_modules/@babel/runtime/helpers/defineProperty.js"(exports2, module2) { - var toPropertyKey = require_toPropertyKey(); - function _defineProperty(obj, key, value) { - key = toPropertyKey(key); - if (key in obj) { - Object.defineProperty(obj, key, { - value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; +// node_modules/date-fns/transpose.js +var require_transpose = __commonJS({ + "node_modules/date-fns/transpose.js"(exports2) { + "use strict"; + exports2.transpose = transpose; + var _index = require_constructFrom(); + function transpose(fromDate, constructor) { + const date = constructor instanceof Date ? (0, _index.constructFrom)(constructor, 0) : new constructor(0); + date.setFullYear( + fromDate.getFullYear(), + fromDate.getMonth(), + fromDate.getDate() + ); + date.setHours( + fromDate.getHours(), + fromDate.getMinutes(), + fromDate.getSeconds(), + fromDate.getMilliseconds() + ); + return date; } - module2.exports = _defineProperty, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; } }); @@ -8765,91 +7006,45 @@ var require_defineProperty = __commonJS({ var require_Setter = __commonJS({ "node_modules/date-fns/parse/_lib/Setter.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.ValueSetter = exports2.Setter = exports2.DateToSystemTimezoneSetter = void 0; - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); + var _index = require_transpose(); + var _index2 = require_constructFrom(); var TIMEZONE_UNIT_PRIORITY = 10; - var Setter = /* @__PURE__ */ function() { - function Setter2() { - (0, _classCallCheck2.default)(this, Setter2); - (0, _defineProperty2.default)(this, "priority", void 0); - (0, _defineProperty2.default)(this, "subPriority", 0); - } - (0, _createClass2.default)(Setter2, [{ - key: "validate", - value: function validate2(_utcDate, _options) { - return true; - } - }]); - return Setter2; - }(); + var Setter = class { + subPriority = 0; + validate(_utcDate, _options) { + return true; + } + }; exports2.Setter = Setter; - var ValueSetter = /* @__PURE__ */ function(_Setter) { - (0, _inherits2.default)(ValueSetter2, _Setter); - var _super = (0, _createSuper2.default)(ValueSetter2); - function ValueSetter2(value, validateValue, setValue, priority, subPriority) { - var _this; - (0, _classCallCheck2.default)(this, ValueSetter2); - _this = _super.call(this); - _this.value = value; - _this.validateValue = validateValue; - _this.setValue = setValue; - _this.priority = priority; + var ValueSetter = class extends Setter { + constructor(value, validateValue, setValue, priority, subPriority) { + super(); + this.value = value; + this.validateValue = validateValue; + this.setValue = setValue; + this.priority = priority; if (subPriority) { - _this.subPriority = subPriority; + this.subPriority = subPriority; } - return _this; } - (0, _createClass2.default)(ValueSetter2, [{ - key: "validate", - value: function validate2(utcDate, options) { - return this.validateValue(utcDate, this.value, options); - } - }, { - key: "set", - value: function set(utcDate, flags, options) { - return this.setValue(utcDate, flags, this.value, options); - } - }]); - return ValueSetter2; - }(Setter); + validate(date, options) { + return this.validateValue(date, this.value, options); + } + set(date, flags, options) { + return this.setValue(date, flags, this.value, options); + } + }; exports2.ValueSetter = ValueSetter; - var DateToSystemTimezoneSetter = /* @__PURE__ */ function(_Setter2) { - (0, _inherits2.default)(DateToSystemTimezoneSetter2, _Setter2); - var _super2 = (0, _createSuper2.default)(DateToSystemTimezoneSetter2); - function DateToSystemTimezoneSetter2() { - var _this2; - (0, _classCallCheck2.default)(this, DateToSystemTimezoneSetter2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this2 = _super2.call.apply(_super2, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "priority", TIMEZONE_UNIT_PRIORITY); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "subPriority", -1); - return _this2; - } - (0, _createClass2.default)(DateToSystemTimezoneSetter2, [{ - key: "set", - value: function set(date, flags) { - if (flags.timestampIsSet) { - return date; - } - var convertedDate = /* @__PURE__ */ new Date(0); - convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()); - convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()); - return convertedDate; - } - }]); - return DateToSystemTimezoneSetter2; - }(Setter); + var DateToSystemTimezoneSetter = class extends Setter { + priority = TIMEZONE_UNIT_PRIORITY; + subPriority = -1; + set(date, flags) { + if (flags.timestampIsSet) + return date; + return (0, _index2.constructFrom)(date, (0, _index.transpose)(date, Date)); + } + }; exports2.DateToSystemTimezoneSetter = DateToSystemTimezoneSetter; } }); @@ -8858,42 +7053,29 @@ var require_Setter = __commonJS({ var require_Parser = __commonJS({ "node_modules/date-fns/parse/_lib/Parser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.Parser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); var _Setter = require_Setter(); - var Parser = /* @__PURE__ */ function() { - function Parser2() { - (0, _classCallCheck2.default)(this, Parser2); - (0, _defineProperty2.default)(this, "incompatibleTokens", void 0); - (0, _defineProperty2.default)(this, "priority", void 0); - (0, _defineProperty2.default)(this, "subPriority", void 0); - } - (0, _createClass2.default)(Parser2, [{ - key: "run", - value: function run(dateString, token, match, options) { - var result = this.parse(dateString, token, match, options); - if (!result) { - return null; - } - return { - setter: new _Setter.ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority), - rest: result.rest - }; - } - }, { - key: "validate", - value: function validate2(_utcDate, _value, _options) { - return true; + var Parser = class { + run(dateString, token, match, options) { + const result = this.parse(dateString, token, match, options); + if (!result) { + return null; } - }]); - return Parser2; - }(); + return { + setter: new _Setter.ValueSetter( + result.value, + this.validate, + this.set, + this.priority, + this.subPriority + ), + rest: result.rest + }; + } + validate(_utcDate, _value, _options) { + return true; + } + }; exports2.Parser = Parser; } }); @@ -8902,70 +7084,31 @@ var require_Parser = __commonJS({ var require_EraParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/EraParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.EraParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); - var EraParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(EraParser2, _Parser); - var _super = (0, _createSuper2.default)(EraParser2); - function EraParser2() { - var _this; - (0, _classCallCheck2.default)(this, EraParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 140); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["R", "u", "t", "T"]); - return _this; - } - (0, _createClass2.default)(EraParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "G": - case "GG": - case "GGG": - return match.era(dateString, { - width: "abbreviated" - }) || match.era(dateString, { - width: "narrow" - }); - case "GGGGG": - return match.era(dateString, { - width: "narrow" - }); - case "GGGG": - default: - return match.era(dateString, { - width: "wide" - }) || match.era(dateString, { - width: "abbreviated" - }) || match.era(dateString, { - width: "narrow" - }); - } - } - }, { - key: "set", - value: function set(date, flags, value) { - flags.era = value; - date.setUTCFullYear(value, 0, 1); - date.setUTCHours(0, 0, 0, 0); - return date; + var _Parser = require_Parser(); + var EraParser = class extends _Parser.Parser { + priority = 140; + parse(dateString, token, match) { + switch (token) { + case "G": + case "GG": + case "GGG": + return match.era(dateString, { width: "abbreviated" }) || match.era(dateString, { width: "narrow" }); + case "GGGGG": + return match.era(dateString, { width: "narrow" }); + case "GGGG": + default: + return match.era(dateString, { width: "wide" }) || match.era(dateString, { width: "abbreviated" }) || match.era(dateString, { width: "narrow" }); } - }]); - return EraParser2; - }(_Parser2.Parser); + } + set(date, flags, value) { + flags.era = value; + date.setFullYear(value, 0, 1); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = ["R", "u", "t", "T"]; + }; exports2.EraParser = EraParser; } }); @@ -8974,11 +7117,8 @@ var require_EraParser = __commonJS({ var require_constants2 = __commonJS({ "node_modules/date-fns/parse/_lib/constants.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.timezonePatterns = exports2.numericPatterns = void 0; - var numericPatterns = { + var numericPatterns = exports2.numericPatterns = { month: /^(1[0-2]|0?\d)/, // 0 to 12 date: /^(3[0-1]|[0-2]?\d)/, @@ -9017,15 +7157,13 @@ var require_constants2 = __commonJS({ fourDigitsSigned: /^-?\d{1,4}/ // 0 to 9999, -0 to -9999 }; - exports2.numericPatterns = numericPatterns; - var timezonePatterns = { + var timezonePatterns = exports2.timezonePatterns = { basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/, basic: /^([+-])(\d{2})(\d{2})|Z/, basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/, extended: /^([+-])(\d{2}):(\d{2})|Z/, extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/ }; - exports2.timezonePatterns = timezonePatterns; } }); @@ -9033,9 +7171,6 @@ var require_constants2 = __commonJS({ var require_utils2 = __commonJS({ "node_modules/date-fns/parse/_lib/utils.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.dayPeriodEnumToHours = dayPeriodEnumToHours; exports2.isLeapYearIndex = isLeapYearIndex; exports2.mapValue = mapValue; @@ -9057,7 +7192,7 @@ var require_utils2 = __commonJS({ }; } function parseNumericPattern(pattern, dateString) { - var matchResult = dateString.match(pattern); + const matchResult = dateString.match(pattern); if (!matchResult) { return null; } @@ -9067,7 +7202,7 @@ var require_utils2 = __commonJS({ }; } function parseTimezonePattern(pattern, dateString) { - var matchResult = dateString.match(pattern); + const matchResult = dateString.match(pattern); if (!matchResult) { return null; } @@ -9077,28 +7212,43 @@ var require_utils2 = __commonJS({ rest: dateString.slice(1) }; } - var sign = matchResult[1] === "+" ? 1 : -1; - var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0; - var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0; - var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0; + const sign = matchResult[1] === "+" ? 1 : -1; + const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0; + const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0; + const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0; return { value: sign * (hours * _index.millisecondsInHour + minutes * _index.millisecondsInMinute + seconds * _index.millisecondsInSecond), rest: dateString.slice(matchResult[0].length) }; } function parseAnyDigitsSigned(dateString) { - return parseNumericPattern(_constants.numericPatterns.anyDigitsSigned, dateString); + return parseNumericPattern( + _constants.numericPatterns.anyDigitsSigned, + dateString + ); } function parseNDigits(n, dateString) { switch (n) { case 1: - return parseNumericPattern(_constants.numericPatterns.singleDigit, dateString); + return parseNumericPattern( + _constants.numericPatterns.singleDigit, + dateString + ); case 2: - return parseNumericPattern(_constants.numericPatterns.twoDigits, dateString); + return parseNumericPattern( + _constants.numericPatterns.twoDigits, + dateString + ); case 3: - return parseNumericPattern(_constants.numericPatterns.threeDigits, dateString); + return parseNumericPattern( + _constants.numericPatterns.threeDigits, + dateString + ); case 4: - return parseNumericPattern(_constants.numericPatterns.fourDigits, dateString); + return parseNumericPattern( + _constants.numericPatterns.fourDigits, + dateString + ); default: return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString); } @@ -9106,13 +7256,25 @@ var require_utils2 = __commonJS({ function parseNDigitsSigned(n, dateString) { switch (n) { case 1: - return parseNumericPattern(_constants.numericPatterns.singleDigitSigned, dateString); + return parseNumericPattern( + _constants.numericPatterns.singleDigitSigned, + dateString + ); case 2: - return parseNumericPattern(_constants.numericPatterns.twoDigitsSigned, dateString); + return parseNumericPattern( + _constants.numericPatterns.twoDigitsSigned, + dateString + ); case 3: - return parseNumericPattern(_constants.numericPatterns.threeDigitsSigned, dateString); + return parseNumericPattern( + _constants.numericPatterns.threeDigitsSigned, + dateString + ); case 4: - return parseNumericPattern(_constants.numericPatterns.fourDigitsSigned, dateString); + return parseNumericPattern( + _constants.numericPatterns.fourDigitsSigned, + dateString + ); default: return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString); } @@ -9135,15 +7297,15 @@ var require_utils2 = __commonJS({ } } function normalizeTwoDigitYear(twoDigitYear, currentYear) { - var isCommonEra = currentYear > 0; - var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear; - var result; + const isCommonEra = currentYear > 0; + const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear; + let result; if (absCurrentYear <= 50) { result = twoDigitYear || 100; } else { - var rangeEnd = absCurrentYear + 50; - var rangeEndCentury = Math.floor(rangeEnd / 100) * 100; - var isPreviousCentury = twoDigitYear >= rangeEnd % 100; + const rangeEnd = absCurrentYear + 50; + const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100; + const isPreviousCentury = twoDigitYear >= rangeEnd % 100; result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0); } return isCommonEra ? result : 1 - result; @@ -9158,76 +7320,57 @@ var require_utils2 = __commonJS({ var require_YearParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/YearParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.YearParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var YearParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(YearParser2, _Parser); - var _super = (0, _createSuper2.default)(YearParser2); - function YearParser2() { - var _this; - (0, _classCallCheck2.default)(this, YearParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 130); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(YearParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - var valueCallback = function valueCallback2(year) { - return { - year, - isTwoDigitYear: token === "yy" - }; - }; - switch (token) { - case "y": - return (0, _utils.mapValue)((0, _utils.parseNDigits)(4, dateString), valueCallback); - case "yo": - return (0, _utils.mapValue)(match.ordinalNumber(dateString, { + var YearParser = class extends _Parser.Parser { + priority = 130; + incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]; + parse(dateString, token, match) { + const valueCallback = (year) => ({ + year, + isTwoDigitYear: token === "yy" + }); + switch (token) { + case "y": + return (0, _utils.mapValue)( + (0, _utils.parseNDigits)(4, dateString), + valueCallback + ); + case "yo": + return (0, _utils.mapValue)( + match.ordinalNumber(dateString, { unit: "year" - }), valueCallback); - default: - return (0, _utils.mapValue)((0, _utils.parseNDigits)(token.length, dateString), valueCallback); - } + }), + valueCallback + ); + default: + return (0, _utils.mapValue)( + (0, _utils.parseNDigits)(token.length, dateString), + valueCallback + ); } - }, { - key: "validate", - value: function validate2(_date, value) { - return value.isTwoDigitYear || value.year > 0; - } - }, { - key: "set", - value: function set(date, flags, value) { - var currentYear = date.getUTCFullYear(); - if (value.isTwoDigitYear) { - var normalizedTwoDigitYear = (0, _utils.normalizeTwoDigitYear)(value.year, currentYear); - date.setUTCFullYear(normalizedTwoDigitYear, 0, 1); - date.setUTCHours(0, 0, 0, 0); - return date; - } - var year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year; - date.setUTCFullYear(year, 0, 1); - date.setUTCHours(0, 0, 0, 0); + } + validate(_date, value) { + return value.isTwoDigitYear || value.year > 0; + } + set(date, flags, value) { + const currentYear = date.getFullYear(); + if (value.isTwoDigitYear) { + const normalizedTwoDigitYear = (0, _utils.normalizeTwoDigitYear)( + value.year, + currentYear + ); + date.setFullYear(normalizedTwoDigitYear, 0, 1); + date.setHours(0, 0, 0, 0); return date; } - }]); - return YearParser2; - }(_Parser2.Parser); + const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year; + date.setFullYear(year, 0, 1); + date.setHours(0, 0, 0, 0); + return date; + } + }; exports2.YearParser = YearParser; } }); @@ -9236,78 +7379,77 @@ var require_YearParser = __commonJS({ var require_LocalWeekYearParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.LocalWeekYearParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_getWeekYear(); + var _index2 = require_startOfWeek(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var _index = _interopRequireDefault(require_getUTCWeekYear()); - var _index2 = _interopRequireDefault(require_startOfUTCWeek()); - var LocalWeekYearParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(LocalWeekYearParser2, _Parser); - var _super = (0, _createSuper2.default)(LocalWeekYearParser2); - function LocalWeekYearParser2() { - var _this; - (0, _classCallCheck2.default)(this, LocalWeekYearParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 130); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["y", "R", "u", "Q", "q", "M", "L", "I", "d", "D", "i", "t", "T"]); - return _this; - } - (0, _createClass2.default)(LocalWeekYearParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - var valueCallback = function valueCallback2(year) { - return { - year, - isTwoDigitYear: token === "YY" - }; - }; - switch (token) { - case "Y": - return (0, _utils.mapValue)((0, _utils.parseNDigits)(4, dateString), valueCallback); - case "Yo": - return (0, _utils.mapValue)(match.ordinalNumber(dateString, { + var LocalWeekYearParser = class extends _Parser.Parser { + priority = 130; + parse(dateString, token, match) { + const valueCallback = (year) => ({ + year, + isTwoDigitYear: token === "YY" + }); + switch (token) { + case "Y": + return (0, _utils.mapValue)( + (0, _utils.parseNDigits)(4, dateString), + valueCallback + ); + case "Yo": + return (0, _utils.mapValue)( + match.ordinalNumber(dateString, { unit: "year" - }), valueCallback); - default: - return (0, _utils.mapValue)((0, _utils.parseNDigits)(token.length, dateString), valueCallback); - } + }), + valueCallback + ); + default: + return (0, _utils.mapValue)( + (0, _utils.parseNDigits)(token.length, dateString), + valueCallback + ); } - }, { - key: "validate", - value: function validate2(_date, value) { - return value.isTwoDigitYear || value.year > 0; - } - }, { - key: "set", - value: function set(date, flags, value, options) { - var currentYear = (0, _index.default)(date, options); - if (value.isTwoDigitYear) { - var normalizedTwoDigitYear = (0, _utils.normalizeTwoDigitYear)(value.year, currentYear); - date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate); - date.setUTCHours(0, 0, 0, 0); - return (0, _index2.default)(date, options); - } - var year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year; - date.setUTCFullYear(year, 0, options.firstWeekContainsDate); - date.setUTCHours(0, 0, 0, 0); - return (0, _index2.default)(date, options); - } - }]); - return LocalWeekYearParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value.isTwoDigitYear || value.year > 0; + } + set(date, flags, value, options) { + const currentYear = (0, _index.getWeekYear)(date, options); + if (value.isTwoDigitYear) { + const normalizedTwoDigitYear = (0, _utils.normalizeTwoDigitYear)( + value.year, + currentYear + ); + date.setFullYear( + normalizedTwoDigitYear, + 0, + options.firstWeekContainsDate + ); + date.setHours(0, 0, 0, 0); + return (0, _index2.startOfWeek)(date, options); + } + const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year; + date.setFullYear(year, 0, options.firstWeekContainsDate); + date.setHours(0, 0, 0, 0); + return (0, _index2.startOfWeek)(date, options); + } + incompatibleTokens = [ + "y", + "R", + "u", + "Q", + "q", + "M", + "L", + "I", + "d", + "D", + "i", + "t", + "T" + ]; + }; exports2.LocalWeekYearParser = LocalWeekYearParser; } }); @@ -9316,53 +7458,43 @@ var require_LocalWeekYearParser = __commonJS({ var require_ISOWeekYearParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.ISOWeekYearParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_startOfISOWeek(); + var _index2 = require_constructFrom(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var _index = _interopRequireDefault(require_startOfUTCISOWeek()); - var ISOWeekYearParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(ISOWeekYearParser2, _Parser); - var _super = (0, _createSuper2.default)(ISOWeekYearParser2); - function ISOWeekYearParser2() { - var _this; - (0, _classCallCheck2.default)(this, ISOWeekYearParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 130); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["G", "y", "Y", "u", "Q", "q", "M", "L", "w", "d", "D", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(ISOWeekYearParser2, [{ - key: "parse", - value: function parse2(dateString, token) { - if (token === "R") { - return (0, _utils.parseNDigitsSigned)(4, dateString); - } - return (0, _utils.parseNDigitsSigned)(token.length, dateString); - } - }, { - key: "set", - value: function set(_date, _flags, value) { - var firstWeekOfYear = /* @__PURE__ */ new Date(0); - firstWeekOfYear.setUTCFullYear(value, 0, 4); - firstWeekOfYear.setUTCHours(0, 0, 0, 0); - return (0, _index.default)(firstWeekOfYear); - } - }]); - return ISOWeekYearParser2; - }(_Parser2.Parser); + var ISOWeekYearParser = class extends _Parser.Parser { + priority = 130; + parse(dateString, token) { + if (token === "R") { + return (0, _utils.parseNDigitsSigned)(4, dateString); + } + return (0, _utils.parseNDigitsSigned)(token.length, dateString); + } + set(date, _flags, value) { + const firstWeekOfYear = (0, _index2.constructFrom)(date, 0); + firstWeekOfYear.setFullYear(value, 0, 4); + firstWeekOfYear.setHours(0, 0, 0, 0); + return (0, _index.startOfISOWeek)(firstWeekOfYear); + } + incompatibleTokens = [ + "G", + "y", + "Y", + "u", + "Q", + "q", + "M", + "L", + "w", + "d", + "D", + "e", + "c", + "t", + "T" + ]; + }; exports2.ISOWeekYearParser = ISOWeekYearParser; } }); @@ -9371,51 +7503,24 @@ var require_ISOWeekYearParser = __commonJS({ var require_ExtendedYearParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.ExtendedYearParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var ExtendedYearParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(ExtendedYearParser2, _Parser); - var _super = (0, _createSuper2.default)(ExtendedYearParser2); - function ExtendedYearParser2() { - var _this; - (0, _classCallCheck2.default)(this, ExtendedYearParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 130); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(ExtendedYearParser2, [{ - key: "parse", - value: function parse2(dateString, token) { - if (token === "u") { - return (0, _utils.parseNDigitsSigned)(4, dateString); - } - return (0, _utils.parseNDigitsSigned)(token.length, dateString); - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCFullYear(value, 0, 1); - date.setUTCHours(0, 0, 0, 0); - return date; + var ExtendedYearParser = class extends _Parser.Parser { + priority = 130; + parse(dateString, token) { + if (token === "u") { + return (0, _utils.parseNDigitsSigned)(4, dateString); } - }]); - return ExtendedYearParser2; - }(_Parser2.Parser); + return (0, _utils.parseNDigitsSigned)(token.length, dateString); + } + set(date, _flags, value) { + date.setFullYear(value, 0, 1); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]; + }; exports2.ExtendedYearParser = ExtendedYearParser; } }); @@ -9424,86 +7529,70 @@ var require_ExtendedYearParser = __commonJS({ var require_QuarterParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/QuarterParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.QuarterParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var QuarterParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(QuarterParser2, _Parser); - var _super = (0, _createSuper2.default)(QuarterParser2); - function QuarterParser2() { - var _this; - (0, _classCallCheck2.default)(this, QuarterParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 120); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["Y", "R", "q", "M", "L", "w", "I", "d", "D", "i", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(QuarterParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "Q": - case "QQ": - return (0, _utils.parseNDigits)(token.length, dateString); - case "Qo": - return match.ordinalNumber(dateString, { - unit: "quarter" - }); - case "QQQ": - return match.quarter(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.quarter(dateString, { - width: "narrow", - context: "formatting" - }); - case "QQQQQ": - return match.quarter(dateString, { - width: "narrow", - context: "formatting" - }); - case "QQQQ": - default: - return match.quarter(dateString, { - width: "wide", - context: "formatting" - }) || match.quarter(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.quarter(dateString, { - width: "narrow", - context: "formatting" - }); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 1 && value <= 4; - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCMonth((value - 1) * 3, 1); - date.setUTCHours(0, 0, 0, 0); - return date; + var QuarterParser = class extends _Parser.Parser { + priority = 120; + parse(dateString, token, match) { + switch (token) { + case "Q": + case "QQ": + return (0, _utils.parseNDigits)(token.length, dateString); + case "Qo": + return match.ordinalNumber(dateString, { unit: "quarter" }); + case "QQQ": + return match.quarter(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.quarter(dateString, { + width: "narrow", + context: "formatting" + }); + case "QQQQQ": + return match.quarter(dateString, { + width: "narrow", + context: "formatting" + }); + case "QQQQ": + default: + return match.quarter(dateString, { + width: "wide", + context: "formatting" + }) || match.quarter(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.quarter(dateString, { + width: "narrow", + context: "formatting" + }); } - }]); - return QuarterParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 1 && value <= 4; + } + set(date, _flags, value) { + date.setMonth((value - 1) * 3, 1); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = [ + "Y", + "R", + "q", + "M", + "L", + "w", + "I", + "d", + "D", + "i", + "e", + "c", + "t", + "T" + ]; + }; exports2.QuarterParser = QuarterParser; } }); @@ -9512,86 +7601,70 @@ var require_QuarterParser = __commonJS({ var require_StandAloneQuarterParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.StandAloneQuarterParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var StandAloneQuarterParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(StandAloneQuarterParser2, _Parser); - var _super = (0, _createSuper2.default)(StandAloneQuarterParser2); - function StandAloneQuarterParser2() { - var _this; - (0, _classCallCheck2.default)(this, StandAloneQuarterParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 120); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["Y", "R", "Q", "M", "L", "w", "I", "d", "D", "i", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(StandAloneQuarterParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "q": - case "qq": - return (0, _utils.parseNDigits)(token.length, dateString); - case "qo": - return match.ordinalNumber(dateString, { - unit: "quarter" - }); - case "qqq": - return match.quarter(dateString, { - width: "abbreviated", - context: "standalone" - }) || match.quarter(dateString, { - width: "narrow", - context: "standalone" - }); - case "qqqqq": - return match.quarter(dateString, { - width: "narrow", - context: "standalone" - }); - case "qqqq": - default: - return match.quarter(dateString, { - width: "wide", - context: "standalone" - }) || match.quarter(dateString, { - width: "abbreviated", - context: "standalone" - }) || match.quarter(dateString, { - width: "narrow", - context: "standalone" - }); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 1 && value <= 4; - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCMonth((value - 1) * 3, 1); - date.setUTCHours(0, 0, 0, 0); - return date; + var StandAloneQuarterParser = class extends _Parser.Parser { + priority = 120; + parse(dateString, token, match) { + switch (token) { + case "q": + case "qq": + return (0, _utils.parseNDigits)(token.length, dateString); + case "qo": + return match.ordinalNumber(dateString, { unit: "quarter" }); + case "qqq": + return match.quarter(dateString, { + width: "abbreviated", + context: "standalone" + }) || match.quarter(dateString, { + width: "narrow", + context: "standalone" + }); + case "qqqqq": + return match.quarter(dateString, { + width: "narrow", + context: "standalone" + }); + case "qqqq": + default: + return match.quarter(dateString, { + width: "wide", + context: "standalone" + }) || match.quarter(dateString, { + width: "abbreviated", + context: "standalone" + }) || match.quarter(dateString, { + width: "narrow", + context: "standalone" + }); } - }]); - return StandAloneQuarterParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 1 && value <= 4; + } + set(date, _flags, value) { + date.setMonth((value - 1) * 3, 1); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = [ + "Y", + "R", + "Q", + "M", + "L", + "w", + "I", + "d", + "D", + "i", + "e", + "c", + "t", + "T" + ]; + }; exports2.StandAloneQuarterParser = StandAloneQuarterParser; } }); @@ -9600,91 +7673,77 @@ var require_StandAloneQuarterParser = __commonJS({ var require_MonthParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/MonthParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.MonthParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _utils = require_utils2(); - var _Parser2 = require_Parser(); var _constants = require_constants2(); - var MonthParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(MonthParser2, _Parser); - var _super = (0, _createSuper2.default)(MonthParser2); - function MonthParser2() { - var _this; - (0, _classCallCheck2.default)(this, MonthParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["Y", "R", "q", "Q", "L", "w", "I", "D", "i", "e", "c", "t", "T"]); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 110); - return _this; - } - (0, _createClass2.default)(MonthParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - var valueCallback = function valueCallback2(value) { - return value - 1; - }; - switch (token) { - case "M": - return (0, _utils.mapValue)((0, _utils.parseNumericPattern)(_constants.numericPatterns.month, dateString), valueCallback); - case "MM": - return (0, _utils.mapValue)((0, _utils.parseNDigits)(2, dateString), valueCallback); - case "Mo": - return (0, _utils.mapValue)(match.ordinalNumber(dateString, { + var _Parser = require_Parser(); + var _utils = require_utils2(); + var MonthParser = class extends _Parser.Parser { + incompatibleTokens = [ + "Y", + "R", + "q", + "Q", + "L", + "w", + "I", + "D", + "i", + "e", + "c", + "t", + "T" + ]; + priority = 110; + parse(dateString, token, match) { + const valueCallback = (value) => value - 1; + switch (token) { + case "M": + return (0, _utils.mapValue)( + (0, _utils.parseNumericPattern)( + _constants.numericPatterns.month, + dateString + ), + valueCallback + ); + case "MM": + return (0, _utils.mapValue)( + (0, _utils.parseNDigits)(2, dateString), + valueCallback + ); + case "Mo": + return (0, _utils.mapValue)( + match.ordinalNumber(dateString, { unit: "month" - }), valueCallback); - case "MMM": - return match.month(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.month(dateString, { - width: "narrow", - context: "formatting" - }); - case "MMMMM": - return match.month(dateString, { - width: "narrow", - context: "formatting" - }); - case "MMMM": - default: - return match.month(dateString, { - width: "wide", - context: "formatting" - }) || match.month(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.month(dateString, { - width: "narrow", - context: "formatting" - }); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 0 && value <= 11; - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCMonth(value, 1); - date.setUTCHours(0, 0, 0, 0); - return date; + }), + valueCallback + ); + case "MMM": + return match.month(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.month(dateString, { width: "narrow", context: "formatting" }); + case "MMMMM": + return match.month(dateString, { + width: "narrow", + context: "formatting" + }); + case "MMMM": + default: + return match.month(dateString, { width: "wide", context: "formatting" }) || match.month(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.month(dateString, { width: "narrow", context: "formatting" }); } - }]); - return MonthParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 0 && value <= 11; + } + set(date, _flags, value) { + date.setMonth(value, 1); + date.setHours(0, 0, 0, 0); + return date; + } + }; exports2.MonthParser = MonthParser; } }); @@ -9693,117 +7752,94 @@ var require_MonthParser = __commonJS({ var require_StandAloneMonthParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.StandAloneMonthParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var StandAloneMonthParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(StandAloneMonthParser2, _Parser); - var _super = (0, _createSuper2.default)(StandAloneMonthParser2); - function StandAloneMonthParser2() { - var _this; - (0, _classCallCheck2.default)(this, StandAloneMonthParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 110); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["Y", "R", "q", "Q", "M", "w", "I", "D", "i", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(StandAloneMonthParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - var valueCallback = function valueCallback2(value) { - return value - 1; - }; - switch (token) { - case "L": - return (0, _utils.mapValue)((0, _utils.parseNumericPattern)(_constants.numericPatterns.month, dateString), valueCallback); - case "LL": - return (0, _utils.mapValue)((0, _utils.parseNDigits)(2, dateString), valueCallback); - case "Lo": - return (0, _utils.mapValue)(match.ordinalNumber(dateString, { + var StandAloneMonthParser = class extends _Parser.Parser { + priority = 110; + parse(dateString, token, match) { + const valueCallback = (value) => value - 1; + switch (token) { + case "L": + return (0, _utils.mapValue)( + (0, _utils.parseNumericPattern)( + _constants.numericPatterns.month, + dateString + ), + valueCallback + ); + case "LL": + return (0, _utils.mapValue)( + (0, _utils.parseNDigits)(2, dateString), + valueCallback + ); + case "Lo": + return (0, _utils.mapValue)( + match.ordinalNumber(dateString, { unit: "month" - }), valueCallback); - case "LLL": - return match.month(dateString, { - width: "abbreviated", - context: "standalone" - }) || match.month(dateString, { - width: "narrow", - context: "standalone" - }); - case "LLLLL": - return match.month(dateString, { - width: "narrow", - context: "standalone" - }); - case "LLLL": - default: - return match.month(dateString, { - width: "wide", - context: "standalone" - }) || match.month(dateString, { - width: "abbreviated", - context: "standalone" - }) || match.month(dateString, { - width: "narrow", - context: "standalone" - }); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 0 && value <= 11; - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCMonth(value, 1); - date.setUTCHours(0, 0, 0, 0); - return date; + }), + valueCallback + ); + case "LLL": + return match.month(dateString, { + width: "abbreviated", + context: "standalone" + }) || match.month(dateString, { width: "narrow", context: "standalone" }); + case "LLLLL": + return match.month(dateString, { + width: "narrow", + context: "standalone" + }); + case "LLLL": + default: + return match.month(dateString, { width: "wide", context: "standalone" }) || match.month(dateString, { + width: "abbreviated", + context: "standalone" + }) || match.month(dateString, { width: "narrow", context: "standalone" }); } - }]); - return StandAloneMonthParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 0 && value <= 11; + } + set(date, _flags, value) { + date.setMonth(value, 1); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = [ + "Y", + "R", + "q", + "Q", + "M", + "w", + "I", + "D", + "i", + "e", + "c", + "t", + "T" + ]; + }; exports2.StandAloneMonthParser = StandAloneMonthParser; } }); -// node_modules/date-fns/_lib/setUTCWeek/index.js -var require_setUTCWeek = __commonJS({ - "node_modules/date-fns/_lib/setUTCWeek/index.js"(exports2, module2) { +// node_modules/date-fns/setWeek.js +var require_setWeek = __commonJS({ + "node_modules/date-fns/setWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setUTCWeek; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_getUTCWeek()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function setUTCWeek(dirtyDate, dirtyWeek, options) { - (0, _index4.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var week = (0, _index.default)(dirtyWeek); - var diff = (0, _index3.default)(date, options) - week; - date.setUTCDate(date.getUTCDate() - diff * 7); - return date; + exports2.setWeek = setWeek; + var _index = require_getWeek(); + var _index2 = require_toDate(); + function setWeek(date, week, options) { + const _date = (0, _index2.toDate)(date); + const diff = (0, _index.getWeek)(_date, options) - week; + _date.setDate(_date.getDate() - diff * 7); + return _date; } - module2.exports = exports2.default; } }); @@ -9811,89 +7847,69 @@ var require_setUTCWeek = __commonJS({ var require_LocalWeekParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.LocalWeekParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_setWeek(); + var _index2 = require_startOfWeek(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var _index = _interopRequireDefault(require_setUTCWeek()); - var _index2 = _interopRequireDefault(require_startOfUTCWeek()); - var LocalWeekParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(LocalWeekParser2, _Parser); - var _super = (0, _createSuper2.default)(LocalWeekParser2); - function LocalWeekParser2() { - var _this; - (0, _classCallCheck2.default)(this, LocalWeekParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 100); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["y", "R", "u", "q", "Q", "M", "L", "I", "d", "D", "i", "t", "T"]); - return _this; - } - (0, _createClass2.default)(LocalWeekParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "w": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.week, dateString); - case "wo": - return match.ordinalNumber(dateString, { - unit: "week" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 1 && value <= 53; - } - }, { - key: "set", - value: function set(date, _flags, value, options) { - return (0, _index2.default)((0, _index.default)(date, value, options), options); + var LocalWeekParser = class extends _Parser.Parser { + priority = 100; + parse(dateString, token, match) { + switch (token) { + case "w": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.week, + dateString + ); + case "wo": + return match.ordinalNumber(dateString, { unit: "week" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); } - }]); - return LocalWeekParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 1 && value <= 53; + } + set(date, _flags, value, options) { + return (0, _index2.startOfWeek)( + (0, _index.setWeek)(date, value, options), + options + ); + } + incompatibleTokens = [ + "y", + "R", + "u", + "q", + "Q", + "M", + "L", + "I", + "d", + "D", + "i", + "t", + "T" + ]; + }; exports2.LocalWeekParser = LocalWeekParser; } }); -// node_modules/date-fns/_lib/setUTCISOWeek/index.js -var require_setUTCISOWeek = __commonJS({ - "node_modules/date-fns/_lib/setUTCISOWeek/index.js"(exports2, module2) { +// node_modules/date-fns/setISOWeek.js +var require_setISOWeek = __commonJS({ + "node_modules/date-fns/setISOWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setUTCISOWeek; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_getUTCISOWeek()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function setUTCISOWeek(dirtyDate, dirtyISOWeek) { - (0, _index4.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var isoWeek = (0, _index.default)(dirtyISOWeek); - var diff = (0, _index3.default)(date) - isoWeek; - date.setUTCDate(date.getUTCDate() - diff * 7); - return date; + exports2.setISOWeek = setISOWeek; + var _index = require_getISOWeek(); + var _index2 = require_toDate(); + function setISOWeek(date, week) { + const _date = (0, _index2.toDate)(date); + const diff = (0, _index.getISOWeek)(_date) - week; + _date.setDate(_date.getDate() - diff * 7); + return _date; } - module2.exports = exports2.default; } }); @@ -9901,63 +7917,50 @@ var require_setUTCISOWeek = __commonJS({ var require_ISOWeekParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.ISOWeekParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_setISOWeek(); + var _index2 = require_startOfISOWeek(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var _index = _interopRequireDefault(require_setUTCISOWeek()); - var _index2 = _interopRequireDefault(require_startOfUTCISOWeek()); - var ISOWeekParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(ISOWeekParser2, _Parser); - var _super = (0, _createSuper2.default)(ISOWeekParser2); - function ISOWeekParser2() { - var _this; - (0, _classCallCheck2.default)(this, ISOWeekParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 100); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["y", "Y", "u", "q", "Q", "M", "L", "w", "d", "D", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(ISOWeekParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "I": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.week, dateString); - case "Io": - return match.ordinalNumber(dateString, { - unit: "week" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 1 && value <= 53; - } - }, { - key: "set", - value: function set(date, _flags, value) { - return (0, _index2.default)((0, _index.default)(date, value)); - } - }]); - return ISOWeekParser2; - }(_Parser2.Parser); + var ISOWeekParser = class extends _Parser.Parser { + priority = 100; + parse(dateString, token, match) { + switch (token) { + case "I": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.week, + dateString + ); + case "Io": + return match.ordinalNumber(dateString, { unit: "week" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); + } + } + validate(_date, value) { + return value >= 1 && value <= 53; + } + set(date, _flags, value) { + return (0, _index2.startOfISOWeek)((0, _index.setISOWeek)(date, value)); + } + incompatibleTokens = [ + "y", + "Y", + "u", + "q", + "Q", + "M", + "L", + "w", + "d", + "D", + "e", + "c", + "t", + "T" + ]; + }; exports2.ISOWeekParser = ISOWeekParser; } }); @@ -9966,73 +7969,71 @@ var require_ISOWeekParser = __commonJS({ var require_DateParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/DateParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.DateParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _utils = require_utils2(); - var _Parser2 = require_Parser(); var _constants = require_constants2(); + var _Parser = require_Parser(); + var _utils = require_utils2(); var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - var DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - var DateParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(DateParser2, _Parser); - var _super = (0, _createSuper2.default)(DateParser2); - function DateParser2() { - var _this; - (0, _classCallCheck2.default)(this, DateParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 90); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "subPriority", 1); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["Y", "R", "q", "Q", "w", "I", "D", "i", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(DateParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "d": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.date, dateString); - case "do": - return match.ordinalNumber(dateString, { - unit: "date" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } - } - }, { - key: "validate", - value: function validate2(date, value) { - var year = date.getUTCFullYear(); - var isLeapYear = (0, _utils.isLeapYearIndex)(year); - var month = date.getUTCMonth(); - if (isLeapYear) { - return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month]; - } else { - return value >= 1 && value <= DAYS_IN_MONTH[month]; - } + var DAYS_IN_MONTH_LEAP_YEAR = [ + 31, + 29, + 31, + 30, + 31, + 30, + 31, + 31, + 30, + 31, + 30, + 31 + ]; + var DateParser = class extends _Parser.Parser { + priority = 90; + subPriority = 1; + parse(dateString, token, match) { + switch (token) { + case "d": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.date, + dateString + ); + case "do": + return match.ordinalNumber(dateString, { unit: "date" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCDate(value); - date.setUTCHours(0, 0, 0, 0); - return date; + } + validate(date, value) { + const year = date.getFullYear(); + const isLeapYear = (0, _utils.isLeapYearIndex)(year); + const month = date.getMonth(); + if (isLeapYear) { + return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month]; + } else { + return value >= 1 && value <= DAYS_IN_MONTH[month]; } - }]); - return DateParser2; - }(_Parser2.Parser); + } + set(date, _flags, value) { + date.setDate(value); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = [ + "Y", + "R", + "q", + "Q", + "w", + "I", + "D", + "i", + "e", + "c", + "t", + "T" + ]; + }; exports2.DateParser = DateParser; } }); @@ -10041,106 +8042,82 @@ var require_DateParser = __commonJS({ var require_DayOfYearParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.DayOfYearParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var DayOfYearParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(DayOfYearParser2, _Parser); - var _super = (0, _createSuper2.default)(DayOfYearParser2); - function DayOfYearParser2() { - var _this; - (0, _classCallCheck2.default)(this, DayOfYearParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 90); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "subpriority", 1); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["Y", "R", "q", "Q", "M", "L", "w", "I", "d", "E", "i", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(DayOfYearParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "D": - case "DD": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.dayOfYear, dateString); - case "Do": - return match.ordinalNumber(dateString, { - unit: "date" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } - } - }, { - key: "validate", - value: function validate2(date, value) { - var year = date.getUTCFullYear(); - var isLeapYear = (0, _utils.isLeapYearIndex)(year); - if (isLeapYear) { - return value >= 1 && value <= 366; - } else { - return value >= 1 && value <= 365; - } + var DayOfYearParser = class extends _Parser.Parser { + priority = 90; + subpriority = 1; + parse(dateString, token, match) { + switch (token) { + case "D": + case "DD": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.dayOfYear, + dateString + ); + case "Do": + return match.ordinalNumber(dateString, { unit: "date" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCMonth(0, value); - date.setUTCHours(0, 0, 0, 0); - return date; + } + validate(date, value) { + const year = date.getFullYear(); + const isLeapYear = (0, _utils.isLeapYearIndex)(year); + if (isLeapYear) { + return value >= 1 && value <= 366; + } else { + return value >= 1 && value <= 365; } - }]); - return DayOfYearParser2; - }(_Parser2.Parser); + } + set(date, _flags, value) { + date.setMonth(0, value); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = [ + "Y", + "R", + "q", + "Q", + "M", + "L", + "w", + "I", + "d", + "E", + "i", + "e", + "c", + "t", + "T" + ]; + }; exports2.DayOfYearParser = DayOfYearParser; } }); -// node_modules/date-fns/_lib/setUTCDay/index.js -var require_setUTCDay = __commonJS({ - "node_modules/date-fns/_lib/setUTCDay/index.js"(exports2, module2) { +// node_modules/date-fns/setDay.js +var require_setDay = __commonJS({ + "node_modules/date-fns/setDay.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setUTCDay; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); - var _index4 = require_defaultOptions(); - function setUTCDay(dirtyDate, dirtyDay, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index2.default)(2, arguments); - var defaultOptions = (0, _index4.getDefaultOptions)(); - var weekStartsOn = (0, _index3.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - var date = (0, _index.default)(dirtyDate); - var day = (0, _index3.default)(dirtyDay); - var currentDay = date.getUTCDay(); - var remainder = day % 7; - var dayIndex = (remainder + 7) % 7; - var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay; - date.setUTCDate(date.getUTCDate() + diff); - return date; + exports2.setDay = setDay; + var _index = require_addDays(); + var _index2 = require_toDate(); + var _index3 = require_defaultOptions(); + function setDay(date, day, options) { + const defaultOptions = (0, _index3.getDefaultOptions)(); + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; + const _date = (0, _index2.toDate)(date); + const currentDay = _date.getDay(); + const remainder = day % 7; + const dayIndex = (remainder + 7) % 7; + const delta = 7 - weekStartsOn; + const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7; + return (0, _index.addDays)(_date, diff); } - module2.exports = exports2.default; } }); @@ -10148,95 +8125,45 @@ var require_setUTCDay = __commonJS({ var require_DayParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/DayParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.DayParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); - var _index = _interopRequireDefault(require_setUTCDay()); - var DayParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(DayParser2, _Parser); - var _super = (0, _createSuper2.default)(DayParser2); - function DayParser2() { - var _this; - (0, _classCallCheck2.default)(this, DayParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 90); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["D", "i", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(DayParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "E": - case "EE": - case "EEE": - return match.day(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.day(dateString, { - width: "short", - context: "formatting" - }) || match.day(dateString, { - width: "narrow", - context: "formatting" - }); - case "EEEEE": - return match.day(dateString, { - width: "narrow", - context: "formatting" - }); - case "EEEEEE": - return match.day(dateString, { - width: "short", - context: "formatting" - }) || match.day(dateString, { - width: "narrow", - context: "formatting" - }); - case "EEEE": - default: - return match.day(dateString, { - width: "wide", - context: "formatting" - }) || match.day(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.day(dateString, { - width: "short", - context: "formatting" - }) || match.day(dateString, { - width: "narrow", - context: "formatting" - }); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 0 && value <= 6; - } - }, { - key: "set", - value: function set(date, _flags, value, options) { - date = (0, _index.default)(date, value, options); - date.setUTCHours(0, 0, 0, 0); - return date; + var _index = require_setDay(); + var _Parser = require_Parser(); + var DayParser = class extends _Parser.Parser { + priority = 90; + parse(dateString, token, match) { + switch (token) { + case "E": + case "EE": + case "EEE": + return match.day(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.day(dateString, { width: "short", context: "formatting" }) || match.day(dateString, { width: "narrow", context: "formatting" }); + case "EEEEE": + return match.day(dateString, { + width: "narrow", + context: "formatting" + }); + case "EEEEEE": + return match.day(dateString, { width: "short", context: "formatting" }) || match.day(dateString, { width: "narrow", context: "formatting" }); + case "EEEE": + default: + return match.day(dateString, { width: "wide", context: "formatting" }) || match.day(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.day(dateString, { width: "short", context: "formatting" }) || match.day(dateString, { width: "narrow", context: "formatting" }); } - }]); - return DayParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 0 && value <= 6; + } + set(date, _flags, value, options) { + date = (0, _index.setDay)(date, value, options); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = ["D", "i", "e", "c", "t", "T"]; + }; exports2.DayParser = DayParser; } }); @@ -10245,105 +8172,77 @@ var require_DayParser = __commonJS({ var require_LocalDayParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.LocalDayParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_setDay(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var _index = _interopRequireDefault(require_setUTCDay()); - var LocalDayParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(LocalDayParser2, _Parser); - var _super = (0, _createSuper2.default)(LocalDayParser2); - function LocalDayParser2() { - var _this; - (0, _classCallCheck2.default)(this, LocalDayParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 90); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["y", "R", "u", "q", "Q", "M", "L", "I", "d", "D", "E", "i", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(LocalDayParser2, [{ - key: "parse", - value: function parse2(dateString, token, match, options) { - var valueCallback = function valueCallback2(value) { - var wholeWeekDays = Math.floor((value - 1) / 7) * 7; - return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; - }; - switch (token) { - case "e": - case "ee": - return (0, _utils.mapValue)((0, _utils.parseNDigits)(token.length, dateString), valueCallback); - case "eo": - return (0, _utils.mapValue)(match.ordinalNumber(dateString, { + var LocalDayParser = class extends _Parser.Parser { + priority = 90; + parse(dateString, token, match, options) { + const valueCallback = (value) => { + const wholeWeekDays = Math.floor((value - 1) / 7) * 7; + return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; + }; + switch (token) { + case "e": + case "ee": + return (0, _utils.mapValue)( + (0, _utils.parseNDigits)(token.length, dateString), + valueCallback + ); + case "eo": + return (0, _utils.mapValue)( + match.ordinalNumber(dateString, { unit: "day" - }), valueCallback); - case "eee": - return match.day(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.day(dateString, { - width: "short", - context: "formatting" - }) || match.day(dateString, { - width: "narrow", - context: "formatting" - }); - case "eeeee": - return match.day(dateString, { - width: "narrow", - context: "formatting" - }); - case "eeeeee": - return match.day(dateString, { - width: "short", - context: "formatting" - }) || match.day(dateString, { - width: "narrow", - context: "formatting" - }); - case "eeee": - default: - return match.day(dateString, { - width: "wide", - context: "formatting" - }) || match.day(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.day(dateString, { - width: "short", - context: "formatting" - }) || match.day(dateString, { - width: "narrow", - context: "formatting" - }); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 0 && value <= 6; - } - }, { - key: "set", - value: function set(date, _flags, value, options) { - date = (0, _index.default)(date, value, options); - date.setUTCHours(0, 0, 0, 0); - return date; + }), + valueCallback + ); + case "eee": + return match.day(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.day(dateString, { width: "short", context: "formatting" }) || match.day(dateString, { width: "narrow", context: "formatting" }); + case "eeeee": + return match.day(dateString, { + width: "narrow", + context: "formatting" + }); + case "eeeeee": + return match.day(dateString, { width: "short", context: "formatting" }) || match.day(dateString, { width: "narrow", context: "formatting" }); + case "eeee": + default: + return match.day(dateString, { width: "wide", context: "formatting" }) || match.day(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.day(dateString, { width: "short", context: "formatting" }) || match.day(dateString, { width: "narrow", context: "formatting" }); } - }]); - return LocalDayParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 0 && value <= 6; + } + set(date, _flags, value, options) { + date = (0, _index.setDay)(date, value, options); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = [ + "y", + "R", + "u", + "q", + "Q", + "M", + "L", + "I", + "d", + "D", + "E", + "i", + "c", + "t", + "T" + ]; + }; exports2.LocalDayParser = LocalDayParser; } }); @@ -10352,137 +8251,95 @@ var require_LocalDayParser = __commonJS({ var require_StandAloneLocalDayParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.StandAloneLocalDayParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_setDay(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var _index = _interopRequireDefault(require_setUTCDay()); - var StandAloneLocalDayParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(StandAloneLocalDayParser2, _Parser); - var _super = (0, _createSuper2.default)(StandAloneLocalDayParser2); - function StandAloneLocalDayParser2() { - var _this; - (0, _classCallCheck2.default)(this, StandAloneLocalDayParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 90); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["y", "R", "u", "q", "Q", "M", "L", "I", "d", "D", "E", "i", "e", "t", "T"]); - return _this; - } - (0, _createClass2.default)(StandAloneLocalDayParser2, [{ - key: "parse", - value: function parse2(dateString, token, match, options) { - var valueCallback = function valueCallback2(value) { - var wholeWeekDays = Math.floor((value - 1) / 7) * 7; - return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; - }; - switch (token) { - case "c": - case "cc": - return (0, _utils.mapValue)((0, _utils.parseNDigits)(token.length, dateString), valueCallback); - case "co": - return (0, _utils.mapValue)(match.ordinalNumber(dateString, { + var StandAloneLocalDayParser = class extends _Parser.Parser { + priority = 90; + parse(dateString, token, match, options) { + const valueCallback = (value) => { + const wholeWeekDays = Math.floor((value - 1) / 7) * 7; + return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; + }; + switch (token) { + case "c": + case "cc": + return (0, _utils.mapValue)( + (0, _utils.parseNDigits)(token.length, dateString), + valueCallback + ); + case "co": + return (0, _utils.mapValue)( + match.ordinalNumber(dateString, { unit: "day" - }), valueCallback); - case "ccc": - return match.day(dateString, { - width: "abbreviated", - context: "standalone" - }) || match.day(dateString, { - width: "short", - context: "standalone" - }) || match.day(dateString, { - width: "narrow", - context: "standalone" - }); - case "ccccc": - return match.day(dateString, { - width: "narrow", - context: "standalone" - }); - case "cccccc": - return match.day(dateString, { - width: "short", - context: "standalone" - }) || match.day(dateString, { - width: "narrow", - context: "standalone" - }); - case "cccc": - default: - return match.day(dateString, { - width: "wide", - context: "standalone" - }) || match.day(dateString, { - width: "abbreviated", - context: "standalone" - }) || match.day(dateString, { - width: "short", - context: "standalone" - }) || match.day(dateString, { - width: "narrow", - context: "standalone" - }); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 0 && value <= 6; - } - }, { - key: "set", - value: function set(date, _flags, value, options) { - date = (0, _index.default)(date, value, options); - date.setUTCHours(0, 0, 0, 0); - return date; + }), + valueCallback + ); + case "ccc": + return match.day(dateString, { + width: "abbreviated", + context: "standalone" + }) || match.day(dateString, { width: "short", context: "standalone" }) || match.day(dateString, { width: "narrow", context: "standalone" }); + case "ccccc": + return match.day(dateString, { + width: "narrow", + context: "standalone" + }); + case "cccccc": + return match.day(dateString, { width: "short", context: "standalone" }) || match.day(dateString, { width: "narrow", context: "standalone" }); + case "cccc": + default: + return match.day(dateString, { width: "wide", context: "standalone" }) || match.day(dateString, { + width: "abbreviated", + context: "standalone" + }) || match.day(dateString, { width: "short", context: "standalone" }) || match.day(dateString, { width: "narrow", context: "standalone" }); } - }]); - return StandAloneLocalDayParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 0 && value <= 6; + } + set(date, _flags, value, options) { + date = (0, _index.setDay)(date, value, options); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = [ + "y", + "R", + "u", + "q", + "Q", + "M", + "L", + "I", + "d", + "D", + "E", + "i", + "e", + "t", + "T" + ]; + }; exports2.StandAloneLocalDayParser = StandAloneLocalDayParser; } }); -// node_modules/date-fns/_lib/setUTCISODay/index.js -var require_setUTCISODay = __commonJS({ - "node_modules/date-fns/_lib/setUTCISODay/index.js"(exports2, module2) { +// node_modules/date-fns/setISODay.js +var require_setISODay = __commonJS({ + "node_modules/date-fns/setISODay.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setUTCISODay; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); - function setUTCISODay(dirtyDate, dirtyDay) { - (0, _index2.default)(2, arguments); - var day = (0, _index3.default)(dirtyDay); - if (day % 7 === 0) { - day = day - 7; - } - var weekStartsOn = 1; - var date = (0, _index.default)(dirtyDate); - var currentDay = date.getUTCDay(); - var remainder = day % 7; - var dayIndex = (remainder + 7) % 7; - var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay; - date.setUTCDate(date.getUTCDate() + diff); - return date; + exports2.setISODay = setISODay; + var _index = require_addDays(); + var _index2 = require_getISODay(); + var _index3 = require_toDate(); + function setISODay(date, day) { + const _date = (0, _index3.toDate)(date); + const currentDay = (0, _index2.getISODay)(_date); + const diff = day - currentDay; + return (0, _index.addDays)(_date, diff); } - module2.exports = exports2.default; } }); @@ -10490,53 +8347,28 @@ var require_setUTCISODay = __commonJS({ var require_ISODayParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/ISODayParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.ISODayParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_setISODay(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var _index = _interopRequireDefault(require_setUTCISODay()); - var ISODayParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(ISODayParser2, _Parser); - var _super = (0, _createSuper2.default)(ISODayParser2); - function ISODayParser2() { - var _this; - (0, _classCallCheck2.default)(this, ISODayParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 90); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["y", "Y", "u", "q", "Q", "M", "L", "w", "d", "D", "E", "e", "c", "t", "T"]); - return _this; - } - (0, _createClass2.default)(ISODayParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - var valueCallback = function valueCallback2(value) { - if (value === 0) { - return 7; - } - return value; - }; - switch (token) { - case "i": - case "ii": - return (0, _utils.parseNDigits)(token.length, dateString); - case "io": - return match.ordinalNumber(dateString, { - unit: "day" - }); - case "iii": - return (0, _utils.mapValue)(match.day(dateString, { + var ISODayParser = class extends _Parser.Parser { + priority = 90; + parse(dateString, token, match) { + const valueCallback = (value) => { + if (value === 0) { + return 7; + } + return value; + }; + switch (token) { + case "i": + case "ii": + return (0, _utils.parseNDigits)(token.length, dateString); + case "io": + return match.ordinalNumber(dateString, { unit: "day" }); + case "iii": + return (0, _utils.mapValue)( + match.day(dateString, { width: "abbreviated", context: "formatting" }) || match.day(dateString, { @@ -10545,23 +8377,32 @@ var require_ISODayParser = __commonJS({ }) || match.day(dateString, { width: "narrow", context: "formatting" - }), valueCallback); - case "iiiii": - return (0, _utils.mapValue)(match.day(dateString, { + }), + valueCallback + ); + case "iiiii": + return (0, _utils.mapValue)( + match.day(dateString, { width: "narrow", context: "formatting" - }), valueCallback); - case "iiiiii": - return (0, _utils.mapValue)(match.day(dateString, { + }), + valueCallback + ); + case "iiiiii": + return (0, _utils.mapValue)( + match.day(dateString, { width: "short", context: "formatting" }) || match.day(dateString, { width: "narrow", context: "formatting" - }), valueCallback); - case "iiii": - default: - return (0, _utils.mapValue)(match.day(dateString, { + }), + valueCallback + ); + case "iiii": + default: + return (0, _utils.mapValue)( + match.day(dateString, { width: "wide", context: "formatting" }) || match.day(dateString, { @@ -10573,24 +8414,37 @@ var require_ISODayParser = __commonJS({ }) || match.day(dateString, { width: "narrow", context: "formatting" - }), valueCallback); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 1 && value <= 7; - } - }, { - key: "set", - value: function set(date, _flags, value) { - date = (0, _index.default)(date, value); - date.setUTCHours(0, 0, 0, 0); - return date; + }), + valueCallback + ); } - }]); - return ISODayParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 1 && value <= 7; + } + set(date, _flags, value) { + date = (0, _index.setISODay)(date, value); + date.setHours(0, 0, 0, 0); + return date; + } + incompatibleTokens = [ + "y", + "Y", + "u", + "q", + "Q", + "M", + "L", + "w", + "d", + "D", + "E", + "e", + "c", + "t", + "T" + ]; + }; exports2.ISODayParser = ISODayParser; } }); @@ -10599,75 +8453,48 @@ var require_ISODayParser = __commonJS({ var require_AMPMParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/AMPMParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.AMPMParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var AMPMParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(AMPMParser2, _Parser); - var _super = (0, _createSuper2.default)(AMPMParser2); - function AMPMParser2() { - var _this; - (0, _classCallCheck2.default)(this, AMPMParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 80); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["b", "B", "H", "k", "t", "T"]); - return _this; - } - (0, _createClass2.default)(AMPMParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "a": - case "aa": - case "aaa": - return match.dayPeriod(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.dayPeriod(dateString, { - width: "narrow", - context: "formatting" - }); - case "aaaaa": - return match.dayPeriod(dateString, { - width: "narrow", - context: "formatting" - }); - case "aaaa": - default: - return match.dayPeriod(dateString, { - width: "wide", - context: "formatting" - }) || match.dayPeriod(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.dayPeriod(dateString, { - width: "narrow", - context: "formatting" - }); - } - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); - return date; + var AMPMParser = class extends _Parser.Parser { + priority = 80; + parse(dateString, token, match) { + switch (token) { + case "a": + case "aa": + case "aaa": + return match.dayPeriod(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.dayPeriod(dateString, { + width: "narrow", + context: "formatting" + }); + case "aaaaa": + return match.dayPeriod(dateString, { + width: "narrow", + context: "formatting" + }); + case "aaaa": + default: + return match.dayPeriod(dateString, { + width: "wide", + context: "formatting" + }) || match.dayPeriod(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.dayPeriod(dateString, { + width: "narrow", + context: "formatting" + }); } - }]); - return AMPMParser2; - }(_Parser2.Parser); + } + set(date, _flags, value) { + date.setHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); + return date; + } + incompatibleTokens = ["b", "B", "H", "k", "t", "T"]; + }; exports2.AMPMParser = AMPMParser; } }); @@ -10676,75 +8503,48 @@ var require_AMPMParser = __commonJS({ var require_AMPMMidnightParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.AMPMMidnightParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var AMPMMidnightParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(AMPMMidnightParser2, _Parser); - var _super = (0, _createSuper2.default)(AMPMMidnightParser2); - function AMPMMidnightParser2() { - var _this; - (0, _classCallCheck2.default)(this, AMPMMidnightParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 80); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["a", "B", "H", "k", "t", "T"]); - return _this; - } - (0, _createClass2.default)(AMPMMidnightParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "b": - case "bb": - case "bbb": - return match.dayPeriod(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.dayPeriod(dateString, { - width: "narrow", - context: "formatting" - }); - case "bbbbb": - return match.dayPeriod(dateString, { - width: "narrow", - context: "formatting" - }); - case "bbbb": - default: - return match.dayPeriod(dateString, { - width: "wide", - context: "formatting" - }) || match.dayPeriod(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.dayPeriod(dateString, { - width: "narrow", - context: "formatting" - }); - } - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); - return date; + var AMPMMidnightParser = class extends _Parser.Parser { + priority = 80; + parse(dateString, token, match) { + switch (token) { + case "b": + case "bb": + case "bbb": + return match.dayPeriod(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.dayPeriod(dateString, { + width: "narrow", + context: "formatting" + }); + case "bbbbb": + return match.dayPeriod(dateString, { + width: "narrow", + context: "formatting" + }); + case "bbbb": + default: + return match.dayPeriod(dateString, { + width: "wide", + context: "formatting" + }) || match.dayPeriod(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.dayPeriod(dateString, { + width: "narrow", + context: "formatting" + }); } - }]); - return AMPMMidnightParser2; - }(_Parser2.Parser); + } + set(date, _flags, value) { + date.setHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); + return date; + } + incompatibleTokens = ["a", "B", "H", "k", "t", "T"]; + }; exports2.AMPMMidnightParser = AMPMMidnightParser; } }); @@ -10753,75 +8553,48 @@ var require_AMPMMidnightParser = __commonJS({ var require_DayPeriodParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.DayPeriodParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var DayPeriodParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(DayPeriodParser2, _Parser); - var _super = (0, _createSuper2.default)(DayPeriodParser2); - function DayPeriodParser2() { - var _this; - (0, _classCallCheck2.default)(this, DayPeriodParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 80); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["a", "b", "t", "T"]); - return _this; - } - (0, _createClass2.default)(DayPeriodParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "B": - case "BB": - case "BBB": - return match.dayPeriod(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.dayPeriod(dateString, { - width: "narrow", - context: "formatting" - }); - case "BBBBB": - return match.dayPeriod(dateString, { - width: "narrow", - context: "formatting" - }); - case "BBBB": - default: - return match.dayPeriod(dateString, { - width: "wide", - context: "formatting" - }) || match.dayPeriod(dateString, { - width: "abbreviated", - context: "formatting" - }) || match.dayPeriod(dateString, { - width: "narrow", - context: "formatting" - }); - } - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); - return date; + var DayPeriodParser = class extends _Parser.Parser { + priority = 80; + parse(dateString, token, match) { + switch (token) { + case "B": + case "BB": + case "BBB": + return match.dayPeriod(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.dayPeriod(dateString, { + width: "narrow", + context: "formatting" + }); + case "BBBBB": + return match.dayPeriod(dateString, { + width: "narrow", + context: "formatting" + }); + case "BBBB": + default: + return match.dayPeriod(dateString, { + width: "wide", + context: "formatting" + }) || match.dayPeriod(dateString, { + width: "abbreviated", + context: "formatting" + }) || match.dayPeriod(dateString, { + width: "narrow", + context: "formatting" + }); } - }]); - return DayPeriodParser2; - }(_Parser2.Parser); + } + set(date, _flags, value) { + date.setHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); + return date; + } + incompatibleTokens = ["a", "b", "t", "T"]; + }; exports2.DayPeriodParser = DayPeriodParser; } }); @@ -10830,69 +8603,41 @@ var require_DayPeriodParser = __commonJS({ var require_Hour1to12Parser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.Hour1to12Parser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var Hour1to12Parser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(Hour1to12Parser2, _Parser); - var _super = (0, _createSuper2.default)(Hour1to12Parser2); - function Hour1to12Parser2() { - var _this; - (0, _classCallCheck2.default)(this, Hour1to12Parser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 70); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["H", "K", "k", "t", "T"]); - return _this; - } - (0, _createClass2.default)(Hour1to12Parser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "h": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.hour12h, dateString); - case "ho": - return match.ordinalNumber(dateString, { - unit: "hour" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } + var Hour1to12Parser = class extends _Parser.Parser { + priority = 70; + parse(dateString, token, match) { + switch (token) { + case "h": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.hour12h, + dateString + ); + case "ho": + return match.ordinalNumber(dateString, { unit: "hour" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 1 && value <= 12; - } - }, { - key: "set", - value: function set(date, _flags, value) { - var isPM = date.getUTCHours() >= 12; - if (isPM && value < 12) { - date.setUTCHours(value + 12, 0, 0, 0); - } else if (!isPM && value === 12) { - date.setUTCHours(0, 0, 0, 0); - } else { - date.setUTCHours(value, 0, 0, 0); - } - return date; + } + validate(_date, value) { + return value >= 1 && value <= 12; + } + set(date, _flags, value) { + const isPM = date.getHours() >= 12; + if (isPM && value < 12) { + date.setHours(value + 12, 0, 0, 0); + } else if (!isPM && value === 12) { + date.setHours(0, 0, 0, 0); + } else { + date.setHours(value, 0, 0, 0); } - }]); - return Hour1to12Parser2; - }(_Parser2.Parser); + return date; + } + incompatibleTokens = ["H", "K", "k", "t", "T"]; + }; exports2.Hour1to12Parser = Hour1to12Parser; } }); @@ -10901,62 +8646,34 @@ var require_Hour1to12Parser = __commonJS({ var require_Hour0to23Parser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.Hour0to23Parser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var Hour0to23Parser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(Hour0to23Parser2, _Parser); - var _super = (0, _createSuper2.default)(Hour0to23Parser2); - function Hour0to23Parser2() { - var _this; - (0, _classCallCheck2.default)(this, Hour0to23Parser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 70); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["a", "b", "h", "K", "k", "t", "T"]); - return _this; - } - (0, _createClass2.default)(Hour0to23Parser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "H": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.hour23h, dateString); - case "Ho": - return match.ordinalNumber(dateString, { - unit: "hour" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 0 && value <= 23; - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCHours(value, 0, 0, 0); - return date; + var Hour0to23Parser = class extends _Parser.Parser { + priority = 70; + parse(dateString, token, match) { + switch (token) { + case "H": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.hour23h, + dateString + ); + case "Ho": + return match.ordinalNumber(dateString, { unit: "hour" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); } - }]); - return Hour0to23Parser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 0 && value <= 23; + } + set(date, _flags, value) { + date.setHours(value, 0, 0, 0); + return date; + } + incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"]; + }; exports2.Hour0to23Parser = Hour0to23Parser; } }); @@ -10965,67 +8682,39 @@ var require_Hour0to23Parser = __commonJS({ var require_Hour0To11Parser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.Hour0To11Parser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var Hour0To11Parser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(Hour0To11Parser2, _Parser); - var _super = (0, _createSuper2.default)(Hour0To11Parser2); - function Hour0To11Parser2() { - var _this; - (0, _classCallCheck2.default)(this, Hour0To11Parser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 70); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["h", "H", "k", "t", "T"]); - return _this; - } - (0, _createClass2.default)(Hour0To11Parser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "K": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.hour11h, dateString); - case "Ko": - return match.ordinalNumber(dateString, { - unit: "hour" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } + var Hour0To11Parser = class extends _Parser.Parser { + priority = 70; + parse(dateString, token, match) { + switch (token) { + case "K": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.hour11h, + dateString + ); + case "Ko": + return match.ordinalNumber(dateString, { unit: "hour" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 0 && value <= 11; - } - }, { - key: "set", - value: function set(date, _flags, value) { - var isPM = date.getUTCHours() >= 12; - if (isPM && value < 12) { - date.setUTCHours(value + 12, 0, 0, 0); - } else { - date.setUTCHours(value, 0, 0, 0); - } - return date; + } + validate(_date, value) { + return value >= 0 && value <= 11; + } + set(date, _flags, value) { + const isPM = date.getHours() >= 12; + if (isPM && value < 12) { + date.setHours(value + 12, 0, 0, 0); + } else { + date.setHours(value, 0, 0, 0); } - }]); - return Hour0To11Parser2; - }(_Parser2.Parser); + return date; + } + incompatibleTokens = ["h", "H", "k", "t", "T"]; + }; exports2.Hour0To11Parser = Hour0To11Parser; } }); @@ -11034,63 +8723,35 @@ var require_Hour0To11Parser = __commonJS({ var require_Hour1To24Parser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.Hour1To24Parser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var Hour1To24Parser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(Hour1To24Parser2, _Parser); - var _super = (0, _createSuper2.default)(Hour1To24Parser2); - function Hour1To24Parser2() { - var _this; - (0, _classCallCheck2.default)(this, Hour1To24Parser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 70); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["a", "b", "h", "H", "K", "t", "T"]); - return _this; - } - (0, _createClass2.default)(Hour1To24Parser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "k": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.hour24h, dateString); - case "ko": - return match.ordinalNumber(dateString, { - unit: "hour" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 1 && value <= 24; - } - }, { - key: "set", - value: function set(date, _flags, value) { - var hours = value <= 24 ? value % 24 : value; - date.setUTCHours(hours, 0, 0, 0); - return date; + var Hour1To24Parser = class extends _Parser.Parser { + priority = 70; + parse(dateString, token, match) { + switch (token) { + case "k": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.hour24h, + dateString + ); + case "ko": + return match.ordinalNumber(dateString, { unit: "hour" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); } - }]); - return Hour1To24Parser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 1 && value <= 24; + } + set(date, _flags, value) { + const hours = value <= 24 ? value % 24 : value; + date.setHours(hours, 0, 0, 0); + return date; + } + incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"]; + }; exports2.Hour1To24Parser = Hour1To24Parser; } }); @@ -11099,62 +8760,34 @@ var require_Hour1To24Parser = __commonJS({ var require_MinuteParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/MinuteParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.MinuteParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var MinuteParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(MinuteParser2, _Parser); - var _super = (0, _createSuper2.default)(MinuteParser2); - function MinuteParser2() { - var _this; - (0, _classCallCheck2.default)(this, MinuteParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 60); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["t", "T"]); - return _this; - } - (0, _createClass2.default)(MinuteParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "m": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.minute, dateString); - case "mo": - return match.ordinalNumber(dateString, { - unit: "minute" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 0 && value <= 59; - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCMinutes(value, 0, 0); - return date; + var MinuteParser = class extends _Parser.Parser { + priority = 60; + parse(dateString, token, match) { + switch (token) { + case "m": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.minute, + dateString + ); + case "mo": + return match.ordinalNumber(dateString, { unit: "minute" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); } - }]); - return MinuteParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 0 && value <= 59; + } + set(date, _flags, value) { + date.setMinutes(value, 0, 0); + return date; + } + incompatibleTokens = ["t", "T"]; + }; exports2.MinuteParser = MinuteParser; } }); @@ -11163,62 +8796,34 @@ var require_MinuteParser = __commonJS({ var require_SecondParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/SecondParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.SecondParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var SecondParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(SecondParser2, _Parser); - var _super = (0, _createSuper2.default)(SecondParser2); - function SecondParser2() { - var _this; - (0, _classCallCheck2.default)(this, SecondParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 50); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["t", "T"]); - return _this; - } - (0, _createClass2.default)(SecondParser2, [{ - key: "parse", - value: function parse2(dateString, token, match) { - switch (token) { - case "s": - return (0, _utils.parseNumericPattern)(_constants.numericPatterns.second, dateString); - case "so": - return match.ordinalNumber(dateString, { - unit: "second" - }); - default: - return (0, _utils.parseNDigits)(token.length, dateString); - } - } - }, { - key: "validate", - value: function validate2(_date, value) { - return value >= 0 && value <= 59; - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCSeconds(value, 0); - return date; + var SecondParser = class extends _Parser.Parser { + priority = 50; + parse(dateString, token, match) { + switch (token) { + case "s": + return (0, _utils.parseNumericPattern)( + _constants.numericPatterns.second, + dateString + ); + case "so": + return match.ordinalNumber(dateString, { unit: "second" }); + default: + return (0, _utils.parseNDigits)(token.length, dateString); } - }]); - return SecondParser2; - }(_Parser2.Parser); + } + validate(_date, value) { + return value >= 0 && value <= 59; + } + set(date, _flags, value) { + date.setSeconds(value, 0); + return date; + } + incompatibleTokens = ["t", "T"]; + }; exports2.SecondParser = SecondParser; } }); @@ -11227,50 +8832,24 @@ var require_SecondParser = __commonJS({ var require_FractionOfSecondParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.FractionOfSecondParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var FractionOfSecondParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(FractionOfSecondParser2, _Parser); - var _super = (0, _createSuper2.default)(FractionOfSecondParser2); - function FractionOfSecondParser2() { - var _this; - (0, _classCallCheck2.default)(this, FractionOfSecondParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 30); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["t", "T"]); - return _this; - } - (0, _createClass2.default)(FractionOfSecondParser2, [{ - key: "parse", - value: function parse2(dateString, token) { - var valueCallback = function valueCallback2(value) { - return Math.floor(value * Math.pow(10, -token.length + 3)); - }; - return (0, _utils.mapValue)((0, _utils.parseNDigits)(token.length, dateString), valueCallback); - } - }, { - key: "set", - value: function set(date, _flags, value) { - date.setUTCMilliseconds(value); - return date; - } - }]); - return FractionOfSecondParser2; - }(_Parser2.Parser); + var FractionOfSecondParser = class extends _Parser.Parser { + priority = 30; + parse(dateString, token) { + const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3)); + return (0, _utils.mapValue)( + (0, _utils.parseNDigits)(token.length, dateString), + valueCallback + ); + } + set(date, _flags, value) { + date.setMilliseconds(value); + return date; + } + incompatibleTokens = ["t", "T"]; + }; exports2.FractionOfSecondParser = FractionOfSecondParser; } }); @@ -11279,62 +8858,54 @@ var require_FractionOfSecondParser = __commonJS({ var require_ISOTimezoneWithZParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.ISOTimezoneWithZParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_constructFrom(); + var _index2 = require_getTimezoneOffsetInMilliseconds(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var ISOTimezoneWithZParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(ISOTimezoneWithZParser2, _Parser); - var _super = (0, _createSuper2.default)(ISOTimezoneWithZParser2); - function ISOTimezoneWithZParser2() { - var _this; - (0, _classCallCheck2.default)(this, ISOTimezoneWithZParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 10); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["t", "T", "x"]); - return _this; - } - (0, _createClass2.default)(ISOTimezoneWithZParser2, [{ - key: "parse", - value: function parse2(dateString, token) { - switch (token) { - case "X": - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.basicOptionalMinutes, dateString); - case "XX": - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.basic, dateString); - case "XXXX": - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.basicOptionalSeconds, dateString); - case "XXXXX": - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.extendedOptionalSeconds, dateString); - case "XXX": - default: - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.extended, dateString); - } - } - }, { - key: "set", - value: function set(date, flags, value) { - if (flags.timestampIsSet) { - return date; - } - return new Date(date.getTime() - value); + var ISOTimezoneWithZParser = class extends _Parser.Parser { + priority = 10; + parse(dateString, token) { + switch (token) { + case "X": + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.basicOptionalMinutes, + dateString + ); + case "XX": + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.basic, + dateString + ); + case "XXXX": + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.basicOptionalSeconds, + dateString + ); + case "XXXXX": + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.extendedOptionalSeconds, + dateString + ); + case "XXX": + default: + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.extended, + dateString + ); } - }]); - return ISOTimezoneWithZParser2; - }(_Parser2.Parser); + } + set(date, flags, value) { + if (flags.timestampIsSet) + return date; + return (0, _index.constructFrom)( + date, + date.getTime() - (0, _index2.getTimezoneOffsetInMilliseconds)(date) - value + ); + } + incompatibleTokens = ["t", "T", "x"]; + }; exports2.ISOTimezoneWithZParser = ISOTimezoneWithZParser; } }); @@ -11343,62 +8914,54 @@ var require_ISOTimezoneWithZParser = __commonJS({ var require_ISOTimezoneParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.ISOTimezoneParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_constructFrom(); + var _index2 = require_getTimezoneOffsetInMilliseconds(); var _constants = require_constants2(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var ISOTimezoneParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(ISOTimezoneParser2, _Parser); - var _super = (0, _createSuper2.default)(ISOTimezoneParser2); - function ISOTimezoneParser2() { - var _this; - (0, _classCallCheck2.default)(this, ISOTimezoneParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 10); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", ["t", "T", "X"]); - return _this; - } - (0, _createClass2.default)(ISOTimezoneParser2, [{ - key: "parse", - value: function parse2(dateString, token) { - switch (token) { - case "x": - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.basicOptionalMinutes, dateString); - case "xx": - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.basic, dateString); - case "xxxx": - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.basicOptionalSeconds, dateString); - case "xxxxx": - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.extendedOptionalSeconds, dateString); - case "xxx": - default: - return (0, _utils.parseTimezonePattern)(_constants.timezonePatterns.extended, dateString); - } - } - }, { - key: "set", - value: function set(date, flags, value) { - if (flags.timestampIsSet) { - return date; - } - return new Date(date.getTime() - value); + var ISOTimezoneParser = class extends _Parser.Parser { + priority = 10; + parse(dateString, token) { + switch (token) { + case "x": + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.basicOptionalMinutes, + dateString + ); + case "xx": + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.basic, + dateString + ); + case "xxxx": + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.basicOptionalSeconds, + dateString + ); + case "xxxxx": + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.extendedOptionalSeconds, + dateString + ); + case "xxx": + default: + return (0, _utils.parseTimezonePattern)( + _constants.timezonePatterns.extended, + dateString + ); } - }]); - return ISOTimezoneParser2; - }(_Parser2.Parser); + } + set(date, flags, value) { + if (flags.timestampIsSet) + return date; + return (0, _index.constructFrom)( + date, + date.getTime() - (0, _index2.getTimezoneOffsetInMilliseconds)(date) - value + ); + } + incompatibleTokens = ["t", "T", "X"]; + }; exports2.ISOTimezoneParser = ISOTimezoneParser; } }); @@ -11407,48 +8970,23 @@ var require_ISOTimezoneParser = __commonJS({ var require_TimestampSecondsParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.TimestampSecondsParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_constructFrom(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var TimestampSecondsParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(TimestampSecondsParser2, _Parser); - var _super = (0, _createSuper2.default)(TimestampSecondsParser2); - function TimestampSecondsParser2() { - var _this; - (0, _classCallCheck2.default)(this, TimestampSecondsParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 40); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", "*"); - return _this; - } - (0, _createClass2.default)(TimestampSecondsParser2, [{ - key: "parse", - value: function parse2(dateString) { - return (0, _utils.parseAnyDigitsSigned)(dateString); - } - }, { - key: "set", - value: function set(_date, _flags, value) { - return [new Date(value * 1e3), { - timestampIsSet: true - }]; - } - }]); - return TimestampSecondsParser2; - }(_Parser2.Parser); + var TimestampSecondsParser = class extends _Parser.Parser { + priority = 40; + parse(dateString) { + return (0, _utils.parseAnyDigitsSigned)(dateString); + } + set(date, _flags, value) { + return [ + (0, _index.constructFrom)(date, value * 1e3), + { timestampIsSet: true } + ]; + } + incompatibleTokens = "*"; + }; exports2.TimestampSecondsParser = TimestampSecondsParser; } }); @@ -11457,59 +8995,28 @@ var require_TimestampSecondsParser = __commonJS({ var require_TimestampMillisecondsParser = __commonJS({ "node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.TimestampMillisecondsParser = void 0; - var _classCallCheck2 = _interopRequireDefault(require_classCallCheck()); - var _createClass2 = _interopRequireDefault(require_createClass()); - var _assertThisInitialized2 = _interopRequireDefault(require_assertThisInitialized()); - var _inherits2 = _interopRequireDefault(require_inherits()); - var _createSuper2 = _interopRequireDefault(require_createSuper()); - var _defineProperty2 = _interopRequireDefault(require_defineProperty()); - var _Parser2 = require_Parser(); + var _index = require_constructFrom(); + var _Parser = require_Parser(); var _utils = require_utils2(); - var TimestampMillisecondsParser = /* @__PURE__ */ function(_Parser) { - (0, _inherits2.default)(TimestampMillisecondsParser2, _Parser); - var _super = (0, _createSuper2.default)(TimestampMillisecondsParser2); - function TimestampMillisecondsParser2() { - var _this; - (0, _classCallCheck2.default)(this, TimestampMillisecondsParser2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - _this = _super.call.apply(_super, [this].concat(args)); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "priority", 20); - (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "incompatibleTokens", "*"); - return _this; - } - (0, _createClass2.default)(TimestampMillisecondsParser2, [{ - key: "parse", - value: function parse2(dateString) { - return (0, _utils.parseAnyDigitsSigned)(dateString); - } - }, { - key: "set", - value: function set(_date, _flags, value) { - return [new Date(value), { - timestampIsSet: true - }]; - } - }]); - return TimestampMillisecondsParser2; - }(_Parser2.Parser); + var TimestampMillisecondsParser = class extends _Parser.Parser { + priority = 20; + parse(dateString) { + return (0, _utils.parseAnyDigitsSigned)(dateString); + } + set(date, _flags, value) { + return [(0, _index.constructFrom)(date, value), { timestampIsSet: true }]; + } + incompatibleTokens = "*"; + }; exports2.TimestampMillisecondsParser = TimestampMillisecondsParser; } }); -// node_modules/date-fns/parse/_lib/parsers/index.js +// node_modules/date-fns/parse/_lib/parsers.js var require_parsers = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/index.js"(exports2) { + "node_modules/date-fns/parse/_lib/parsers.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); exports2.parsers = void 0; var _EraParser = require_EraParser(); var _YearParser = require_YearParser(); @@ -11542,7 +9049,7 @@ var require_parsers = __commonJS({ var _ISOTimezoneParser = require_ISOTimezoneParser(); var _TimestampSecondsParser = require_TimestampSecondsParser(); var _TimestampMillisecondsParser = require_TimestampMillisecondsParser(); - var parsers = { + var parsers = exports2.parsers = { G: new _EraParser.EraParser(), y: new _YearParser.YearParser(), Y: new _LocalWeekYearParser.LocalWeekYearParser(), @@ -11575,1393 +9082,969 @@ var require_parsers = __commonJS({ t: new _TimestampSecondsParser.TimestampSecondsParser(), T: new _TimestampMillisecondsParser.TimestampMillisecondsParser() }; - exports2.parsers = parsers; } }); -// node_modules/date-fns/parse/index.js +// node_modules/date-fns/parse.js var require_parse = __commonJS({ - "node_modules/date-fns/parse/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = parse2; - var _typeof2 = _interopRequireDefault(require_typeof()); - var _createForOfIteratorHelper2 = _interopRequireDefault(require_createForOfIteratorHelper()); - var _index = _interopRequireDefault(require_defaultLocale()); - var _index2 = _interopRequireDefault(require_subMilliseconds()); - var _index3 = _interopRequireDefault(require_toDate()); - var _index4 = _interopRequireDefault(require_assign()); - var _index5 = _interopRequireDefault(require_longFormatters()); - var _index6 = _interopRequireDefault(require_getTimezoneOffsetInMilliseconds()); - var _index7 = require_protectedTokens(); - var _index8 = _interopRequireDefault(require_toInteger()); - var _index9 = _interopRequireDefault(require_requiredArgs()); + "node_modules/date-fns/parse.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "longFormatters", { + enumerable: true, + get: function() { + return _index5.longFormatters; + } + }); + exports2.parse = parse2; + Object.defineProperty(exports2, "parsers", { + enumerable: true, + get: function() { + return _index7.parsers; + } + }); + var _index = require_constructFrom(); + var _index2 = require_getDefaultOptions(); + var _index3 = require_defaultLocale(); + var _index4 = require_toDate(); + var _index5 = require_longFormatters(); + var _index6 = require_protectedTokens(); + var _index7 = require_parsers(); var _Setter = require_Setter(); - var _index10 = require_parsers(); - var _index11 = require_defaultOptions(); var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; var escapedStringRegExp = /^'([^]*?)'?$/; var doubleQuoteRegExp = /''/g; var notWhitespaceRegExp = /\S/; var unescapedLatinCharacterRegExp = /[a-zA-Z]/; - function parse2(dirtyDateString, dirtyFormatString, dirtyReferenceDate, options) { - var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4; - (0, _index9.default)(3, arguments); - var dateString = String(dirtyDateString); - var formatString = String(dirtyFormatString); - var defaultOptions = (0, _index11.getDefaultOptions)(); - var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : _index.default; - if (!locale.match) { - throw new RangeError("locale must contain match property"); - } - var firstWeekContainsDate = (0, _index8.default)((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); - if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { - throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively"); - } - var weekStartsOn = (0, _index8.default)((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - if (formatString === "") { - if (dateString === "") { - return (0, _index3.default)(dirtyReferenceDate); + function parse2(dateStr, formatStr, referenceDate, options) { + const defaultOptions = (0, _index2.getDefaultOptions)(); + const locale = options?.locale ?? defaultOptions.locale ?? _index3.defaultLocale; + const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; + if (formatStr === "") { + if (dateStr === "") { + return (0, _index4.toDate)(referenceDate); } else { - return /* @__PURE__ */ new Date(NaN); + return (0, _index.constructFrom)(referenceDate, NaN); } } - var subFnOptions = { + const subFnOptions = { firstWeekContainsDate, weekStartsOn, locale }; - var setters = [new _Setter.DateToSystemTimezoneSetter()]; - var tokens = formatString.match(longFormattingTokensRegExp).map(function(substring) { - var firstCharacter = substring[0]; - if (firstCharacter in _index5.default) { - var longFormatter = _index5.default[firstCharacter]; + const setters = [new _Setter.DateToSystemTimezoneSetter()]; + const tokens = formatStr.match(longFormattingTokensRegExp).map((substring) => { + const firstCharacter = substring[0]; + if (firstCharacter in _index5.longFormatters) { + const longFormatter = _index5.longFormatters[firstCharacter]; return longFormatter(substring, locale.formatLong); } return substring; }).join("").match(formattingTokensRegExp); - var usedTokens = []; - var _iterator = (0, _createForOfIteratorHelper2.default)(tokens), _step; - try { - var _loop = function _loop2() { - var token = _step.value; - if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && (0, _index7.isProtectedWeekYearToken)(token)) { - (0, _index7.throwProtectedError)(token, formatString, dirtyDateString); + const usedTokens = []; + for (let token of tokens) { + if (!options?.useAdditionalWeekYearTokens && (0, _index6.isProtectedWeekYearToken)(token)) { + (0, _index6.warnOrThrowProtectedError)(token, formatStr, dateStr); + } + if (!options?.useAdditionalDayOfYearTokens && (0, _index6.isProtectedDayOfYearToken)(token)) { + (0, _index6.warnOrThrowProtectedError)(token, formatStr, dateStr); + } + const firstCharacter = token[0]; + const parser = _index7.parsers[firstCharacter]; + if (parser) { + const { incompatibleTokens } = parser; + if (Array.isArray(incompatibleTokens)) { + const incompatibleToken = usedTokens.find( + (usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter + ); + if (incompatibleToken) { + throw new RangeError( + `The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time` + ); + } + } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) { + throw new RangeError( + `The format string mustn't contain \`${token}\` and any other token at the same time` + ); } - if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && (0, _index7.isProtectedDayOfYearToken)(token)) { - (0, _index7.throwProtectedError)(token, formatString, dirtyDateString); + usedTokens.push({ token: firstCharacter, fullToken: token }); + const parseResult = parser.run( + dateStr, + token, + locale.match, + subFnOptions + ); + if (!parseResult) { + return (0, _index.constructFrom)(referenceDate, NaN); } - var firstCharacter = token[0]; - var parser = _index10.parsers[firstCharacter]; - if (parser) { - var incompatibleTokens = parser.incompatibleTokens; - if (Array.isArray(incompatibleTokens)) { - var incompatibleToken = usedTokens.find(function(usedToken) { - return incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter; - }); - if (incompatibleToken) { - throw new RangeError("The format string mustn't contain `".concat(incompatibleToken.fullToken, "` and `").concat(token, "` at the same time")); - } - } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) { - throw new RangeError("The format string mustn't contain `".concat(token, "` and any other token at the same time")); - } - usedTokens.push({ - token: firstCharacter, - fullToken: token - }); - var parseResult = parser.run(dateString, token, locale.match, subFnOptions); - if (!parseResult) { - return { - v: /* @__PURE__ */ new Date(NaN) - }; - } - setters.push(parseResult.setter); - dateString = parseResult.rest; + setters.push(parseResult.setter); + dateStr = parseResult.rest; + } else { + if (firstCharacter.match(unescapedLatinCharacterRegExp)) { + throw new RangeError( + "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" + ); + } + if (token === "''") { + token = "'"; + } else if (firstCharacter === "'") { + token = cleanEscapedString(token); + } + if (dateStr.indexOf(token) === 0) { + dateStr = dateStr.slice(token.length); } else { - if (firstCharacter.match(unescapedLatinCharacterRegExp)) { - throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"); - } - if (token === "''") { - token = "'"; - } else if (firstCharacter === "'") { - token = cleanEscapedString(token); - } - if (dateString.indexOf(token) === 0) { - dateString = dateString.slice(token.length); - } else { - return { - v: /* @__PURE__ */ new Date(NaN) - }; - } + return (0, _index.constructFrom)(referenceDate, NaN); } - }; - for (_iterator.s(); !(_step = _iterator.n()).done; ) { - var _ret = _loop(); - if ((0, _typeof2.default)(_ret) === "object") - return _ret.v; } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); } - if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) { - return /* @__PURE__ */ new Date(NaN); + if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) { + return (0, _index.constructFrom)(referenceDate, NaN); } - var uniquePrioritySetters = setters.map(function(setter2) { - return setter2.priority; - }).sort(function(a, b) { - return b - a; - }).filter(function(priority, index, array) { - return array.indexOf(priority) === index; - }).map(function(priority) { - return setters.filter(function(setter2) { - return setter2.priority === priority; - }).sort(function(a, b) { - return b.subPriority - a.subPriority; - }); - }).map(function(setterArray) { - return setterArray[0]; - }); - var date = (0, _index3.default)(dirtyReferenceDate); + const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a, b) => b - a).filter((priority, index, array) => array.indexOf(priority) === index).map( + (priority) => setters.filter((setter) => setter.priority === priority).sort((a, b) => b.subPriority - a.subPriority) + ).map((setterArray) => setterArray[0]); + let date = (0, _index4.toDate)(referenceDate); if (isNaN(date.getTime())) { - return /* @__PURE__ */ new Date(NaN); + return (0, _index.constructFrom)(referenceDate, NaN); } - var utcDate = (0, _index2.default)(date, (0, _index6.default)(date)); - var flags = {}; - var _iterator2 = (0, _createForOfIteratorHelper2.default)(uniquePrioritySetters), _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { - var setter = _step2.value; - if (!setter.validate(utcDate, subFnOptions)) { - return /* @__PURE__ */ new Date(NaN); - } - var result = setter.set(utcDate, flags, subFnOptions); - if (Array.isArray(result)) { - utcDate = result[0]; - (0, _index4.default)(flags, result[1]); - } else { - utcDate = result; - } + const flags = {}; + for (const setter of uniquePrioritySetters) { + if (!setter.validate(date, subFnOptions)) { + return (0, _index.constructFrom)(referenceDate, NaN); + } + const result = setter.set(date, flags, subFnOptions); + if (Array.isArray(result)) { + date = result[0]; + Object.assign(flags, result[1]); + } else { + date = result; } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); } - return utcDate; + return (0, _index.constructFrom)(referenceDate, date); } function cleanEscapedString(input) { return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'"); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isMatch/index.js +// node_modules/date-fns/isMatch.js var require_isMatch = __commonJS({ - "node_modules/date-fns/isMatch/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isMatch; - var _index = _interopRequireDefault(require_parse()); - var _index2 = _interopRequireDefault(require_isValid()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function isMatch(dateString, formatString, options) { - (0, _index3.default)(2, arguments); - return (0, _index2.default)((0, _index.default)(dateString, formatString, /* @__PURE__ */ new Date(), options)); + "node_modules/date-fns/isMatch.js"(exports2) { + "use strict"; + exports2.isMatch = isMatch; + var _index = require_isValid(); + var _index2 = require_parse(); + function isMatch(dateStr, formatStr, options) { + return (0, _index.isValid)( + (0, _index2.parse)(dateStr, formatStr, /* @__PURE__ */ new Date(), options) + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isMonday/index.js +// node_modules/date-fns/isMonday.js var require_isMonday = __commonJS({ - "node_modules/date-fns/isMonday/index.js"(exports2, module2) { + "node_modules/date-fns/isMonday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isMonday; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); + exports2.isMonday = isMonday; + var _index = require_toDate(); function isMonday(date) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(date).getDay() === 1; + return (0, _index.toDate)(date).getDay() === 1; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isPast/index.js +// node_modules/date-fns/isPast.js var require_isPast = __commonJS({ - "node_modules/date-fns/isPast/index.js"(exports2, module2) { + "node_modules/date-fns/isPast.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isPast; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isPast(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getTime() < Date.now(); + exports2.isPast = isPast; + var _index = require_toDate(); + function isPast(date) { + return +(0, _index.toDate)(date) < Date.now(); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfHour/index.js +// node_modules/date-fns/startOfHour.js var require_startOfHour = __commonJS({ - "node_modules/date-fns/startOfHour/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfHour; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfHour(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - date.setMinutes(0, 0, 0); - return date; + "node_modules/date-fns/startOfHour.js"(exports2) { + "use strict"; + exports2.startOfHour = startOfHour; + var _index = require_toDate(); + function startOfHour(date) { + const _date = (0, _index.toDate)(date); + _date.setMinutes(0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameHour/index.js +// node_modules/date-fns/isSameHour.js var require_isSameHour = __commonJS({ - "node_modules/date-fns/isSameHour/index.js"(exports2, module2) { + "node_modules/date-fns/isSameHour.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameHour; - var _index = _interopRequireDefault(require_startOfHour()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameHour(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeftStartOfHour = (0, _index.default)(dirtyDateLeft); - var dateRightStartOfHour = (0, _index.default)(dirtyDateRight); - return dateLeftStartOfHour.getTime() === dateRightStartOfHour.getTime(); + exports2.isSameHour = isSameHour; + var _index = require_startOfHour(); + function isSameHour(dateLeft, dateRight) { + const dateLeftStartOfHour = (0, _index.startOfHour)(dateLeft); + const dateRightStartOfHour = (0, _index.startOfHour)(dateRight); + return +dateLeftStartOfHour === +dateRightStartOfHour; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameWeek/index.js +// node_modules/date-fns/isSameWeek.js var require_isSameWeek = __commonJS({ - "node_modules/date-fns/isSameWeek/index.js"(exports2, module2) { + "node_modules/date-fns/isSameWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameWeek; - var _index = _interopRequireDefault(require_startOfWeek()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameWeek(dirtyDateLeft, dirtyDateRight, options) { - (0, _index2.default)(2, arguments); - var dateLeftStartOfWeek = (0, _index.default)(dirtyDateLeft, options); - var dateRightStartOfWeek = (0, _index.default)(dirtyDateRight, options); - return dateLeftStartOfWeek.getTime() === dateRightStartOfWeek.getTime(); + exports2.isSameWeek = isSameWeek; + var _index = require_startOfWeek(); + function isSameWeek(dateLeft, dateRight, options) { + const dateLeftStartOfWeek = (0, _index.startOfWeek)(dateLeft, options); + const dateRightStartOfWeek = (0, _index.startOfWeek)(dateRight, options); + return +dateLeftStartOfWeek === +dateRightStartOfWeek; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameISOWeek/index.js +// node_modules/date-fns/isSameISOWeek.js var require_isSameISOWeek = __commonJS({ - "node_modules/date-fns/isSameISOWeek/index.js"(exports2, module2) { + "node_modules/date-fns/isSameISOWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameISOWeek; - var _index = _interopRequireDefault(require_isSameWeek()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameISOWeek(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - return (0, _index.default)(dirtyDateLeft, dirtyDateRight, { - weekStartsOn: 1 - }); + exports2.isSameISOWeek = isSameISOWeek; + var _index = require_isSameWeek(); + function isSameISOWeek(dateLeft, dateRight) { + return (0, _index.isSameWeek)(dateLeft, dateRight, { weekStartsOn: 1 }); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameISOWeekYear/index.js +// node_modules/date-fns/isSameISOWeekYear.js var require_isSameISOWeekYear = __commonJS({ - "node_modules/date-fns/isSameISOWeekYear/index.js"(exports2, module2) { + "node_modules/date-fns/isSameISOWeekYear.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameISOWeekYear; - var _index = _interopRequireDefault(require_startOfISOWeekYear()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameISOWeekYear(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeftStartOfYear = (0, _index.default)(dirtyDateLeft); - var dateRightStartOfYear = (0, _index.default)(dirtyDateRight); - return dateLeftStartOfYear.getTime() === dateRightStartOfYear.getTime(); + exports2.isSameISOWeekYear = isSameISOWeekYear; + var _index = require_startOfISOWeekYear(); + function isSameISOWeekYear(dateLeft, dateRight) { + const dateLeftStartOfYear = (0, _index.startOfISOWeekYear)(dateLeft); + const dateRightStartOfYear = (0, _index.startOfISOWeekYear)(dateRight); + return +dateLeftStartOfYear === +dateRightStartOfYear; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameMinute/index.js +// node_modules/date-fns/isSameMinute.js var require_isSameMinute = __commonJS({ - "node_modules/date-fns/isSameMinute/index.js"(exports2, module2) { + "node_modules/date-fns/isSameMinute.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameMinute; - var _index = _interopRequireDefault(require_startOfMinute()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameMinute(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeftStartOfMinute = (0, _index.default)(dirtyDateLeft); - var dateRightStartOfMinute = (0, _index.default)(dirtyDateRight); - return dateLeftStartOfMinute.getTime() === dateRightStartOfMinute.getTime(); + exports2.isSameMinute = isSameMinute; + var _index = require_startOfMinute(); + function isSameMinute(dateLeft, dateRight) { + const dateLeftStartOfMinute = (0, _index.startOfMinute)(dateLeft); + const dateRightStartOfMinute = (0, _index.startOfMinute)(dateRight); + return +dateLeftStartOfMinute === +dateRightStartOfMinute; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameMonth/index.js +// node_modules/date-fns/isSameMonth.js var require_isSameMonth = __commonJS({ - "node_modules/date-fns/isSameMonth/index.js"(exports2, module2) { + "node_modules/date-fns/isSameMonth.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameMonth; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameMonth(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth(); + exports2.isSameMonth = isSameMonth; + var _index = require_toDate(); + function isSameMonth(dateLeft, dateRight) { + const _dateLeft = (0, _index.toDate)(dateLeft); + const _dateRight = (0, _index.toDate)(dateRight); + return _dateLeft.getFullYear() === _dateRight.getFullYear() && _dateLeft.getMonth() === _dateRight.getMonth(); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameQuarter/index.js +// node_modules/date-fns/isSameQuarter.js var require_isSameQuarter = __commonJS({ - "node_modules/date-fns/isSameQuarter/index.js"(exports2, module2) { + "node_modules/date-fns/isSameQuarter.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameQuarter; - var _index = _interopRequireDefault(require_startOfQuarter()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameQuarter(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeftStartOfQuarter = (0, _index.default)(dirtyDateLeft); - var dateRightStartOfQuarter = (0, _index.default)(dirtyDateRight); - return dateLeftStartOfQuarter.getTime() === dateRightStartOfQuarter.getTime(); + exports2.isSameQuarter = isSameQuarter; + var _index = require_startOfQuarter(); + function isSameQuarter(dateLeft, dateRight) { + const dateLeftStartOfQuarter = (0, _index.startOfQuarter)(dateLeft); + const dateRightStartOfQuarter = (0, _index.startOfQuarter)(dateRight); + return +dateLeftStartOfQuarter === +dateRightStartOfQuarter; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfSecond/index.js +// node_modules/date-fns/startOfSecond.js var require_startOfSecond = __commonJS({ - "node_modules/date-fns/startOfSecond/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfSecond; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfSecond(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - date.setMilliseconds(0); - return date; + "node_modules/date-fns/startOfSecond.js"(exports2) { + "use strict"; + exports2.startOfSecond = startOfSecond; + var _index = require_toDate(); + function startOfSecond(date) { + const _date = (0, _index.toDate)(date); + _date.setMilliseconds(0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameSecond/index.js +// node_modules/date-fns/isSameSecond.js var require_isSameSecond = __commonJS({ - "node_modules/date-fns/isSameSecond/index.js"(exports2, module2) { + "node_modules/date-fns/isSameSecond.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameSecond; - var _index = _interopRequireDefault(require_startOfSecond()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameSecond(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeftStartOfSecond = (0, _index.default)(dirtyDateLeft); - var dateRightStartOfSecond = (0, _index.default)(dirtyDateRight); - return dateLeftStartOfSecond.getTime() === dateRightStartOfSecond.getTime(); + exports2.isSameSecond = isSameSecond; + var _index = require_startOfSecond(); + function isSameSecond(dateLeft, dateRight) { + const dateLeftStartOfSecond = (0, _index.startOfSecond)(dateLeft); + const dateRightStartOfSecond = (0, _index.startOfSecond)(dateRight); + return +dateLeftStartOfSecond === +dateRightStartOfSecond; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameYear/index.js +// node_modules/date-fns/isSameYear.js var require_isSameYear = __commonJS({ - "node_modules/date-fns/isSameYear/index.js"(exports2, module2) { + "node_modules/date-fns/isSameYear.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isSameYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isSameYear(dirtyDateLeft, dirtyDateRight) { - (0, _index2.default)(2, arguments); - var dateLeft = (0, _index.default)(dirtyDateLeft); - var dateRight = (0, _index.default)(dirtyDateRight); - return dateLeft.getFullYear() === dateRight.getFullYear(); + exports2.isSameYear = isSameYear; + var _index = require_toDate(); + function isSameYear(dateLeft, dateRight) { + const _dateLeft = (0, _index.toDate)(dateLeft); + const _dateRight = (0, _index.toDate)(dateRight); + return _dateLeft.getFullYear() === _dateRight.getFullYear(); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisHour/index.js +// node_modules/date-fns/isThisHour.js var require_isThisHour = __commonJS({ - "node_modules/date-fns/isThisHour/index.js"(exports2, module2) { + "node_modules/date-fns/isThisHour.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isThisHour; - var _index = _interopRequireDefault(require_isSameHour()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isThisHour(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(Date.now(), dirtyDate); + exports2.isThisHour = isThisHour; + var _index = require_constructNow(); + var _index2 = require_isSameHour(); + function isThisHour(date) { + return (0, _index2.isSameHour)(date, (0, _index.constructNow)(date)); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisISOWeek/index.js +// node_modules/date-fns/isThisISOWeek.js var require_isThisISOWeek = __commonJS({ - "node_modules/date-fns/isThisISOWeek/index.js"(exports2, module2) { + "node_modules/date-fns/isThisISOWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isThisISOWeek; - var _index = _interopRequireDefault(require_isSameISOWeek()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isThisISOWeek(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate, Date.now()); + exports2.isThisISOWeek = isThisISOWeek; + var _index = require_constructNow(); + var _index2 = require_isSameISOWeek(); + function isThisISOWeek(date) { + return (0, _index2.isSameISOWeek)(date, (0, _index.constructNow)(date)); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisMinute/index.js +// node_modules/date-fns/isThisMinute.js var require_isThisMinute = __commonJS({ - "node_modules/date-fns/isThisMinute/index.js"(exports2, module2) { + "node_modules/date-fns/isThisMinute.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isThisMinute; - var _index = _interopRequireDefault(require_isSameMinute()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isThisMinute(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(Date.now(), dirtyDate); + exports2.isThisMinute = isThisMinute; + var _index = require_constructNow(); + var _index2 = require_isSameMinute(); + function isThisMinute(date) { + return (0, _index2.isSameMinute)(date, (0, _index.constructNow)(date)); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisMonth/index.js +// node_modules/date-fns/isThisMonth.js var require_isThisMonth = __commonJS({ - "node_modules/date-fns/isThisMonth/index.js"(exports2, module2) { + "node_modules/date-fns/isThisMonth.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isThisMonth; - var _index = _interopRequireDefault(require_isSameMonth()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isThisMonth(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(Date.now(), dirtyDate); + exports2.isThisMonth = isThisMonth; + var _index = require_constructNow(); + var _index2 = require_isSameMonth(); + function isThisMonth(date) { + return (0, _index2.isSameMonth)(date, (0, _index.constructNow)(date)); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisQuarter/index.js +// node_modules/date-fns/isThisQuarter.js var require_isThisQuarter = __commonJS({ - "node_modules/date-fns/isThisQuarter/index.js"(exports2, module2) { + "node_modules/date-fns/isThisQuarter.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isThisQuarter; - var _index = _interopRequireDefault(require_isSameQuarter()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isThisQuarter(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(Date.now(), dirtyDate); + exports2.isThisQuarter = isThisQuarter; + var _index = require_constructNow(); + var _index2 = require_isSameQuarter(); + function isThisQuarter(date) { + return (0, _index2.isSameQuarter)(date, (0, _index.constructNow)(date)); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisSecond/index.js +// node_modules/date-fns/isThisSecond.js var require_isThisSecond = __commonJS({ - "node_modules/date-fns/isThisSecond/index.js"(exports2, module2) { + "node_modules/date-fns/isThisSecond.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isThisSecond; - var _index = _interopRequireDefault(require_isSameSecond()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isThisSecond(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(Date.now(), dirtyDate); + exports2.isThisSecond = isThisSecond; + var _index = require_constructNow(); + var _index2 = require_isSameSecond(); + function isThisSecond(date) { + return (0, _index2.isSameSecond)(date, (0, _index.constructNow)(date)); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisWeek/index.js +// node_modules/date-fns/isThisWeek.js var require_isThisWeek = __commonJS({ - "node_modules/date-fns/isThisWeek/index.js"(exports2, module2) { + "node_modules/date-fns/isThisWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isThisWeek; - var _index = _interopRequireDefault(require_isSameWeek()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isThisWeek(dirtyDate, options) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate, Date.now(), options); + exports2.isThisWeek = isThisWeek; + var _index = require_constructNow(); + var _index2 = require_isSameWeek(); + function isThisWeek(date, options) { + return (0, _index2.isSameWeek)(date, (0, _index.constructNow)(date), options); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisYear/index.js +// node_modules/date-fns/isThisYear.js var require_isThisYear = __commonJS({ - "node_modules/date-fns/isThisYear/index.js"(exports2, module2) { + "node_modules/date-fns/isThisYear.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isThisYear; - var _index = _interopRequireDefault(require_isSameYear()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isThisYear(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate, Date.now()); + exports2.isThisYear = isThisYear; + var _index = require_constructNow(); + var _index2 = require_isSameYear(); + function isThisYear(date) { + return (0, _index2.isSameYear)(date, (0, _index.constructNow)(date)); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isThursday/index.js +// node_modules/date-fns/isThursday.js var require_isThursday = __commonJS({ - "node_modules/date-fns/isThursday/index.js"(exports2, module2) { + "node_modules/date-fns/isThursday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isThursday; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isThursday(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getDay() === 4; + exports2.isThursday = isThursday; + var _index = require_toDate(); + function isThursday(date) { + return (0, _index.toDate)(date).getDay() === 4; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isToday/index.js +// node_modules/date-fns/isToday.js var require_isToday = __commonJS({ - "node_modules/date-fns/isToday/index.js"(exports2, module2) { + "node_modules/date-fns/isToday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isToday; - var _index = _interopRequireDefault(require_isSameDay()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isToday(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate, Date.now()); + exports2.isToday = isToday; + var _index = require_constructNow(); + var _index2 = require_isSameDay(); + function isToday(date) { + return (0, _index2.isSameDay)(date, (0, _index.constructNow)(date)); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isTomorrow/index.js +// node_modules/date-fns/isTomorrow.js var require_isTomorrow = __commonJS({ - "node_modules/date-fns/isTomorrow/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isTomorrow; - var _index = _interopRequireDefault(require_addDays()); - var _index2 = _interopRequireDefault(require_isSameDay()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function isTomorrow(dirtyDate) { - (0, _index3.default)(1, arguments); - return (0, _index2.default)(dirtyDate, (0, _index.default)(Date.now(), 1)); + "node_modules/date-fns/isTomorrow.js"(exports2) { + "use strict"; + exports2.isTomorrow = isTomorrow; + var _index = require_addDays(); + var _index2 = require_constructNow(); + var _index3 = require_isSameDay(); + function isTomorrow(date) { + return (0, _index3.isSameDay)( + date, + (0, _index.addDays)((0, _index2.constructNow)(date), 1) + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isTuesday/index.js +// node_modules/date-fns/isTuesday.js var require_isTuesday = __commonJS({ - "node_modules/date-fns/isTuesday/index.js"(exports2, module2) { + "node_modules/date-fns/isTuesday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isTuesday; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isTuesday(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getDay() === 2; + exports2.isTuesday = isTuesday; + var _index = require_toDate(); + function isTuesday(date) { + return (0, _index.toDate)(date).getDay() === 2; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isWednesday/index.js +// node_modules/date-fns/isWednesday.js var require_isWednesday = __commonJS({ - "node_modules/date-fns/isWednesday/index.js"(exports2, module2) { + "node_modules/date-fns/isWednesday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isWednesday; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isWednesday(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate).getDay() === 3; + exports2.isWednesday = isWednesday; + var _index = require_toDate(); + function isWednesday(date) { + return (0, _index.toDate)(date).getDay() === 3; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isWithinInterval/index.js +// node_modules/date-fns/isWithinInterval.js var require_isWithinInterval = __commonJS({ - "node_modules/date-fns/isWithinInterval/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isWithinInterval; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function isWithinInterval(dirtyDate, interval) { - (0, _index2.default)(2, arguments); - var time = (0, _index.default)(dirtyDate).getTime(); - var startTime = (0, _index.default)(interval.start).getTime(); - var endTime = (0, _index.default)(interval.end).getTime(); - if (!(startTime <= endTime)) { - throw new RangeError("Invalid interval"); - } + "node_modules/date-fns/isWithinInterval.js"(exports2) { + "use strict"; + exports2.isWithinInterval = isWithinInterval; + var _index = require_toDate(); + function isWithinInterval(date, interval) { + const time = +(0, _index.toDate)(date); + const [startTime, endTime] = [ + +(0, _index.toDate)(interval.start), + +(0, _index.toDate)(interval.end) + ].sort((a, b) => a - b); return time >= startTime && time <= endTime; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subDays/index.js +// node_modules/date-fns/subDays.js var require_subDays = __commonJS({ - "node_modules/date-fns/subDays/index.js"(exports2, module2) { + "node_modules/date-fns/subDays.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subDays; - var _index = _interopRequireDefault(require_addDays()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); - function subDays(dirtyDate, dirtyAmount) { - (0, _index2.default)(2, arguments); - var amount = (0, _index3.default)(dirtyAmount); - return (0, _index.default)(dirtyDate, -amount); + exports2.subDays = subDays; + var _index = require_addDays(); + function subDays(date, amount) { + return (0, _index.addDays)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/isYesterday/index.js +// node_modules/date-fns/isYesterday.js var require_isYesterday = __commonJS({ - "node_modules/date-fns/isYesterday/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = isYesterday; - var _index = _interopRequireDefault(require_isSameDay()); - var _index2 = _interopRequireDefault(require_subDays()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function isYesterday(dirtyDate) { - (0, _index3.default)(1, arguments); - return (0, _index.default)(dirtyDate, (0, _index2.default)(Date.now(), 1)); + "node_modules/date-fns/isYesterday.js"(exports2) { + "use strict"; + exports2.isYesterday = isYesterday; + var _index = require_constructNow(); + var _index2 = require_isSameDay(); + var _index3 = require_subDays(); + function isYesterday(date) { + return (0, _index2.isSameDay)( + date, + (0, _index3.subDays)((0, _index.constructNow)(date), 1) + ); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfDecade/index.js +// node_modules/date-fns/lastDayOfDecade.js var require_lastDayOfDecade = __commonJS({ - "node_modules/date-fns/lastDayOfDecade/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = lastDayOfDecade; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function lastDayOfDecade(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getFullYear(); - var decade = 9 + Math.floor(year / 10) * 10; - date.setFullYear(decade + 1, 0, 0); - date.setHours(0, 0, 0, 0); - return date; + "node_modules/date-fns/lastDayOfDecade.js"(exports2) { + "use strict"; + exports2.lastDayOfDecade = lastDayOfDecade; + var _index = require_toDate(); + function lastDayOfDecade(date) { + const _date = (0, _index.toDate)(date); + const year = _date.getFullYear(); + const decade = 9 + Math.floor(year / 10) * 10; + _date.setFullYear(decade + 1, 0, 0); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfWeek/index.js +// node_modules/date-fns/lastDayOfWeek.js var require_lastDayOfWeek = __commonJS({ - "node_modules/date-fns/lastDayOfWeek/index.js"(exports2, module2) { + "node_modules/date-fns/lastDayOfWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = lastDayOfWeek; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_toInteger()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var _index4 = require_defaultOptions(); - function lastDayOfWeek(dirtyDate, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index3.default)(1, arguments); - var defaultOptions = (0, _index4.getDefaultOptions)(); - var weekStartsOn = (0, _index2.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6"); - } - var date = (0, _index.default)(dirtyDate); - var day = date.getDay(); - var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); - date.setHours(0, 0, 0, 0); - date.setDate(date.getDate() + diff); - return date; + exports2.lastDayOfWeek = lastDayOfWeek; + var _index = require_toDate(); + var _index2 = require_defaultOptions(); + function lastDayOfWeek(date, options) { + const defaultOptions = (0, _index2.getDefaultOptions)(); + const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0; + const _date = (0, _index.toDate)(date); + const day = _date.getDay(); + const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); + _date.setHours(0, 0, 0, 0); + _date.setDate(_date.getDate() + diff); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfISOWeek/index.js +// node_modules/date-fns/lastDayOfISOWeek.js var require_lastDayOfISOWeek = __commonJS({ - "node_modules/date-fns/lastDayOfISOWeek/index.js"(exports2, module2) { + "node_modules/date-fns/lastDayOfISOWeek.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = lastDayOfISOWeek; - var _index = _interopRequireDefault(require_lastDayOfWeek()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function lastDayOfISOWeek(dirtyDate) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(dirtyDate, { - weekStartsOn: 1 - }); + exports2.lastDayOfISOWeek = lastDayOfISOWeek; + var _index = require_lastDayOfWeek(); + function lastDayOfISOWeek(date) { + return (0, _index.lastDayOfWeek)(date, { weekStartsOn: 1 }); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfISOWeekYear/index.js +// node_modules/date-fns/lastDayOfISOWeekYear.js var require_lastDayOfISOWeekYear = __commonJS({ - "node_modules/date-fns/lastDayOfISOWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = lastDayOfISOWeekYear; - var _index = _interopRequireDefault(require_getISOWeekYear()); - var _index2 = _interopRequireDefault(require_startOfISOWeek()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function lastDayOfISOWeekYear(dirtyDate) { - (0, _index3.default)(1, arguments); - var year = (0, _index.default)(dirtyDate); - var fourthOfJanuary = /* @__PURE__ */ new Date(0); + "node_modules/date-fns/lastDayOfISOWeekYear.js"(exports2) { + "use strict"; + exports2.lastDayOfISOWeekYear = lastDayOfISOWeekYear; + var _index = require_getISOWeekYear(); + var _index2 = require_startOfISOWeek(); + var _index3 = require_constructFrom(); + function lastDayOfISOWeekYear(date) { + const year = (0, _index.getISOWeekYear)(date); + const fourthOfJanuary = (0, _index3.constructFrom)(date, 0); fourthOfJanuary.setFullYear(year + 1, 0, 4); fourthOfJanuary.setHours(0, 0, 0, 0); - var date = (0, _index2.default)(fourthOfJanuary); - date.setDate(date.getDate() - 1); - return date; + const _date = (0, _index2.startOfISOWeek)(fourthOfJanuary); + _date.setDate(_date.getDate() - 1); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfQuarter/index.js +// node_modules/date-fns/lastDayOfQuarter.js var require_lastDayOfQuarter = __commonJS({ - "node_modules/date-fns/lastDayOfQuarter/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = lastDayOfQuarter; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function lastDayOfQuarter(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var currentMonth = date.getMonth(); - var month = currentMonth - currentMonth % 3 + 3; - date.setMonth(month, 0); - date.setHours(0, 0, 0, 0); - return date; + "node_modules/date-fns/lastDayOfQuarter.js"(exports2) { + "use strict"; + exports2.lastDayOfQuarter = lastDayOfQuarter; + var _index = require_toDate(); + function lastDayOfQuarter(date) { + const _date = (0, _index.toDate)(date); + const currentMonth = _date.getMonth(); + const month = currentMonth - currentMonth % 3 + 3; + _date.setMonth(month, 0); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfYear/index.js +// node_modules/date-fns/lastDayOfYear.js var require_lastDayOfYear = __commonJS({ - "node_modules/date-fns/lastDayOfYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = lastDayOfYear; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function lastDayOfYear(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getFullYear(); - date.setFullYear(year + 1, 0, 0); - date.setHours(0, 0, 0, 0); - return date; + "node_modules/date-fns/lastDayOfYear.js"(exports2) { + "use strict"; + exports2.lastDayOfYear = lastDayOfYear; + var _index = require_toDate(); + function lastDayOfYear(date) { + const _date = (0, _index.toDate)(date); + const year = _date.getFullYear(); + _date.setFullYear(year + 1, 0, 0); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/lightFormat/index.js +// node_modules/date-fns/lightFormat.js var require_lightFormat = __commonJS({ - "node_modules/date-fns/lightFormat/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = lightFormat; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_lightFormatters()); - var _index3 = _interopRequireDefault(require_getTimezoneOffsetInMilliseconds()); - var _index4 = _interopRequireDefault(require_isValid()); - var _index5 = _interopRequireDefault(require_subMilliseconds()); - var _index6 = _interopRequireDefault(require_requiredArgs()); + "node_modules/date-fns/lightFormat.js"(exports2) { + "use strict"; + exports2.lightFormat = lightFormat; + Object.defineProperty(exports2, "lightFormatters", { + enumerable: true, + get: function() { + return _index3.lightFormatters; + } + }); + var _index = require_isValid(); + var _index2 = require_toDate(); + var _index3 = require_lightFormatters(); var formattingTokensRegExp = /(\w)\1*|''|'(''|[^'])+('|$)|./g; var escapedStringRegExp = /^'([^]*?)'?$/; var doubleQuoteRegExp = /''/g; var unescapedLatinCharacterRegExp = /[a-zA-Z]/; - function lightFormat(dirtyDate, formatStr) { - (0, _index6.default)(2, arguments); - var originalDate = (0, _index.default)(dirtyDate); - if (!(0, _index4.default)(originalDate)) { + function lightFormat(date, formatStr) { + const _date = (0, _index2.toDate)(date); + if (!(0, _index.isValid)(_date)) { throw new RangeError("Invalid time value"); } - var timezoneOffset = (0, _index3.default)(originalDate); - var utcDate = (0, _index5.default)(originalDate, timezoneOffset); - var tokens = formatStr.match(formattingTokensRegExp); + const tokens = formatStr.match(formattingTokensRegExp); if (!tokens) return ""; - var result = tokens.map(function(substring) { + const result = tokens.map((substring) => { if (substring === "''") { return "'"; } - var firstCharacter = substring[0]; + const firstCharacter = substring[0]; if (firstCharacter === "'") { return cleanEscapedString(substring); } - var formatter = _index2.default[firstCharacter]; + const formatter = _index3.lightFormatters[firstCharacter]; if (formatter) { - return formatter(utcDate, substring); + return formatter(_date, substring); } if (firstCharacter.match(unescapedLatinCharacterRegExp)) { - throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"); + throw new RangeError( + "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" + ); } return substring; }).join(""); return result; } function cleanEscapedString(input) { - var matches = input.match(escapedStringRegExp); + const matches = input.match(escapedStringRegExp); if (!matches) { return input; } return matches[1].replace(doubleQuoteRegExp, "'"); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/milliseconds/index.js +// node_modules/date-fns/milliseconds.js var require_milliseconds = __commonJS({ - "node_modules/date-fns/milliseconds/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = milliseconds; - var _index = _interopRequireDefault(require_requiredArgs()); - var daysInYear = 365.2425; - function milliseconds(_ref) { - var years = _ref.years, months = _ref.months, weeks = _ref.weeks, days = _ref.days, hours = _ref.hours, minutes = _ref.minutes, seconds = _ref.seconds; - (0, _index.default)(1, arguments); - var totalDays = 0; + "node_modules/date-fns/milliseconds.js"(exports2) { + "use strict"; + exports2.milliseconds = milliseconds; + var _index = require_constants(); + function milliseconds({ years, months, weeks, days, hours, minutes, seconds }) { + let totalDays = 0; if (years) - totalDays += years * daysInYear; + totalDays += years * _index.daysInYear; if (months) - totalDays += months * (daysInYear / 12); + totalDays += months * (_index.daysInYear / 12); if (weeks) totalDays += weeks * 7; if (days) totalDays += days; - var totalSeconds = totalDays * 24 * 60 * 60; + let totalSeconds = totalDays * 24 * 60 * 60; if (hours) totalSeconds += hours * 60 * 60; if (minutes) totalSeconds += minutes * 60; if (seconds) totalSeconds += seconds; - return Math.round(totalSeconds * 1e3); + return Math.trunc(totalSeconds * 1e3); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/millisecondsToHours/index.js +// node_modules/date-fns/millisecondsToHours.js var require_millisecondsToHours = __commonJS({ - "node_modules/date-fns/millisecondsToHours/index.js"(exports2, module2) { + "node_modules/date-fns/millisecondsToHours.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = millisecondsToHours; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.millisecondsToHours = millisecondsToHours; + var _index = require_constants(); function millisecondsToHours(milliseconds) { - (0, _index.default)(1, arguments); - var hours = milliseconds / _index2.millisecondsInHour; - return Math.floor(hours); + const hours = milliseconds / _index.millisecondsInHour; + return Math.trunc(hours); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/millisecondsToMinutes/index.js +// node_modules/date-fns/millisecondsToMinutes.js var require_millisecondsToMinutes = __commonJS({ - "node_modules/date-fns/millisecondsToMinutes/index.js"(exports2, module2) { + "node_modules/date-fns/millisecondsToMinutes.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = millisecondsToMinutes; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.millisecondsToMinutes = millisecondsToMinutes; + var _index = require_constants(); function millisecondsToMinutes(milliseconds) { - (0, _index.default)(1, arguments); - var minutes = milliseconds / _index2.millisecondsInMinute; - return Math.floor(minutes); + const minutes = milliseconds / _index.millisecondsInMinute; + return Math.trunc(minutes); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/millisecondsToSeconds/index.js +// node_modules/date-fns/millisecondsToSeconds.js var require_millisecondsToSeconds = __commonJS({ - "node_modules/date-fns/millisecondsToSeconds/index.js"(exports2, module2) { + "node_modules/date-fns/millisecondsToSeconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = millisecondsToSeconds; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.millisecondsToSeconds = millisecondsToSeconds; + var _index = require_constants(); function millisecondsToSeconds(milliseconds) { - (0, _index.default)(1, arguments); - var seconds = milliseconds / _index2.millisecondsInSecond; - return Math.floor(seconds); + const seconds = milliseconds / _index.millisecondsInSecond; + return Math.trunc(seconds); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/minutesToHours/index.js +// node_modules/date-fns/minutesToHours.js var require_minutesToHours = __commonJS({ - "node_modules/date-fns/minutesToHours/index.js"(exports2, module2) { + "node_modules/date-fns/minutesToHours.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = minutesToHours; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.minutesToHours = minutesToHours; + var _index = require_constants(); function minutesToHours(minutes) { - (0, _index.default)(1, arguments); - var hours = minutes / _index2.minutesInHour; - return Math.floor(hours); + const hours = minutes / _index.minutesInHour; + return Math.trunc(hours); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/minutesToMilliseconds/index.js +// node_modules/date-fns/minutesToMilliseconds.js var require_minutesToMilliseconds = __commonJS({ - "node_modules/date-fns/minutesToMilliseconds/index.js"(exports2, module2) { + "node_modules/date-fns/minutesToMilliseconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = minutesToMilliseconds; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.minutesToMilliseconds = minutesToMilliseconds; + var _index = require_constants(); function minutesToMilliseconds(minutes) { - (0, _index.default)(1, arguments); - return Math.floor(minutes * _index2.millisecondsInMinute); + return Math.trunc(minutes * _index.millisecondsInMinute); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/minutesToSeconds/index.js +// node_modules/date-fns/minutesToSeconds.js var require_minutesToSeconds = __commonJS({ - "node_modules/date-fns/minutesToSeconds/index.js"(exports2, module2) { + "node_modules/date-fns/minutesToSeconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = minutesToSeconds; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.minutesToSeconds = minutesToSeconds; + var _index = require_constants(); function minutesToSeconds(minutes) { - (0, _index.default)(1, arguments); - return Math.floor(minutes * _index2.secondsInMinute); + return Math.trunc(minutes * _index.secondsInMinute); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/monthsToQuarters/index.js +// node_modules/date-fns/monthsToQuarters.js var require_monthsToQuarters = __commonJS({ - "node_modules/date-fns/monthsToQuarters/index.js"(exports2, module2) { + "node_modules/date-fns/monthsToQuarters.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = monthsToQuarters; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.monthsToQuarters = monthsToQuarters; + var _index = require_constants(); function monthsToQuarters(months) { - (0, _index.default)(1, arguments); - var quarters = months / _index2.monthsInQuarter; - return Math.floor(quarters); + const quarters = months / _index.monthsInQuarter; + return Math.trunc(quarters); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/monthsToYears/index.js +// node_modules/date-fns/monthsToYears.js var require_monthsToYears = __commonJS({ - "node_modules/date-fns/monthsToYears/index.js"(exports2, module2) { + "node_modules/date-fns/monthsToYears.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = monthsToYears; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.monthsToYears = monthsToYears; + var _index = require_constants(); function monthsToYears(months) { - (0, _index.default)(1, arguments); - var years = months / _index2.monthsInYear; - return Math.floor(years); + const years = months / _index.monthsInYear; + return Math.trunc(years); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/nextDay/index.js +// node_modules/date-fns/nextDay.js var require_nextDay = __commonJS({ - "node_modules/date-fns/nextDay/index.js"(exports2, module2) { + "node_modules/date-fns/nextDay.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = nextDay; - var _index = _interopRequireDefault(require_addDays()); - var _index2 = _interopRequireDefault(require_getDay()); - var _index3 = _interopRequireDefault(require_requiredArgs()); + exports2.nextDay = nextDay; + var _index = require_addDays(); + var _index2 = require_getDay(); function nextDay(date, day) { - (0, _index3.default)(2, arguments); - var delta = day - (0, _index2.default)(date); + let delta = day - (0, _index2.getDay)(date); if (delta <= 0) delta += 7; - return (0, _index.default)(date, delta); + return (0, _index.addDays)(date, delta); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/nextFriday/index.js +// node_modules/date-fns/nextFriday.js var require_nextFriday = __commonJS({ - "node_modules/date-fns/nextFriday/index.js"(exports2, module2) { + "node_modules/date-fns/nextFriday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = nextFriday; - var _index = _interopRequireDefault(require_nextDay()); - var _index2 = _interopRequireDefault(require_requiredArgs()); + exports2.nextFriday = nextFriday; + var _index = require_nextDay(); function nextFriday(date) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(date, 5); + return (0, _index.nextDay)(date, 5); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/nextMonday/index.js +// node_modules/date-fns/nextMonday.js var require_nextMonday = __commonJS({ - "node_modules/date-fns/nextMonday/index.js"(exports2, module2) { + "node_modules/date-fns/nextMonday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = nextMonday; - var _index = _interopRequireDefault(require_nextDay()); - var _index2 = _interopRequireDefault(require_requiredArgs()); + exports2.nextMonday = nextMonday; + var _index = require_nextDay(); function nextMonday(date) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(date, 1); + return (0, _index.nextDay)(date, 1); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/nextSaturday/index.js +// node_modules/date-fns/nextSaturday.js var require_nextSaturday = __commonJS({ - "node_modules/date-fns/nextSaturday/index.js"(exports2, module2) { + "node_modules/date-fns/nextSaturday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = nextSaturday; - var _index = _interopRequireDefault(require_nextDay()); - var _index2 = _interopRequireDefault(require_requiredArgs()); + exports2.nextSaturday = nextSaturday; + var _index = require_nextDay(); function nextSaturday(date) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(date, 6); + return (0, _index.nextDay)(date, 6); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/nextSunday/index.js +// node_modules/date-fns/nextSunday.js var require_nextSunday = __commonJS({ - "node_modules/date-fns/nextSunday/index.js"(exports2, module2) { + "node_modules/date-fns/nextSunday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = nextSunday; - var _index = _interopRequireDefault(require_nextDay()); - var _index2 = _interopRequireDefault(require_requiredArgs()); + exports2.nextSunday = nextSunday; + var _index = require_nextDay(); function nextSunday(date) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(date, 0); + return (0, _index.nextDay)(date, 0); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/nextThursday/index.js +// node_modules/date-fns/nextThursday.js var require_nextThursday = __commonJS({ - "node_modules/date-fns/nextThursday/index.js"(exports2, module2) { + "node_modules/date-fns/nextThursday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = nextThursday; - var _index = _interopRequireDefault(require_nextDay()); - var _index2 = _interopRequireDefault(require_requiredArgs()); + exports2.nextThursday = nextThursday; + var _index = require_nextDay(); function nextThursday(date) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(date, 4); + return (0, _index.nextDay)(date, 4); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/nextTuesday/index.js +// node_modules/date-fns/nextTuesday.js var require_nextTuesday = __commonJS({ - "node_modules/date-fns/nextTuesday/index.js"(exports2, module2) { + "node_modules/date-fns/nextTuesday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = nextTuesday; - var _index = _interopRequireDefault(require_nextDay()); - var _index2 = _interopRequireDefault(require_requiredArgs()); + exports2.nextTuesday = nextTuesday; + var _index = require_nextDay(); function nextTuesday(date) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(date, 2); + return (0, _index.nextDay)(date, 2); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/nextWednesday/index.js +// node_modules/date-fns/nextWednesday.js var require_nextWednesday = __commonJS({ - "node_modules/date-fns/nextWednesday/index.js"(exports2, module2) { + "node_modules/date-fns/nextWednesday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = nextWednesday; - var _index = _interopRequireDefault(require_nextDay()); - var _index2 = _interopRequireDefault(require_requiredArgs()); + exports2.nextWednesday = nextWednesday; + var _index = require_nextDay(); function nextWednesday(date) { - (0, _index2.default)(1, arguments); - return (0, _index.default)(date, 3); + return (0, _index.nextDay)(date, 3); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/parseISO/index.js +// node_modules/date-fns/parseISO.js var require_parseISO = __commonJS({ - "node_modules/date-fns/parseISO/index.js"(exports2, module2) { + "node_modules/date-fns/parseISO.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = parseISO; + exports2.parseISO = parseISO; var _index = require_constants(); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); function parseISO(argument, options) { - var _options$additionalDi; - (0, _index2.default)(1, arguments); - var additionalDigits = (0, _index3.default)((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2); - if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) { - throw new RangeError("additionalDigits must be 0, 1 or 2"); - } - if (!(typeof argument === "string" || Object.prototype.toString.call(argument) === "[object String]")) { - return /* @__PURE__ */ new Date(NaN); - } - var dateStrings = splitDateString(argument); - var date; + const additionalDigits = options?.additionalDigits ?? 2; + const dateStrings = splitDateString(argument); + let date; if (dateStrings.date) { - var parseYearResult = parseYear(dateStrings.date, additionalDigits); + const parseYearResult = parseYear(dateStrings.date, additionalDigits); date = parseDate(parseYearResult.restDateString, parseYearResult.year); } if (!date || isNaN(date.getTime())) { return /* @__PURE__ */ new Date(NaN); } - var timestamp = date.getTime(); - var time = 0; - var offset; + const timestamp = date.getTime(); + let time = 0; + let offset; if (dateStrings.time) { time = parseTime(dateStrings.time); if (isNaN(time)) { @@ -12974,10 +10057,19 @@ var require_parseISO = __commonJS({ return /* @__PURE__ */ new Date(NaN); } } else { - var dirtyDate = new Date(timestamp + time); - var result = /* @__PURE__ */ new Date(0); - result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate()); - result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds()); + const dirtyDate = new Date(timestamp + time); + const result = /* @__PURE__ */ new Date(0); + result.setFullYear( + dirtyDate.getUTCFullYear(), + dirtyDate.getUTCMonth(), + dirtyDate.getUTCDate() + ); + result.setHours( + dirtyDate.getUTCHours(), + dirtyDate.getUTCMinutes(), + dirtyDate.getUTCSeconds(), + dirtyDate.getUTCMilliseconds() + ); return result; } return new Date(timestamp + time + offset); @@ -12991,9 +10083,9 @@ var require_parseISO = __commonJS({ var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; function splitDateString(dateString) { - var dateStrings = {}; - var array = dateString.split(patterns.dateTimeDelimiter); - var timeString; + const dateStrings = {}; + const array = dateString.split(patterns.dateTimeDelimiter); + let timeString; if (array.length > 2) { return dateStrings; } @@ -13004,11 +10096,14 @@ var require_parseISO = __commonJS({ timeString = array[1]; if (patterns.timeZoneDelimiter.test(dateStrings.date)) { dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; - timeString = dateString.substr(dateStrings.date.length, dateString.length); + timeString = dateString.substr( + dateStrings.date.length, + dateString.length + ); } } if (timeString) { - var token = patterns.timezone.exec(timeString); + const token = patterns.timezone.exec(timeString); if (token) { dateStrings.time = timeString.replace(token[1], ""); dateStrings.timezone = token[1]; @@ -13019,15 +10114,14 @@ var require_parseISO = __commonJS({ return dateStrings; } function parseYear(dateString, additionalDigits) { - var regex = new RegExp("^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"); - var captures = dateString.match(regex); + const regex = new RegExp( + "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)" + ); + const captures = dateString.match(regex); if (!captures) - return { - year: NaN, - restDateString: "" - }; - var year = captures[1] ? parseInt(captures[1]) : null; - var century = captures[2] ? parseInt(captures[2]) : null; + return { year: NaN, restDateString: "" }; + const year = captures[1] ? parseInt(captures[1]) : null; + const century = captures[2] ? parseInt(captures[2]) : null; return { year: century === null ? year : century * 100, restDateString: dateString.slice((captures[1] || captures[2]).length) @@ -13036,22 +10130,22 @@ var require_parseISO = __commonJS({ function parseDate(dateString, year) { if (year === null) return /* @__PURE__ */ new Date(NaN); - var captures = dateString.match(dateRegex); + const captures = dateString.match(dateRegex); if (!captures) return /* @__PURE__ */ new Date(NaN); - var isWeekDate = !!captures[4]; - var dayOfYear = parseDateUnit(captures[1]); - var month = parseDateUnit(captures[2]) - 1; - var day = parseDateUnit(captures[3]); - var week = parseDateUnit(captures[4]); - var dayOfWeek = parseDateUnit(captures[5]) - 1; + const isWeekDate = !!captures[4]; + const dayOfYear = parseDateUnit(captures[1]); + const month = parseDateUnit(captures[2]) - 1; + const day = parseDateUnit(captures[3]); + const week = parseDateUnit(captures[4]); + const dayOfWeek = parseDateUnit(captures[5]) - 1; if (isWeekDate) { if (!validateWeekDate(year, week, dayOfWeek)) { return /* @__PURE__ */ new Date(NaN); } return dayOfISOWeekYear(year, week, dayOfWeek); } else { - var date = /* @__PURE__ */ new Date(0); + const date = /* @__PURE__ */ new Date(0); if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) { return /* @__PURE__ */ new Date(NaN); } @@ -13063,12 +10157,12 @@ var require_parseISO = __commonJS({ return value ? parseInt(value) : 1; } function parseTime(timeString) { - var captures = timeString.match(timeRegex); + const captures = timeString.match(timeRegex); if (!captures) return NaN; - var hours = parseTimeUnit(captures[1]); - var minutes = parseTimeUnit(captures[2]); - var seconds = parseTimeUnit(captures[3]); + const hours = parseTimeUnit(captures[1]); + const minutes = parseTimeUnit(captures[2]); + const seconds = parseTimeUnit(captures[3]); if (!validateTime(hours, minutes, seconds)) { return NaN; } @@ -13080,22 +10174,22 @@ var require_parseISO = __commonJS({ function parseTimezone(timezoneString) { if (timezoneString === "Z") return 0; - var captures = timezoneString.match(timezoneRegex); + const captures = timezoneString.match(timezoneRegex); if (!captures) return 0; - var sign = captures[1] === "+" ? -1 : 1; - var hours = parseInt(captures[2]); - var minutes = captures[3] && parseInt(captures[3]) || 0; + const sign = captures[1] === "+" ? -1 : 1; + const hours = parseInt(captures[2]); + const minutes = captures[3] && parseInt(captures[3]) || 0; if (!validateTimezone(hours, minutes)) { return NaN; } return sign * (hours * _index.millisecondsInHour + minutes * _index.millisecondsInMinute); } function dayOfISOWeekYear(isoWeekYear, week, day) { - var date = /* @__PURE__ */ new Date(0); + const date = /* @__PURE__ */ new Date(0); date.setUTCFullYear(isoWeekYear, 0, 4); - var fourthOfJanuaryDay = date.getUTCDay() || 7; - var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; + const fourthOfJanuaryDay = date.getUTCDay() || 7; + const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; date.setUTCDate(date.getUTCDate() + diff); return date; } @@ -13121,1120 +10215,741 @@ var require_parseISO = __commonJS({ function validateTimezone(_hours, minutes) { return minutes >= 0 && minutes <= 59; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/parseJSON/index.js +// node_modules/date-fns/parseJSON.js var require_parseJSON = __commonJS({ - "node_modules/date-fns/parseJSON/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = parseJSON; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function parseJSON(argument) { - (0, _index2.default)(1, arguments); - if (typeof argument === "string") { - var parts = argument.match(/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/); - if (parts) { - return new Date(Date.UTC(+parts[1], +parts[2] - 1, +parts[3], +parts[4] - (+parts[9] || 0) * (parts[8] == "-" ? -1 : 1), +parts[5] - (+parts[10] || 0) * (parts[8] == "-" ? -1 : 1), +parts[6], +((parts[7] || "0") + "00").substring(0, 3))); - } - return /* @__PURE__ */ new Date(NaN); + "node_modules/date-fns/parseJSON.js"(exports2) { + "use strict"; + exports2.parseJSON = parseJSON; + function parseJSON(dateStr) { + const parts = dateStr.match( + /(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/ + ); + if (parts) { + return new Date( + Date.UTC( + +parts[1], + +parts[2] - 1, + +parts[3], + +parts[4] - (+parts[9] || 0) * (parts[8] == "-" ? -1 : 1), + +parts[5] - (+parts[10] || 0) * (parts[8] == "-" ? -1 : 1), + +parts[6], + +((parts[7] || "0") + "00").substring(0, 3) + ) + ); } - return (0, _index.default)(argument); + return /* @__PURE__ */ new Date(NaN); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/previousDay/index.js +// node_modules/date-fns/previousDay.js var require_previousDay = __commonJS({ - "node_modules/date-fns/previousDay/index.js"(exports2, module2) { + "node_modules/date-fns/previousDay.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = previousDay; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = _interopRequireDefault(require_getDay()); - var _index3 = _interopRequireDefault(require_subDays()); + exports2.previousDay = previousDay; + var _index = require_getDay(); + var _index2 = require_subDays(); function previousDay(date, day) { - (0, _index.default)(2, arguments); - var delta = (0, _index2.default)(date) - day; + let delta = (0, _index.getDay)(date) - day; if (delta <= 0) delta += 7; - return (0, _index3.default)(date, delta); + return (0, _index2.subDays)(date, delta); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/previousFriday/index.js +// node_modules/date-fns/previousFriday.js var require_previousFriday = __commonJS({ - "node_modules/date-fns/previousFriday/index.js"(exports2, module2) { + "node_modules/date-fns/previousFriday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = previousFriday; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = _interopRequireDefault(require_previousDay()); + exports2.previousFriday = previousFriday; + var _index = require_previousDay(); function previousFriday(date) { - (0, _index.default)(1, arguments); - return (0, _index2.default)(date, 5); + return (0, _index.previousDay)(date, 5); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/previousMonday/index.js +// node_modules/date-fns/previousMonday.js var require_previousMonday = __commonJS({ - "node_modules/date-fns/previousMonday/index.js"(exports2, module2) { + "node_modules/date-fns/previousMonday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = previousMonday; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = _interopRequireDefault(require_previousDay()); + exports2.previousMonday = previousMonday; + var _index = require_previousDay(); function previousMonday(date) { - (0, _index.default)(1, arguments); - return (0, _index2.default)(date, 1); + return (0, _index.previousDay)(date, 1); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/previousSaturday/index.js +// node_modules/date-fns/previousSaturday.js var require_previousSaturday = __commonJS({ - "node_modules/date-fns/previousSaturday/index.js"(exports2, module2) { + "node_modules/date-fns/previousSaturday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = previousSaturday; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = _interopRequireDefault(require_previousDay()); + exports2.previousSaturday = previousSaturday; + var _index = require_previousDay(); function previousSaturday(date) { - (0, _index.default)(1, arguments); - return (0, _index2.default)(date, 6); + return (0, _index.previousDay)(date, 6); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/previousSunday/index.js +// node_modules/date-fns/previousSunday.js var require_previousSunday = __commonJS({ - "node_modules/date-fns/previousSunday/index.js"(exports2, module2) { + "node_modules/date-fns/previousSunday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = previousSunday; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = _interopRequireDefault(require_previousDay()); + exports2.previousSunday = previousSunday; + var _index = require_previousDay(); function previousSunday(date) { - (0, _index.default)(1, arguments); - return (0, _index2.default)(date, 0); + return (0, _index.previousDay)(date, 0); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/previousThursday/index.js +// node_modules/date-fns/previousThursday.js var require_previousThursday = __commonJS({ - "node_modules/date-fns/previousThursday/index.js"(exports2, module2) { + "node_modules/date-fns/previousThursday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = previousThursday; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = _interopRequireDefault(require_previousDay()); + exports2.previousThursday = previousThursday; + var _index = require_previousDay(); function previousThursday(date) { - (0, _index.default)(1, arguments); - return (0, _index2.default)(date, 4); + return (0, _index.previousDay)(date, 4); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/previousTuesday/index.js +// node_modules/date-fns/previousTuesday.js var require_previousTuesday = __commonJS({ - "node_modules/date-fns/previousTuesday/index.js"(exports2, module2) { + "node_modules/date-fns/previousTuesday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = previousTuesday; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = _interopRequireDefault(require_previousDay()); + exports2.previousTuesday = previousTuesday; + var _index = require_previousDay(); function previousTuesday(date) { - (0, _index.default)(1, arguments); - return (0, _index2.default)(date, 2); + return (0, _index.previousDay)(date, 2); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/previousWednesday/index.js +// node_modules/date-fns/previousWednesday.js var require_previousWednesday = __commonJS({ - "node_modules/date-fns/previousWednesday/index.js"(exports2, module2) { + "node_modules/date-fns/previousWednesday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = previousWednesday; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = _interopRequireDefault(require_previousDay()); + exports2.previousWednesday = previousWednesday; + var _index = require_previousDay(); function previousWednesday(date) { - (0, _index.default)(1, arguments); - return (0, _index2.default)(date, 3); + return (0, _index.previousDay)(date, 3); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/quartersToMonths/index.js +// node_modules/date-fns/quartersToMonths.js var require_quartersToMonths = __commonJS({ - "node_modules/date-fns/quartersToMonths/index.js"(exports2, module2) { + "node_modules/date-fns/quartersToMonths.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = quartersToMonths; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.quartersToMonths = quartersToMonths; + var _index = require_constants(); function quartersToMonths(quarters) { - (0, _index.default)(1, arguments); - return Math.floor(quarters * _index2.monthsInQuarter); + return Math.trunc(quarters * _index.monthsInQuarter); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/quartersToYears/index.js +// node_modules/date-fns/quartersToYears.js var require_quartersToYears = __commonJS({ - "node_modules/date-fns/quartersToYears/index.js"(exports2, module2) { + "node_modules/date-fns/quartersToYears.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = quartersToYears; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.quartersToYears = quartersToYears; + var _index = require_constants(); function quartersToYears(quarters) { - (0, _index.default)(1, arguments); - var years = quarters / _index2.quartersInYear; - return Math.floor(years); + const years = quarters / _index.quartersInYear; + return Math.trunc(years); + } + } +}); + +// node_modules/date-fns/roundToNearestHours.js +var require_roundToNearestHours = __commonJS({ + "node_modules/date-fns/roundToNearestHours.js"(exports2) { + "use strict"; + exports2.roundToNearestHours = roundToNearestHours; + var _index = require_getRoundingMethod(); + var _index2 = require_constructFrom(); + var _index3 = require_toDate(); + function roundToNearestHours(date, options) { + const nearestTo = options?.nearestTo ?? 1; + if (nearestTo < 1 || nearestTo > 12) + return (0, _index2.constructFrom)(date, NaN); + const _date = (0, _index3.toDate)(date); + const fractionalMinutes = _date.getMinutes() / 60; + const fractionalSeconds = _date.getSeconds() / 60 / 60; + const fractionalMilliseconds = _date.getMilliseconds() / 1e3 / 60 / 60; + const hours = _date.getHours() + fractionalMinutes + fractionalSeconds + fractionalMilliseconds; + const method = options?.roundingMethod ?? "round"; + const roundingMethod = (0, _index.getRoundingMethod)(method); + const roundedHours = roundingMethod(hours / nearestTo) * nearestTo; + const result = (0, _index2.constructFrom)(date, _date); + result.setHours(roundedHours, 0, 0, 0); + return result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/roundToNearestMinutes/index.js +// node_modules/date-fns/roundToNearestMinutes.js var require_roundToNearestMinutes = __commonJS({ - "node_modules/date-fns/roundToNearestMinutes/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = roundToNearestMinutes; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = require_roundingMethods(); - var _index3 = _interopRequireDefault(require_toInteger()); - function roundToNearestMinutes(dirtyDate, options) { - var _options$nearestTo; - if (arguments.length < 1) { - throw new TypeError("1 argument required, but only none provided present"); - } - var nearestTo = (0, _index3.default)((_options$nearestTo = options === null || options === void 0 ? void 0 : options.nearestTo) !== null && _options$nearestTo !== void 0 ? _options$nearestTo : 1); - if (nearestTo < 1 || nearestTo > 30) { - throw new RangeError("`options.nearestTo` must be between 1 and 30"); - } - var date = (0, _index.default)(dirtyDate); - var seconds = date.getSeconds(); - var minutes = date.getMinutes() + seconds / 60; - var roundingMethod = (0, _index2.getRoundingMethod)(options === null || options === void 0 ? void 0 : options.roundingMethod); - var roundedMinutes = roundingMethod(minutes / nearestTo) * nearestTo; - var remainderMinutes = minutes % nearestTo; - var addedMinutes = Math.round(remainderMinutes / nearestTo) * nearestTo; - return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), roundedMinutes + addedMinutes); + "node_modules/date-fns/roundToNearestMinutes.js"(exports2) { + "use strict"; + exports2.roundToNearestMinutes = roundToNearestMinutes; + var _index = require_getRoundingMethod(); + var _index2 = require_constructFrom(); + var _index3 = require_toDate(); + function roundToNearestMinutes(date, options) { + const nearestTo = options?.nearestTo ?? 1; + if (nearestTo < 1 || nearestTo > 30) + return (0, _index2.constructFrom)(date, NaN); + const _date = (0, _index3.toDate)(date); + const fractionalSeconds = _date.getSeconds() / 60; + const fractionalMilliseconds = _date.getMilliseconds() / 1e3 / 60; + const minutes = _date.getMinutes() + fractionalSeconds + fractionalMilliseconds; + const method = options?.roundingMethod ?? "round"; + const roundingMethod = (0, _index.getRoundingMethod)(method); + const roundedMinutes = roundingMethod(minutes / nearestTo) * nearestTo; + const result = (0, _index2.constructFrom)(date, _date); + result.setMinutes(roundedMinutes, 0, 0); + return result; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/secondsToHours/index.js +// node_modules/date-fns/secondsToHours.js var require_secondsToHours = __commonJS({ - "node_modules/date-fns/secondsToHours/index.js"(exports2, module2) { + "node_modules/date-fns/secondsToHours.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = secondsToHours; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.secondsToHours = secondsToHours; + var _index = require_constants(); function secondsToHours(seconds) { - (0, _index.default)(1, arguments); - var hours = seconds / _index2.secondsInHour; - return Math.floor(hours); + const hours = seconds / _index.secondsInHour; + return Math.trunc(hours); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/secondsToMilliseconds/index.js +// node_modules/date-fns/secondsToMilliseconds.js var require_secondsToMilliseconds = __commonJS({ - "node_modules/date-fns/secondsToMilliseconds/index.js"(exports2, module2) { + "node_modules/date-fns/secondsToMilliseconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = secondsToMilliseconds; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.secondsToMilliseconds = secondsToMilliseconds; + var _index = require_constants(); function secondsToMilliseconds(seconds) { - (0, _index.default)(1, arguments); - return seconds * _index2.millisecondsInSecond; + return seconds * _index.millisecondsInSecond; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/secondsToMinutes/index.js +// node_modules/date-fns/secondsToMinutes.js var require_secondsToMinutes = __commonJS({ - "node_modules/date-fns/secondsToMinutes/index.js"(exports2, module2) { + "node_modules/date-fns/secondsToMinutes.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = secondsToMinutes; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.secondsToMinutes = secondsToMinutes; + var _index = require_constants(); function secondsToMinutes(seconds) { - (0, _index.default)(1, arguments); - var minutes = seconds / _index2.secondsInMinute; - return Math.floor(minutes); + const minutes = seconds / _index.secondsInMinute; + return Math.trunc(minutes); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setMonth/index.js +// node_modules/date-fns/setMonth.js var require_setMonth = __commonJS({ - "node_modules/date-fns/setMonth/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setMonth; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_getDaysInMonth()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function setMonth(dirtyDate, dirtyMonth) { - (0, _index4.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var month = (0, _index.default)(dirtyMonth); - var year = date.getFullYear(); - var day = date.getDate(); - var dateWithDesiredMonth = /* @__PURE__ */ new Date(0); + "node_modules/date-fns/setMonth.js"(exports2) { + "use strict"; + exports2.setMonth = setMonth; + var _index = require_constructFrom(); + var _index2 = require_getDaysInMonth(); + var _index3 = require_toDate(); + function setMonth(date, month) { + const _date = (0, _index3.toDate)(date); + const year = _date.getFullYear(); + const day = _date.getDate(); + const dateWithDesiredMonth = (0, _index.constructFrom)(date, 0); dateWithDesiredMonth.setFullYear(year, month, 15); dateWithDesiredMonth.setHours(0, 0, 0, 0); - var daysInMonth = (0, _index3.default)(dateWithDesiredMonth); - date.setMonth(month, Math.min(day, daysInMonth)); - return date; + const daysInMonth = (0, _index2.getDaysInMonth)(dateWithDesiredMonth); + _date.setMonth(month, Math.min(day, daysInMonth)); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/set/index.js +// node_modules/date-fns/set.js var require_set = __commonJS({ - "node_modules/date-fns/set/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = set; - var _typeof2 = _interopRequireDefault(require_typeof()); - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_setMonth()); - var _index3 = _interopRequireDefault(require_toInteger()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function set(dirtyDate, values) { - (0, _index4.default)(2, arguments); - if ((0, _typeof2.default)(values) !== "object" || values === null) { - throw new RangeError("values parameter must be an object"); - } - var date = (0, _index.default)(dirtyDate); - if (isNaN(date.getTime())) { - return /* @__PURE__ */ new Date(NaN); + "node_modules/date-fns/set.js"(exports2) { + "use strict"; + exports2.set = set; + var _index = require_constructFrom(); + var _index2 = require_setMonth(); + var _index3 = require_toDate(); + function set(date, values) { + let _date = (0, _index3.toDate)(date); + if (isNaN(+_date)) { + return (0, _index.constructFrom)(date, NaN); } if (values.year != null) { - date.setFullYear(values.year); + _date.setFullYear(values.year); } if (values.month != null) { - date = (0, _index2.default)(date, values.month); + _date = (0, _index2.setMonth)(_date, values.month); } if (values.date != null) { - date.setDate((0, _index3.default)(values.date)); + _date.setDate(values.date); } if (values.hours != null) { - date.setHours((0, _index3.default)(values.hours)); + _date.setHours(values.hours); } if (values.minutes != null) { - date.setMinutes((0, _index3.default)(values.minutes)); + _date.setMinutes(values.minutes); } if (values.seconds != null) { - date.setSeconds((0, _index3.default)(values.seconds)); + _date.setSeconds(values.seconds); } if (values.milliseconds != null) { - date.setMilliseconds((0, _index3.default)(values.milliseconds)); + _date.setMilliseconds(values.milliseconds); } - return date; + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setDate/index.js +// node_modules/date-fns/setDate.js var require_setDate = __commonJS({ - "node_modules/date-fns/setDate/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setDate; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function setDate(dirtyDate, dirtyDayOfMonth) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var dayOfMonth = (0, _index.default)(dirtyDayOfMonth); - date.setDate(dayOfMonth); - return date; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/setDay/index.js -var require_setDay = __commonJS({ - "node_modules/date-fns/setDay/index.js"(exports2, module2) { + "node_modules/date-fns/setDate.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setDay; - var _index = _interopRequireDefault(require_addDays()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_toInteger()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - var _index5 = require_defaultOptions(); - function setDay(dirtyDate, dirtyDay, options) { - var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index4.default)(2, arguments); - var defaultOptions = (0, _index5.getDefaultOptions)(); - var weekStartsOn = (0, _index3.default)((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); - if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { - throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); - } - var date = (0, _index2.default)(dirtyDate); - var day = (0, _index3.default)(dirtyDay); - var currentDay = date.getDay(); - var remainder = day % 7; - var dayIndex = (remainder + 7) % 7; - var delta = 7 - weekStartsOn; - var diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7; - return (0, _index.default)(date, diff); + exports2.setDate = setDate; + var _index = require_toDate(); + function setDate(date, dayOfMonth) { + const _date = (0, _index.toDate)(date); + _date.setDate(dayOfMonth); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setDayOfYear/index.js +// node_modules/date-fns/setDayOfYear.js var require_setDayOfYear = __commonJS({ - "node_modules/date-fns/setDayOfYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setDayOfYear; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function setDayOfYear(dirtyDate, dirtyDayOfYear) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var dayOfYear = (0, _index.default)(dirtyDayOfYear); - date.setMonth(0); - date.setDate(dayOfYear); - return date; + "node_modules/date-fns/setDayOfYear.js"(exports2) { + "use strict"; + exports2.setDayOfYear = setDayOfYear; + var _index = require_toDate(); + function setDayOfYear(date, dayOfYear) { + const _date = (0, _index.toDate)(date); + _date.setMonth(0); + _date.setDate(dayOfYear); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setDefaultOptions/index.js +// node_modules/date-fns/setDefaultOptions.js var require_setDefaultOptions = __commonJS({ - "node_modules/date-fns/setDefaultOptions/index.js"(exports2, module2) { + "node_modules/date-fns/setDefaultOptions.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setDefaultOptions; + exports2.setDefaultOptions = setDefaultOptions; var _index = require_defaultOptions(); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function setDefaultOptions(newOptions) { - (0, _index2.default)(1, arguments); - var result = {}; - var defaultOptions = (0, _index.getDefaultOptions)(); - for (var property in defaultOptions) { + function setDefaultOptions(options) { + const result = {}; + const defaultOptions = (0, _index.getDefaultOptions)(); + for (const property in defaultOptions) { if (Object.prototype.hasOwnProperty.call(defaultOptions, property)) { - ; result[property] = defaultOptions[property]; } } - for (var _property in newOptions) { - if (Object.prototype.hasOwnProperty.call(newOptions, _property)) { - if (newOptions[_property] === void 0) { - delete result[_property]; + for (const property in options) { + if (Object.prototype.hasOwnProperty.call(options, property)) { + if (options[property] === void 0) { + delete result[property]; } else { - ; - result[_property] = newOptions[_property]; + result[property] = options[property]; } } } (0, _index.setDefaultOptions)(result); } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/setHours/index.js -var require_setHours = __commonJS({ - "node_modules/date-fns/setHours/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setHours; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function setHours(dirtyDate, dirtyHours) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var hours = (0, _index.default)(dirtyHours); - date.setHours(hours); - return date; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/setISODay/index.js -var require_setISODay = __commonJS({ - "node_modules/date-fns/setISODay/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setISODay; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_addDays()); - var _index4 = _interopRequireDefault(require_getISODay()); - var _index5 = _interopRequireDefault(require_requiredArgs()); - function setISODay(dirtyDate, dirtyDay) { - (0, _index5.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var day = (0, _index.default)(dirtyDay); - var currentDay = (0, _index4.default)(date); - var diff = day - currentDay; - return (0, _index3.default)(date, diff); - } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setISOWeek/index.js -var require_setISOWeek = __commonJS({ - "node_modules/date-fns/setISOWeek/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setISOWeek; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_getISOWeek()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function setISOWeek(dirtyDate, dirtyISOWeek) { - (0, _index4.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var isoWeek = (0, _index.default)(dirtyISOWeek); - var diff = (0, _index3.default)(date) - isoWeek; - date.setDate(date.getDate() - diff * 7); - return date; +// node_modules/date-fns/setHours.js +var require_setHours = __commonJS({ + "node_modules/date-fns/setHours.js"(exports2) { + "use strict"; + exports2.setHours = setHours; + var _index = require_toDate(); + function setHours(date, hours) { + const _date = (0, _index.toDate)(date); + _date.setHours(hours); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setMilliseconds/index.js +// node_modules/date-fns/setMilliseconds.js var require_setMilliseconds = __commonJS({ - "node_modules/date-fns/setMilliseconds/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setMilliseconds; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function setMilliseconds(dirtyDate, dirtyMilliseconds) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var milliseconds = (0, _index.default)(dirtyMilliseconds); - date.setMilliseconds(milliseconds); - return date; + "node_modules/date-fns/setMilliseconds.js"(exports2) { + "use strict"; + exports2.setMilliseconds = setMilliseconds; + var _index = require_toDate(); + function setMilliseconds(date, milliseconds) { + const _date = (0, _index.toDate)(date); + _date.setMilliseconds(milliseconds); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setMinutes/index.js +// node_modules/date-fns/setMinutes.js var require_setMinutes = __commonJS({ - "node_modules/date-fns/setMinutes/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setMinutes; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function setMinutes(dirtyDate, dirtyMinutes) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var minutes = (0, _index.default)(dirtyMinutes); - date.setMinutes(minutes); - return date; + "node_modules/date-fns/setMinutes.js"(exports2) { + "use strict"; + exports2.setMinutes = setMinutes; + var _index = require_toDate(); + function setMinutes(date, minutes) { + const _date = (0, _index.toDate)(date); + _date.setMinutes(minutes); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setQuarter/index.js +// node_modules/date-fns/setQuarter.js var require_setQuarter = __commonJS({ - "node_modules/date-fns/setQuarter/index.js"(exports2, module2) { + "node_modules/date-fns/setQuarter.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setQuarter; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_setMonth()); - var _index4 = _interopRequireDefault(require_requiredArgs()); - function setQuarter(dirtyDate, dirtyQuarter) { - (0, _index4.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var quarter = (0, _index.default)(dirtyQuarter); - var oldQuarter = Math.floor(date.getMonth() / 3) + 1; - var diff = quarter - oldQuarter; - return (0, _index3.default)(date, date.getMonth() + diff * 3); + exports2.setQuarter = setQuarter; + var _index = require_setMonth(); + var _index2 = require_toDate(); + function setQuarter(date, quarter) { + const _date = (0, _index2.toDate)(date); + const oldQuarter = Math.trunc(_date.getMonth() / 3) + 1; + const diff = quarter - oldQuarter; + return (0, _index.setMonth)(_date, _date.getMonth() + diff * 3); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setSeconds/index.js +// node_modules/date-fns/setSeconds.js var require_setSeconds = __commonJS({ - "node_modules/date-fns/setSeconds/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setSeconds; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function setSeconds(dirtyDate, dirtySeconds) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var seconds = (0, _index.default)(dirtySeconds); - date.setSeconds(seconds); - return date; - } - module2.exports = exports2.default; - } -}); - -// node_modules/date-fns/setWeek/index.js -var require_setWeek = __commonJS({ - "node_modules/date-fns/setWeek/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setWeek; - var _index = _interopRequireDefault(require_getWeek()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var _index4 = _interopRequireDefault(require_toInteger()); - function setWeek(dirtyDate, dirtyWeek, options) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var week = (0, _index4.default)(dirtyWeek); - var diff = (0, _index.default)(date, options) - week; - date.setDate(date.getDate() - diff * 7); - return date; + "node_modules/date-fns/setSeconds.js"(exports2) { + "use strict"; + exports2.setSeconds = setSeconds; + var _index = require_toDate(); + function setSeconds(date, seconds) { + const _date = (0, _index.toDate)(date); + _date.setSeconds(seconds); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setWeekYear/index.js +// node_modules/date-fns/setWeekYear.js var require_setWeekYear = __commonJS({ - "node_modules/date-fns/setWeekYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setWeekYear; - var _index = _interopRequireDefault(require_differenceInCalendarDays()); - var _index2 = _interopRequireDefault(require_startOfWeekYear()); - var _index3 = _interopRequireDefault(require_toDate()); - var _index4 = _interopRequireDefault(require_toInteger()); - var _index5 = _interopRequireDefault(require_requiredArgs()); - var _index6 = require_defaultOptions(); - function setWeekYear(dirtyDate, dirtyWeekYear, options) { - var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; - (0, _index5.default)(2, arguments); - var defaultOptions = (0, _index6.getDefaultOptions)(); - var firstWeekContainsDate = (0, _index4.default)((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); - var date = (0, _index3.default)(dirtyDate); - var weekYear = (0, _index4.default)(dirtyWeekYear); - var diff = (0, _index.default)(date, (0, _index2.default)(date, options)); - var firstWeek = /* @__PURE__ */ new Date(0); + "node_modules/date-fns/setWeekYear.js"(exports2) { + "use strict"; + exports2.setWeekYear = setWeekYear; + var _index = require_constructFrom(); + var _index2 = require_differenceInCalendarDays(); + var _index3 = require_startOfWeekYear(); + var _index4 = require_toDate(); + var _index5 = require_defaultOptions(); + function setWeekYear(date, weekYear, options) { + const defaultOptions = (0, _index5.getDefaultOptions)(); + const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1; + let _date = (0, _index4.toDate)(date); + const diff = (0, _index2.differenceInCalendarDays)( + _date, + (0, _index3.startOfWeekYear)(_date, options) + ); + const firstWeek = (0, _index.constructFrom)(date, 0); firstWeek.setFullYear(weekYear, 0, firstWeekContainsDate); firstWeek.setHours(0, 0, 0, 0); - date = (0, _index2.default)(firstWeek, options); - date.setDate(date.getDate() + diff); - return date; + _date = (0, _index3.startOfWeekYear)(firstWeek, options); + _date.setDate(_date.getDate() + diff); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/setYear/index.js +// node_modules/date-fns/setYear.js var require_setYear = __commonJS({ - "node_modules/date-fns/setYear/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = setYear; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_toDate()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function setYear(dirtyDate, dirtyYear) { - (0, _index3.default)(2, arguments); - var date = (0, _index2.default)(dirtyDate); - var year = (0, _index.default)(dirtyYear); - if (isNaN(date.getTime())) { - return /* @__PURE__ */ new Date(NaN); + "node_modules/date-fns/setYear.js"(exports2) { + "use strict"; + exports2.setYear = setYear; + var _index = require_constructFrom(); + var _index2 = require_toDate(); + function setYear(date, year) { + const _date = (0, _index2.toDate)(date); + if (isNaN(+_date)) { + return (0, _index.constructFrom)(date, NaN); } - date.setFullYear(year); - return date; + _date.setFullYear(year); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfDecade/index.js +// node_modules/date-fns/startOfDecade.js var require_startOfDecade = __commonJS({ - "node_modules/date-fns/startOfDecade/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfDecade; - var _index = _interopRequireDefault(require_toDate()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - function startOfDecade(dirtyDate) { - (0, _index2.default)(1, arguments); - var date = (0, _index.default)(dirtyDate); - var year = date.getFullYear(); - var decade = Math.floor(year / 10) * 10; - date.setFullYear(decade, 0, 1); - date.setHours(0, 0, 0, 0); - return date; + "node_modules/date-fns/startOfDecade.js"(exports2) { + "use strict"; + exports2.startOfDecade = startOfDecade; + var _index = require_toDate(); + function startOfDecade(date) { + const _date = (0, _index.toDate)(date); + const year = _date.getFullYear(); + const decade = Math.floor(year / 10) * 10; + _date.setFullYear(decade, 0, 1); + _date.setHours(0, 0, 0, 0); + return _date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfToday/index.js +// node_modules/date-fns/startOfToday.js var require_startOfToday = __commonJS({ - "node_modules/date-fns/startOfToday/index.js"(exports2, module2) { + "node_modules/date-fns/startOfToday.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfToday; - var _index = _interopRequireDefault(require_startOfDay()); + exports2.startOfToday = startOfToday; + var _index = require_startOfDay(); function startOfToday() { - return (0, _index.default)(Date.now()); + return (0, _index.startOfDay)(Date.now()); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfTomorrow/index.js +// node_modules/date-fns/startOfTomorrow.js var require_startOfTomorrow = __commonJS({ - "node_modules/date-fns/startOfTomorrow/index.js"(exports2, module2) { + "node_modules/date-fns/startOfTomorrow.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfTomorrow; + exports2.startOfTomorrow = startOfTomorrow; function startOfTomorrow() { - var now = /* @__PURE__ */ new Date(); - var year = now.getFullYear(); - var month = now.getMonth(); - var day = now.getDate(); - var date = /* @__PURE__ */ new Date(0); + const now = /* @__PURE__ */ new Date(); + const year = now.getFullYear(); + const month = now.getMonth(); + const day = now.getDate(); + const date = /* @__PURE__ */ new Date(0); date.setFullYear(year, month, day + 1); date.setHours(0, 0, 0, 0); return date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfYesterday/index.js +// node_modules/date-fns/startOfYesterday.js var require_startOfYesterday = __commonJS({ - "node_modules/date-fns/startOfYesterday/index.js"(exports2, module2) { + "node_modules/date-fns/startOfYesterday.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = startOfYesterday; + exports2.startOfYesterday = startOfYesterday; function startOfYesterday() { - var now = /* @__PURE__ */ new Date(); - var year = now.getFullYear(); - var month = now.getMonth(); - var day = now.getDate(); - var date = /* @__PURE__ */ new Date(0); + const now = /* @__PURE__ */ new Date(); + const year = now.getFullYear(); + const month = now.getMonth(); + const day = now.getDate(); + const date = /* @__PURE__ */ new Date(0); date.setFullYear(year, month, day - 1); date.setHours(0, 0, 0, 0); return date; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subMonths/index.js +// node_modules/date-fns/subMonths.js var require_subMonths = __commonJS({ - "node_modules/date-fns/subMonths/index.js"(exports2, module2) { + "node_modules/date-fns/subMonths.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subMonths; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addMonths()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function subMonths(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index2.default)(dirtyDate, -amount); + exports2.subMonths = subMonths; + var _index = require_addMonths(); + function subMonths(date, amount) { + return (0, _index.addMonths)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/sub/index.js +// node_modules/date-fns/sub.js var require_sub = __commonJS({ - "node_modules/date-fns/sub/index.js"(exports2, module2) { - "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = sub; - var _typeof2 = _interopRequireDefault(require_typeof()); - var _index = _interopRequireDefault(require_subDays()); - var _index2 = _interopRequireDefault(require_subMonths()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - var _index4 = _interopRequireDefault(require_toInteger()); + "node_modules/date-fns/sub.js"(exports2) { + "use strict"; + exports2.sub = sub; + var _index = require_subDays(); + var _index2 = require_subMonths(); + var _index3 = require_constructFrom(); function sub(date, duration) { - (0, _index3.default)(2, arguments); - if (!duration || (0, _typeof2.default)(duration) !== "object") - return /* @__PURE__ */ new Date(NaN); - var years = duration.years ? (0, _index4.default)(duration.years) : 0; - var months = duration.months ? (0, _index4.default)(duration.months) : 0; - var weeks = duration.weeks ? (0, _index4.default)(duration.weeks) : 0; - var days = duration.days ? (0, _index4.default)(duration.days) : 0; - var hours = duration.hours ? (0, _index4.default)(duration.hours) : 0; - var minutes = duration.minutes ? (0, _index4.default)(duration.minutes) : 0; - var seconds = duration.seconds ? (0, _index4.default)(duration.seconds) : 0; - var dateWithoutMonths = (0, _index2.default)(date, months + years * 12); - var dateWithoutDays = (0, _index.default)(dateWithoutMonths, days + weeks * 7); - var minutestoSub = minutes + hours * 60; - var secondstoSub = seconds + minutestoSub * 60; - var mstoSub = secondstoSub * 1e3; - var finalDate = new Date(dateWithoutDays.getTime() - mstoSub); + const { + years = 0, + months = 0, + weeks = 0, + days = 0, + hours = 0, + minutes = 0, + seconds = 0 + } = duration; + const dateWithoutMonths = (0, _index2.subMonths)(date, months + years * 12); + const dateWithoutDays = (0, _index.subDays)( + dateWithoutMonths, + days + weeks * 7 + ); + const minutestoSub = minutes + hours * 60; + const secondstoSub = seconds + minutestoSub * 60; + const mstoSub = secondstoSub * 1e3; + const finalDate = (0, _index3.constructFrom)( + date, + dateWithoutDays.getTime() - mstoSub + ); return finalDate; } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subBusinessDays/index.js +// node_modules/date-fns/subBusinessDays.js var require_subBusinessDays = __commonJS({ - "node_modules/date-fns/subBusinessDays/index.js"(exports2, module2) { + "node_modules/date-fns/subBusinessDays.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subBusinessDays; - var _index = _interopRequireDefault(require_addBusinessDays()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); - function subBusinessDays(dirtyDate, dirtyAmount) { - (0, _index2.default)(2, arguments); - var amount = (0, _index3.default)(dirtyAmount); - return (0, _index.default)(dirtyDate, -amount); + exports2.subBusinessDays = subBusinessDays; + var _index = require_addBusinessDays(); + function subBusinessDays(date, amount) { + return (0, _index.addBusinessDays)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subHours/index.js +// node_modules/date-fns/subHours.js var require_subHours = __commonJS({ - "node_modules/date-fns/subHours/index.js"(exports2, module2) { + "node_modules/date-fns/subHours.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subHours; - var _index = _interopRequireDefault(require_addHours()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); - function subHours(dirtyDate, dirtyAmount) { - (0, _index2.default)(2, arguments); - var amount = (0, _index3.default)(dirtyAmount); - return (0, _index.default)(dirtyDate, -amount); + exports2.subHours = subHours; + var _index = require_addHours(); + function subHours(date, amount) { + return (0, _index.addHours)(date, -amount); + } + } +}); + +// node_modules/date-fns/subMilliseconds.js +var require_subMilliseconds = __commonJS({ + "node_modules/date-fns/subMilliseconds.js"(exports2) { + "use strict"; + exports2.subMilliseconds = subMilliseconds; + var _index = require_addMilliseconds(); + function subMilliseconds(date, amount) { + return (0, _index.addMilliseconds)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subMinutes/index.js +// node_modules/date-fns/subMinutes.js var require_subMinutes = __commonJS({ - "node_modules/date-fns/subMinutes/index.js"(exports2, module2) { + "node_modules/date-fns/subMinutes.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subMinutes; - var _index = _interopRequireDefault(require_addMinutes()); - var _index2 = _interopRequireDefault(require_requiredArgs()); - var _index3 = _interopRequireDefault(require_toInteger()); - function subMinutes(dirtyDate, dirtyAmount) { - (0, _index2.default)(2, arguments); - var amount = (0, _index3.default)(dirtyAmount); - return (0, _index.default)(dirtyDate, -amount); + exports2.subMinutes = subMinutes; + var _index = require_addMinutes(); + function subMinutes(date, amount) { + return (0, _index.addMinutes)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subQuarters/index.js +// node_modules/date-fns/subQuarters.js var require_subQuarters = __commonJS({ - "node_modules/date-fns/subQuarters/index.js"(exports2, module2) { + "node_modules/date-fns/subQuarters.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subQuarters; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addQuarters()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function subQuarters(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index2.default)(dirtyDate, -amount); + exports2.subQuarters = subQuarters; + var _index = require_addQuarters(); + function subQuarters(date, amount) { + return (0, _index.addQuarters)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subSeconds/index.js +// node_modules/date-fns/subSeconds.js var require_subSeconds = __commonJS({ - "node_modules/date-fns/subSeconds/index.js"(exports2, module2) { + "node_modules/date-fns/subSeconds.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subSeconds; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addSeconds()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function subSeconds(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index2.default)(dirtyDate, -amount); + exports2.subSeconds = subSeconds; + var _index = require_addSeconds(); + function subSeconds(date, amount) { + return (0, _index.addSeconds)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subWeeks/index.js +// node_modules/date-fns/subWeeks.js var require_subWeeks = __commonJS({ - "node_modules/date-fns/subWeeks/index.js"(exports2, module2) { + "node_modules/date-fns/subWeeks.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subWeeks; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addWeeks()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function subWeeks(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index2.default)(dirtyDate, -amount); + exports2.subWeeks = subWeeks; + var _index = require_addWeeks(); + function subWeeks(date, amount) { + return (0, _index.addWeeks)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/subYears/index.js +// node_modules/date-fns/subYears.js var require_subYears = __commonJS({ - "node_modules/date-fns/subYears/index.js"(exports2, module2) { + "node_modules/date-fns/subYears.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = subYears; - var _index = _interopRequireDefault(require_toInteger()); - var _index2 = _interopRequireDefault(require_addYears()); - var _index3 = _interopRequireDefault(require_requiredArgs()); - function subYears(dirtyDate, dirtyAmount) { - (0, _index3.default)(2, arguments); - var amount = (0, _index.default)(dirtyAmount); - return (0, _index2.default)(dirtyDate, -amount); + exports2.subYears = subYears; + var _index = require_addYears(); + function subYears(date, amount) { + return (0, _index.addYears)(date, -amount); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/weeksToDays/index.js +// node_modules/date-fns/weeksToDays.js var require_weeksToDays = __commonJS({ - "node_modules/date-fns/weeksToDays/index.js"(exports2, module2) { + "node_modules/date-fns/weeksToDays.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = weeksToDays; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.weeksToDays = weeksToDays; + var _index = require_constants(); function weeksToDays(weeks) { - (0, _index.default)(1, arguments); - return Math.floor(weeks * _index2.daysInWeek); + return Math.trunc(weeks * _index.daysInWeek); + } + } +}); + +// node_modules/date-fns/yearsToDays.js +var require_yearsToDays = __commonJS({ + "node_modules/date-fns/yearsToDays.js"(exports2) { + "use strict"; + exports2.yearsToDays = yearsToDays; + var _index = require_constants(); + function yearsToDays(years) { + return Math.trunc(years * _index.daysInYear); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/yearsToMonths/index.js +// node_modules/date-fns/yearsToMonths.js var require_yearsToMonths = __commonJS({ - "node_modules/date-fns/yearsToMonths/index.js"(exports2, module2) { + "node_modules/date-fns/yearsToMonths.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = yearsToMonths; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.yearsToMonths = yearsToMonths; + var _index = require_constants(); function yearsToMonths(years) { - (0, _index.default)(1, arguments); - return Math.floor(years * _index2.monthsInYear); + return Math.trunc(years * _index.monthsInYear); } - module2.exports = exports2.default; } }); -// node_modules/date-fns/yearsToQuarters/index.js +// node_modules/date-fns/yearsToQuarters.js var require_yearsToQuarters = __commonJS({ - "node_modules/date-fns/yearsToQuarters/index.js"(exports2, module2) { + "node_modules/date-fns/yearsToQuarters.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - exports2.default = yearsToQuarters; - var _index = _interopRequireDefault(require_requiredArgs()); - var _index2 = require_constants(); + exports2.yearsToQuarters = yearsToQuarters; + var _index = require_constants(); function yearsToQuarters(years) { - (0, _index.default)(1, arguments); - return Math.floor(years * _index2.quartersInYear); + return Math.trunc(years * _index.quartersInYear); } - module2.exports = exports2.default; } }); @@ -14242,1936 +10957,3188 @@ var require_yearsToQuarters = __commonJS({ var require_date_fns = __commonJS({ "node_modules/date-fns/index.js"(exports2) { "use strict"; - var _interopRequireDefault = require_interopRequireDefault().default; - Object.defineProperty(exports2, "__esModule", { - value: true - }); - var _exportNames = { - add: true, - addBusinessDays: true, - addDays: true, - addHours: true, - addISOWeekYears: true, - addMilliseconds: true, - addMinutes: true, - addMonths: true, - addQuarters: true, - addSeconds: true, - addWeeks: true, - addYears: true, - areIntervalsOverlapping: true, - clamp: true, - closestIndexTo: true, - closestTo: true, - compareAsc: true, - compareDesc: true, - daysToWeeks: true, - differenceInBusinessDays: true, - differenceInCalendarDays: true, - differenceInCalendarISOWeekYears: true, - differenceInCalendarISOWeeks: true, - differenceInCalendarMonths: true, - differenceInCalendarQuarters: true, - differenceInCalendarWeeks: true, - differenceInCalendarYears: true, - differenceInDays: true, - differenceInHours: true, - differenceInISOWeekYears: true, - differenceInMilliseconds: true, - differenceInMinutes: true, - differenceInMonths: true, - differenceInQuarters: true, - differenceInSeconds: true, - differenceInWeeks: true, - differenceInYears: true, - eachDayOfInterval: true, - eachHourOfInterval: true, - eachMinuteOfInterval: true, - eachMonthOfInterval: true, - eachQuarterOfInterval: true, - eachWeekOfInterval: true, - eachWeekendOfInterval: true, - eachWeekendOfMonth: true, - eachWeekendOfYear: true, - eachYearOfInterval: true, - endOfDay: true, - endOfDecade: true, - endOfHour: true, - endOfISOWeek: true, - endOfISOWeekYear: true, - endOfMinute: true, - endOfMonth: true, - endOfQuarter: true, - endOfSecond: true, - endOfToday: true, - endOfTomorrow: true, - endOfWeek: true, - endOfYear: true, - endOfYesterday: true, - format: true, - formatDistance: true, - formatDistanceStrict: true, - formatDistanceToNow: true, - formatDistanceToNowStrict: true, - formatDuration: true, - formatISO: true, - formatISO9075: true, - formatISODuration: true, - formatRFC3339: true, - formatRFC7231: true, - formatRelative: true, - fromUnixTime: true, - getDate: true, - getDay: true, - getDayOfYear: true, - getDaysInMonth: true, - getDaysInYear: true, - getDecade: true, - getDefaultOptions: true, - getHours: true, - getISODay: true, - getISOWeek: true, - getISOWeekYear: true, - getISOWeeksInYear: true, - getMilliseconds: true, - getMinutes: true, - getMonth: true, - getOverlappingDaysInIntervals: true, - getQuarter: true, - getSeconds: true, - getTime: true, - getUnixTime: true, - getWeek: true, - getWeekOfMonth: true, - getWeekYear: true, - getWeeksInMonth: true, - getYear: true, - hoursToMilliseconds: true, - hoursToMinutes: true, - hoursToSeconds: true, - intervalToDuration: true, - intlFormat: true, - intlFormatDistance: true, - isAfter: true, - isBefore: true, - isDate: true, - isEqual: true, - isExists: true, - isFirstDayOfMonth: true, - isFriday: true, - isFuture: true, - isLastDayOfMonth: true, - isLeapYear: true, - isMatch: true, - isMonday: true, - isPast: true, - isSameDay: true, - isSameHour: true, - isSameISOWeek: true, - isSameISOWeekYear: true, - isSameMinute: true, - isSameMonth: true, - isSameQuarter: true, - isSameSecond: true, - isSameWeek: true, - isSameYear: true, - isSaturday: true, - isSunday: true, - isThisHour: true, - isThisISOWeek: true, - isThisMinute: true, - isThisMonth: true, - isThisQuarter: true, - isThisSecond: true, - isThisWeek: true, - isThisYear: true, - isThursday: true, - isToday: true, - isTomorrow: true, - isTuesday: true, - isValid: true, - isWednesday: true, - isWeekend: true, - isWithinInterval: true, - isYesterday: true, - lastDayOfDecade: true, - lastDayOfISOWeek: true, - lastDayOfISOWeekYear: true, - lastDayOfMonth: true, - lastDayOfQuarter: true, - lastDayOfWeek: true, - lastDayOfYear: true, - lightFormat: true, - max: true, - milliseconds: true, - millisecondsToHours: true, - millisecondsToMinutes: true, - millisecondsToSeconds: true, - min: true, - minutesToHours: true, - minutesToMilliseconds: true, - minutesToSeconds: true, - monthsToQuarters: true, - monthsToYears: true, - nextDay: true, - nextFriday: true, - nextMonday: true, - nextSaturday: true, - nextSunday: true, - nextThursday: true, - nextTuesday: true, - nextWednesday: true, - parse: true, - parseISO: true, - parseJSON: true, - previousDay: true, - previousFriday: true, - previousMonday: true, - previousSaturday: true, - previousSunday: true, - previousThursday: true, - previousTuesday: true, - previousWednesday: true, - quartersToMonths: true, - quartersToYears: true, - roundToNearestMinutes: true, - secondsToHours: true, - secondsToMilliseconds: true, - secondsToMinutes: true, - set: true, - setDate: true, - setDay: true, - setDayOfYear: true, - setDefaultOptions: true, - setHours: true, - setISODay: true, - setISOWeek: true, - setISOWeekYear: true, - setMilliseconds: true, - setMinutes: true, - setMonth: true, - setQuarter: true, - setSeconds: true, - setWeek: true, - setWeekYear: true, - setYear: true, - startOfDay: true, - startOfDecade: true, - startOfHour: true, - startOfISOWeek: true, - startOfISOWeekYear: true, - startOfMinute: true, - startOfMonth: true, - startOfQuarter: true, - startOfSecond: true, - startOfToday: true, - startOfTomorrow: true, - startOfWeek: true, - startOfWeekYear: true, - startOfYear: true, - startOfYesterday: true, - sub: true, - subBusinessDays: true, - subDays: true, - subHours: true, - subISOWeekYears: true, - subMilliseconds: true, - subMinutes: true, - subMonths: true, - subQuarters: true, - subSeconds: true, - subWeeks: true, - subYears: true, - toDate: true, - weeksToDays: true, - yearsToMonths: true, - yearsToQuarters: true - }; - Object.defineProperty(exports2, "add", { - enumerable: true, - get: function get() { - return _index.default; - } + var _index = require_add(); + Object.keys(_index).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index[key]; + } + }); }); - Object.defineProperty(exports2, "addBusinessDays", { - enumerable: true, - get: function get() { - return _index2.default; - } + var _index2 = require_addBusinessDays(); + Object.keys(_index2).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index2[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index2[key]; + } + }); }); - Object.defineProperty(exports2, "addDays", { - enumerable: true, - get: function get() { - return _index3.default; - } + var _index3 = require_addDays(); + Object.keys(_index3).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index3[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index3[key]; + } + }); }); - Object.defineProperty(exports2, "addHours", { - enumerable: true, - get: function get() { - return _index4.default; - } + var _index4 = require_addHours(); + Object.keys(_index4).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index4[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index4[key]; + } + }); }); - Object.defineProperty(exports2, "addISOWeekYears", { - enumerable: true, - get: function get() { - return _index5.default; - } + var _index5 = require_addISOWeekYears(); + Object.keys(_index5).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index5[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index5[key]; + } + }); }); - Object.defineProperty(exports2, "addMilliseconds", { - enumerable: true, - get: function get() { - return _index6.default; - } + var _index6 = require_addMilliseconds(); + Object.keys(_index6).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index6[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index6[key]; + } + }); }); - Object.defineProperty(exports2, "addMinutes", { - enumerable: true, - get: function get() { - return _index7.default; - } + var _index7 = require_addMinutes(); + Object.keys(_index7).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index7[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index7[key]; + } + }); }); - Object.defineProperty(exports2, "addMonths", { - enumerable: true, - get: function get() { - return _index8.default; - } + var _index8 = require_addMonths(); + Object.keys(_index8).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index8[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index8[key]; + } + }); }); - Object.defineProperty(exports2, "addQuarters", { - enumerable: true, - get: function get() { - return _index9.default; - } + var _index9 = require_addQuarters(); + Object.keys(_index9).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index9[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index9[key]; + } + }); }); - Object.defineProperty(exports2, "addSeconds", { - enumerable: true, - get: function get() { - return _index10.default; - } + var _index10 = require_addSeconds(); + Object.keys(_index10).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index10[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index10[key]; + } + }); }); - Object.defineProperty(exports2, "addWeeks", { - enumerable: true, - get: function get() { - return _index11.default; - } + var _index11 = require_addWeeks(); + Object.keys(_index11).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index11[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index11[key]; + } + }); }); - Object.defineProperty(exports2, "addYears", { - enumerable: true, - get: function get() { - return _index12.default; - } + var _index12 = require_addYears(); + Object.keys(_index12).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index12[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index12[key]; + } + }); }); - Object.defineProperty(exports2, "areIntervalsOverlapping", { - enumerable: true, - get: function get() { - return _index13.default; - } + var _index13 = require_areIntervalsOverlapping(); + Object.keys(_index13).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index13[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index13[key]; + } + }); }); - Object.defineProperty(exports2, "clamp", { - enumerable: true, - get: function get() { - return _index14.default; - } + var _index14 = require_clamp(); + Object.keys(_index14).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index14[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index14[key]; + } + }); }); - Object.defineProperty(exports2, "closestIndexTo", { - enumerable: true, - get: function get() { - return _index15.default; - } + var _index15 = require_closestIndexTo(); + Object.keys(_index15).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index15[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index15[key]; + } + }); + }); + var _index16 = require_closestTo(); + Object.keys(_index16).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index16[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index16[key]; + } + }); + }); + var _index17 = require_compareAsc(); + Object.keys(_index17).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index17[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index17[key]; + } + }); + }); + var _index18 = require_compareDesc(); + Object.keys(_index18).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index18[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index18[key]; + } + }); + }); + var _index19 = require_constructFrom(); + Object.keys(_index19).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index19[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index19[key]; + } + }); + }); + var _index20 = require_constructNow(); + Object.keys(_index20).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index20[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index20[key]; + } + }); }); - Object.defineProperty(exports2, "closestTo", { - enumerable: true, - get: function get() { - return _index16.default; - } + var _index21 = require_daysToWeeks(); + Object.keys(_index21).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index21[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index21[key]; + } + }); }); - Object.defineProperty(exports2, "compareAsc", { - enumerable: true, - get: function get() { - return _index17.default; - } + var _index22 = require_differenceInBusinessDays(); + Object.keys(_index22).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index22[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index22[key]; + } + }); }); - Object.defineProperty(exports2, "compareDesc", { - enumerable: true, - get: function get() { - return _index18.default; - } + var _index23 = require_differenceInCalendarDays(); + Object.keys(_index23).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index23[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index23[key]; + } + }); }); - Object.defineProperty(exports2, "daysToWeeks", { - enumerable: true, - get: function get() { - return _index19.default; - } + var _index24 = require_differenceInCalendarISOWeekYears(); + Object.keys(_index24).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index24[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index24[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInBusinessDays", { - enumerable: true, - get: function get() { - return _index20.default; - } + var _index25 = require_differenceInCalendarISOWeeks(); + Object.keys(_index25).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index25[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index25[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInCalendarDays", { - enumerable: true, - get: function get() { - return _index21.default; - } + var _index26 = require_differenceInCalendarMonths(); + Object.keys(_index26).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index26[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index26[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInCalendarISOWeekYears", { - enumerable: true, - get: function get() { - return _index22.default; - } + var _index27 = require_differenceInCalendarQuarters(); + Object.keys(_index27).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index27[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index27[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInCalendarISOWeeks", { - enumerable: true, - get: function get() { - return _index23.default; - } + var _index28 = require_differenceInCalendarWeeks(); + Object.keys(_index28).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index28[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index28[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInCalendarMonths", { - enumerable: true, - get: function get() { - return _index24.default; - } + var _index29 = require_differenceInCalendarYears(); + Object.keys(_index29).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index29[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index29[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInCalendarQuarters", { - enumerable: true, - get: function get() { - return _index25.default; - } + var _index30 = require_differenceInDays(); + Object.keys(_index30).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index30[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index30[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInCalendarWeeks", { - enumerable: true, - get: function get() { - return _index26.default; - } + var _index31 = require_differenceInHours(); + Object.keys(_index31).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index31[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index31[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInCalendarYears", { - enumerable: true, - get: function get() { - return _index27.default; - } + var _index32 = require_differenceInISOWeekYears(); + Object.keys(_index32).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index32[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index32[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInDays", { - enumerable: true, - get: function get() { - return _index28.default; - } + var _index33 = require_differenceInMilliseconds(); + Object.keys(_index33).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index33[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index33[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInHours", { - enumerable: true, - get: function get() { - return _index29.default; - } + var _index34 = require_differenceInMinutes(); + Object.keys(_index34).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index34[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index34[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInISOWeekYears", { - enumerable: true, - get: function get() { - return _index30.default; - } + var _index35 = require_differenceInMonths(); + Object.keys(_index35).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index35[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index35[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInMilliseconds", { - enumerable: true, - get: function get() { - return _index31.default; - } + var _index36 = require_differenceInQuarters(); + Object.keys(_index36).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index36[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index36[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInMinutes", { - enumerable: true, - get: function get() { - return _index32.default; - } + var _index37 = require_differenceInSeconds(); + Object.keys(_index37).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index37[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index37[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInMonths", { - enumerable: true, - get: function get() { - return _index33.default; - } + var _index38 = require_differenceInWeeks(); + Object.keys(_index38).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index38[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index38[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInQuarters", { - enumerable: true, - get: function get() { - return _index34.default; - } + var _index39 = require_differenceInYears(); + Object.keys(_index39).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index39[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index39[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInSeconds", { - enumerable: true, - get: function get() { - return _index35.default; - } + var _index40 = require_eachDayOfInterval(); + Object.keys(_index40).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index40[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index40[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInWeeks", { - enumerable: true, - get: function get() { - return _index36.default; - } + var _index41 = require_eachHourOfInterval(); + Object.keys(_index41).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index41[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index41[key]; + } + }); }); - Object.defineProperty(exports2, "differenceInYears", { - enumerable: true, - get: function get() { - return _index37.default; - } + var _index42 = require_eachMinuteOfInterval(); + Object.keys(_index42).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index42[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index42[key]; + } + }); }); - Object.defineProperty(exports2, "eachDayOfInterval", { - enumerable: true, - get: function get() { - return _index38.default; - } + var _index43 = require_eachMonthOfInterval(); + Object.keys(_index43).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index43[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index43[key]; + } + }); }); - Object.defineProperty(exports2, "eachHourOfInterval", { - enumerable: true, - get: function get() { - return _index39.default; - } + var _index44 = require_eachQuarterOfInterval(); + Object.keys(_index44).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index44[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index44[key]; + } + }); }); - Object.defineProperty(exports2, "eachMinuteOfInterval", { - enumerable: true, - get: function get() { - return _index40.default; - } + var _index45 = require_eachWeekOfInterval(); + Object.keys(_index45).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index45[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index45[key]; + } + }); }); - Object.defineProperty(exports2, "eachMonthOfInterval", { - enumerable: true, - get: function get() { - return _index41.default; - } + var _index46 = require_eachWeekendOfInterval(); + Object.keys(_index46).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index46[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index46[key]; + } + }); }); - Object.defineProperty(exports2, "eachQuarterOfInterval", { - enumerable: true, - get: function get() { - return _index42.default; - } + var _index47 = require_eachWeekendOfMonth(); + Object.keys(_index47).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index47[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index47[key]; + } + }); }); - Object.defineProperty(exports2, "eachWeekOfInterval", { - enumerable: true, - get: function get() { - return _index43.default; - } + var _index48 = require_eachWeekendOfYear(); + Object.keys(_index48).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index48[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index48[key]; + } + }); }); - Object.defineProperty(exports2, "eachWeekendOfInterval", { - enumerable: true, - get: function get() { - return _index44.default; - } + var _index49 = require_eachYearOfInterval(); + Object.keys(_index49).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index49[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index49[key]; + } + }); }); - Object.defineProperty(exports2, "eachWeekendOfMonth", { - enumerable: true, - get: function get() { - return _index45.default; - } + var _index50 = require_endOfDay(); + Object.keys(_index50).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index50[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index50[key]; + } + }); }); - Object.defineProperty(exports2, "eachWeekendOfYear", { - enumerable: true, - get: function get() { - return _index46.default; - } + var _index51 = require_endOfDecade(); + Object.keys(_index51).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index51[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index51[key]; + } + }); }); - Object.defineProperty(exports2, "eachYearOfInterval", { - enumerable: true, - get: function get() { - return _index47.default; - } + var _index52 = require_endOfHour(); + Object.keys(_index52).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index52[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index52[key]; + } + }); }); - Object.defineProperty(exports2, "endOfDay", { - enumerable: true, - get: function get() { - return _index48.default; - } + var _index53 = require_endOfISOWeek(); + Object.keys(_index53).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index53[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index53[key]; + } + }); }); - Object.defineProperty(exports2, "endOfDecade", { - enumerable: true, - get: function get() { - return _index49.default; - } + var _index54 = require_endOfISOWeekYear(); + Object.keys(_index54).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index54[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index54[key]; + } + }); }); - Object.defineProperty(exports2, "endOfHour", { - enumerable: true, - get: function get() { - return _index50.default; - } + var _index55 = require_endOfMinute(); + Object.keys(_index55).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index55[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index55[key]; + } + }); }); - Object.defineProperty(exports2, "endOfISOWeek", { - enumerable: true, - get: function get() { - return _index51.default; - } + var _index56 = require_endOfMonth(); + Object.keys(_index56).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index56[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index56[key]; + } + }); }); - Object.defineProperty(exports2, "endOfISOWeekYear", { - enumerable: true, - get: function get() { - return _index52.default; - } + var _index57 = require_endOfQuarter(); + Object.keys(_index57).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index57[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index57[key]; + } + }); }); - Object.defineProperty(exports2, "endOfMinute", { - enumerable: true, - get: function get() { - return _index53.default; - } + var _index58 = require_endOfSecond(); + Object.keys(_index58).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index58[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index58[key]; + } + }); }); - Object.defineProperty(exports2, "endOfMonth", { - enumerable: true, - get: function get() { - return _index54.default; - } + var _index59 = require_endOfToday(); + Object.keys(_index59).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index59[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index59[key]; + } + }); }); - Object.defineProperty(exports2, "endOfQuarter", { - enumerable: true, - get: function get() { - return _index55.default; - } + var _index60 = require_endOfTomorrow(); + Object.keys(_index60).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index60[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index60[key]; + } + }); }); - Object.defineProperty(exports2, "endOfSecond", { - enumerable: true, - get: function get() { - return _index56.default; - } + var _index61 = require_endOfWeek(); + Object.keys(_index61).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index61[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index61[key]; + } + }); }); - Object.defineProperty(exports2, "endOfToday", { - enumerable: true, - get: function get() { - return _index57.default; - } + var _index62 = require_endOfYear(); + Object.keys(_index62).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index62[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index62[key]; + } + }); }); - Object.defineProperty(exports2, "endOfTomorrow", { - enumerable: true, - get: function get() { - return _index58.default; - } + var _index63 = require_endOfYesterday(); + Object.keys(_index63).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index63[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index63[key]; + } + }); }); - Object.defineProperty(exports2, "endOfWeek", { - enumerable: true, - get: function get() { - return _index59.default; - } + var _index64 = require_format(); + Object.keys(_index64).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index64[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index64[key]; + } + }); }); - Object.defineProperty(exports2, "endOfYear", { - enumerable: true, - get: function get() { - return _index60.default; - } + var _index65 = require_formatDistance2(); + Object.keys(_index65).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index65[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index65[key]; + } + }); }); - Object.defineProperty(exports2, "endOfYesterday", { - enumerable: true, - get: function get() { - return _index61.default; - } + var _index66 = require_formatDistanceStrict(); + Object.keys(_index66).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index66[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index66[key]; + } + }); }); - Object.defineProperty(exports2, "format", { - enumerable: true, - get: function get() { - return _index62.default; - } + var _index67 = require_formatDistanceToNow(); + Object.keys(_index67).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index67[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index67[key]; + } + }); }); - Object.defineProperty(exports2, "formatDistance", { - enumerable: true, - get: function get() { - return _index63.default; - } + var _index68 = require_formatDistanceToNowStrict(); + Object.keys(_index68).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index68[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index68[key]; + } + }); }); - Object.defineProperty(exports2, "formatDistanceStrict", { - enumerable: true, - get: function get() { - return _index64.default; - } + var _index69 = require_formatDuration(); + Object.keys(_index69).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index69[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index69[key]; + } + }); }); - Object.defineProperty(exports2, "formatDistanceToNow", { - enumerable: true, - get: function get() { - return _index65.default; - } + var _index70 = require_formatISO(); + Object.keys(_index70).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index70[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index70[key]; + } + }); }); - Object.defineProperty(exports2, "formatDistanceToNowStrict", { - enumerable: true, - get: function get() { - return _index66.default; - } + var _index71 = require_formatISO9075(); + Object.keys(_index71).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index71[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index71[key]; + } + }); }); - Object.defineProperty(exports2, "formatDuration", { - enumerable: true, - get: function get() { - return _index67.default; - } + var _index72 = require_formatISODuration(); + Object.keys(_index72).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index72[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index72[key]; + } + }); }); - Object.defineProperty(exports2, "formatISO", { - enumerable: true, - get: function get() { - return _index68.default; - } + var _index73 = require_formatRFC3339(); + Object.keys(_index73).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index73[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index73[key]; + } + }); }); - Object.defineProperty(exports2, "formatISO9075", { - enumerable: true, - get: function get() { - return _index69.default; - } + var _index74 = require_formatRFC7231(); + Object.keys(_index74).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index74[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index74[key]; + } + }); }); - Object.defineProperty(exports2, "formatISODuration", { - enumerable: true, - get: function get() { - return _index70.default; - } + var _index75 = require_formatRelative2(); + Object.keys(_index75).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index75[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index75[key]; + } + }); }); - Object.defineProperty(exports2, "formatRFC3339", { - enumerable: true, - get: function get() { - return _index71.default; - } + var _index76 = require_fromUnixTime(); + Object.keys(_index76).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index76[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index76[key]; + } + }); }); - Object.defineProperty(exports2, "formatRFC7231", { - enumerable: true, - get: function get() { - return _index72.default; - } + var _index77 = require_getDate(); + Object.keys(_index77).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index77[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index77[key]; + } + }); }); - Object.defineProperty(exports2, "formatRelative", { - enumerable: true, - get: function get() { - return _index73.default; - } + var _index78 = require_getDay(); + Object.keys(_index78).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index78[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index78[key]; + } + }); }); - Object.defineProperty(exports2, "fromUnixTime", { - enumerable: true, - get: function get() { - return _index74.default; - } + var _index79 = require_getDayOfYear(); + Object.keys(_index79).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index79[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index79[key]; + } + }); }); - Object.defineProperty(exports2, "getDate", { - enumerable: true, - get: function get() { - return _index75.default; - } + var _index80 = require_getDaysInMonth(); + Object.keys(_index80).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index80[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index80[key]; + } + }); }); - Object.defineProperty(exports2, "getDay", { - enumerable: true, - get: function get() { - return _index76.default; - } + var _index81 = require_getDaysInYear(); + Object.keys(_index81).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index81[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index81[key]; + } + }); }); - Object.defineProperty(exports2, "getDayOfYear", { - enumerable: true, - get: function get() { - return _index77.default; - } + var _index82 = require_getDecade(); + Object.keys(_index82).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index82[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index82[key]; + } + }); }); - Object.defineProperty(exports2, "getDaysInMonth", { - enumerable: true, - get: function get() { - return _index78.default; - } + var _index83 = require_getDefaultOptions(); + Object.keys(_index83).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index83[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index83[key]; + } + }); }); - Object.defineProperty(exports2, "getDaysInYear", { - enumerable: true, - get: function get() { - return _index79.default; - } + var _index84 = require_getHours(); + Object.keys(_index84).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index84[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index84[key]; + } + }); }); - Object.defineProperty(exports2, "getDecade", { - enumerable: true, - get: function get() { - return _index80.default; - } + var _index85 = require_getISODay(); + Object.keys(_index85).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index85[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index85[key]; + } + }); }); - Object.defineProperty(exports2, "getDefaultOptions", { - enumerable: true, - get: function get() { - return _index81.default; - } + var _index86 = require_getISOWeek(); + Object.keys(_index86).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index86[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index86[key]; + } + }); }); - Object.defineProperty(exports2, "getHours", { - enumerable: true, - get: function get() { - return _index82.default; - } + var _index87 = require_getISOWeekYear(); + Object.keys(_index87).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index87[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index87[key]; + } + }); }); - Object.defineProperty(exports2, "getISODay", { - enumerable: true, - get: function get() { - return _index83.default; - } + var _index88 = require_getISOWeeksInYear(); + Object.keys(_index88).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index88[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index88[key]; + } + }); }); - Object.defineProperty(exports2, "getISOWeek", { - enumerable: true, - get: function get() { - return _index84.default; - } + var _index89 = require_getMilliseconds(); + Object.keys(_index89).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index89[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index89[key]; + } + }); }); - Object.defineProperty(exports2, "getISOWeekYear", { - enumerable: true, - get: function get() { - return _index85.default; - } + var _index90 = require_getMinutes(); + Object.keys(_index90).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index90[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index90[key]; + } + }); }); - Object.defineProperty(exports2, "getISOWeeksInYear", { - enumerable: true, - get: function get() { - return _index86.default; - } + var _index91 = require_getMonth(); + Object.keys(_index91).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index91[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index91[key]; + } + }); }); - Object.defineProperty(exports2, "getMilliseconds", { - enumerable: true, - get: function get() { - return _index87.default; - } + var _index92 = require_getOverlappingDaysInIntervals(); + Object.keys(_index92).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index92[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index92[key]; + } + }); }); - Object.defineProperty(exports2, "getMinutes", { - enumerable: true, - get: function get() { - return _index88.default; - } + var _index93 = require_getQuarter(); + Object.keys(_index93).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index93[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index93[key]; + } + }); }); - Object.defineProperty(exports2, "getMonth", { - enumerable: true, - get: function get() { - return _index89.default; - } + var _index94 = require_getSeconds(); + Object.keys(_index94).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index94[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index94[key]; + } + }); }); - Object.defineProperty(exports2, "getOverlappingDaysInIntervals", { - enumerable: true, - get: function get() { - return _index90.default; - } + var _index95 = require_getTime(); + Object.keys(_index95).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index95[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index95[key]; + } + }); }); - Object.defineProperty(exports2, "getQuarter", { - enumerable: true, - get: function get() { - return _index91.default; - } + var _index96 = require_getUnixTime(); + Object.keys(_index96).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index96[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index96[key]; + } + }); }); - Object.defineProperty(exports2, "getSeconds", { - enumerable: true, - get: function get() { - return _index92.default; - } + var _index97 = require_getWeek(); + Object.keys(_index97).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index97[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index97[key]; + } + }); }); - Object.defineProperty(exports2, "getTime", { - enumerable: true, - get: function get() { - return _index93.default; - } + var _index98 = require_getWeekOfMonth(); + Object.keys(_index98).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index98[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index98[key]; + } + }); }); - Object.defineProperty(exports2, "getUnixTime", { - enumerable: true, - get: function get() { - return _index94.default; - } + var _index99 = require_getWeekYear(); + Object.keys(_index99).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index99[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index99[key]; + } + }); }); - Object.defineProperty(exports2, "getWeek", { - enumerable: true, - get: function get() { - return _index95.default; - } + var _index100 = require_getWeeksInMonth(); + Object.keys(_index100).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index100[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index100[key]; + } + }); }); - Object.defineProperty(exports2, "getWeekOfMonth", { - enumerable: true, - get: function get() { - return _index96.default; - } + var _index101 = require_getYear(); + Object.keys(_index101).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index101[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index101[key]; + } + }); }); - Object.defineProperty(exports2, "getWeekYear", { - enumerable: true, - get: function get() { - return _index97.default; - } + var _index102 = require_hoursToMilliseconds(); + Object.keys(_index102).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index102[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index102[key]; + } + }); }); - Object.defineProperty(exports2, "getWeeksInMonth", { - enumerable: true, - get: function get() { - return _index98.default; - } + var _index103 = require_hoursToMinutes(); + Object.keys(_index103).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index103[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index103[key]; + } + }); }); - Object.defineProperty(exports2, "getYear", { - enumerable: true, - get: function get() { - return _index99.default; - } + var _index104 = require_hoursToSeconds(); + Object.keys(_index104).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index104[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index104[key]; + } + }); }); - Object.defineProperty(exports2, "hoursToMilliseconds", { - enumerable: true, - get: function get() { - return _index100.default; - } + var _index105 = require_interval(); + Object.keys(_index105).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index105[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index105[key]; + } + }); }); - Object.defineProperty(exports2, "hoursToMinutes", { - enumerable: true, - get: function get() { - return _index101.default; - } + var _index106 = require_intervalToDuration(); + Object.keys(_index106).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index106[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index106[key]; + } + }); }); - Object.defineProperty(exports2, "hoursToSeconds", { - enumerable: true, - get: function get() { - return _index102.default; - } + var _index107 = require_intlFormat(); + Object.keys(_index107).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index107[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index107[key]; + } + }); }); - Object.defineProperty(exports2, "intervalToDuration", { - enumerable: true, - get: function get() { - return _index103.default; - } + var _index108 = require_intlFormatDistance(); + Object.keys(_index108).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index108[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index108[key]; + } + }); }); - Object.defineProperty(exports2, "intlFormat", { - enumerable: true, - get: function get() { - return _index104.default; - } + var _index109 = require_isAfter(); + Object.keys(_index109).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index109[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index109[key]; + } + }); }); - Object.defineProperty(exports2, "intlFormatDistance", { - enumerable: true, - get: function get() { - return _index105.default; - } + var _index110 = require_isBefore(); + Object.keys(_index110).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index110[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index110[key]; + } + }); }); - Object.defineProperty(exports2, "isAfter", { - enumerable: true, - get: function get() { - return _index106.default; - } + var _index111 = require_isDate(); + Object.keys(_index111).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index111[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index111[key]; + } + }); }); - Object.defineProperty(exports2, "isBefore", { - enumerable: true, - get: function get() { - return _index107.default; - } + var _index112 = require_isEqual(); + Object.keys(_index112).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index112[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index112[key]; + } + }); }); - Object.defineProperty(exports2, "isDate", { - enumerable: true, - get: function get() { - return _index108.default; - } + var _index113 = require_isExists(); + Object.keys(_index113).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index113[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index113[key]; + } + }); }); - Object.defineProperty(exports2, "isEqual", { - enumerable: true, - get: function get() { - return _index109.default; - } + var _index114 = require_isFirstDayOfMonth(); + Object.keys(_index114).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index114[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index114[key]; + } + }); }); - Object.defineProperty(exports2, "isExists", { - enumerable: true, - get: function get() { - return _index110.default; - } + var _index115 = require_isFriday(); + Object.keys(_index115).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index115[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index115[key]; + } + }); }); - Object.defineProperty(exports2, "isFirstDayOfMonth", { - enumerable: true, - get: function get() { - return _index111.default; - } + var _index116 = require_isFuture(); + Object.keys(_index116).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index116[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index116[key]; + } + }); }); - Object.defineProperty(exports2, "isFriday", { - enumerable: true, - get: function get() { - return _index112.default; - } + var _index117 = require_isLastDayOfMonth(); + Object.keys(_index117).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index117[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index117[key]; + } + }); }); - Object.defineProperty(exports2, "isFuture", { - enumerable: true, - get: function get() { - return _index113.default; - } + var _index118 = require_isLeapYear(); + Object.keys(_index118).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index118[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index118[key]; + } + }); }); - Object.defineProperty(exports2, "isLastDayOfMonth", { - enumerable: true, - get: function get() { - return _index114.default; - } + var _index119 = require_isMatch(); + Object.keys(_index119).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index119[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index119[key]; + } + }); }); - Object.defineProperty(exports2, "isLeapYear", { - enumerable: true, - get: function get() { - return _index115.default; - } + var _index120 = require_isMonday(); + Object.keys(_index120).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index120[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index120[key]; + } + }); }); - Object.defineProperty(exports2, "isMatch", { - enumerable: true, - get: function get() { - return _index116.default; - } + var _index121 = require_isPast(); + Object.keys(_index121).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index121[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index121[key]; + } + }); }); - Object.defineProperty(exports2, "isMonday", { - enumerable: true, - get: function get() { - return _index117.default; - } + var _index122 = require_isSameDay(); + Object.keys(_index122).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index122[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index122[key]; + } + }); }); - Object.defineProperty(exports2, "isPast", { - enumerable: true, - get: function get() { - return _index118.default; - } + var _index123 = require_isSameHour(); + Object.keys(_index123).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index123[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index123[key]; + } + }); }); - Object.defineProperty(exports2, "isSameDay", { - enumerable: true, - get: function get() { - return _index119.default; - } + var _index124 = require_isSameISOWeek(); + Object.keys(_index124).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index124[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index124[key]; + } + }); }); - Object.defineProperty(exports2, "isSameHour", { - enumerable: true, - get: function get() { - return _index120.default; - } + var _index125 = require_isSameISOWeekYear(); + Object.keys(_index125).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index125[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index125[key]; + } + }); }); - Object.defineProperty(exports2, "isSameISOWeek", { - enumerable: true, - get: function get() { - return _index121.default; - } + var _index126 = require_isSameMinute(); + Object.keys(_index126).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index126[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index126[key]; + } + }); }); - Object.defineProperty(exports2, "isSameISOWeekYear", { - enumerable: true, - get: function get() { - return _index122.default; - } + var _index127 = require_isSameMonth(); + Object.keys(_index127).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index127[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index127[key]; + } + }); }); - Object.defineProperty(exports2, "isSameMinute", { - enumerable: true, - get: function get() { - return _index123.default; - } + var _index128 = require_isSameQuarter(); + Object.keys(_index128).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index128[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index128[key]; + } + }); }); - Object.defineProperty(exports2, "isSameMonth", { - enumerable: true, - get: function get() { - return _index124.default; - } + var _index129 = require_isSameSecond(); + Object.keys(_index129).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index129[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index129[key]; + } + }); }); - Object.defineProperty(exports2, "isSameQuarter", { - enumerable: true, - get: function get() { - return _index125.default; - } + var _index130 = require_isSameWeek(); + Object.keys(_index130).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index130[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index130[key]; + } + }); }); - Object.defineProperty(exports2, "isSameSecond", { - enumerable: true, - get: function get() { - return _index126.default; - } + var _index131 = require_isSameYear(); + Object.keys(_index131).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index131[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index131[key]; + } + }); }); - Object.defineProperty(exports2, "isSameWeek", { - enumerable: true, - get: function get() { - return _index127.default; - } + var _index132 = require_isSaturday(); + Object.keys(_index132).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index132[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index132[key]; + } + }); }); - Object.defineProperty(exports2, "isSameYear", { - enumerable: true, - get: function get() { - return _index128.default; - } + var _index133 = require_isSunday(); + Object.keys(_index133).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index133[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index133[key]; + } + }); }); - Object.defineProperty(exports2, "isSaturday", { - enumerable: true, - get: function get() { - return _index129.default; - } + var _index134 = require_isThisHour(); + Object.keys(_index134).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index134[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index134[key]; + } + }); }); - Object.defineProperty(exports2, "isSunday", { - enumerable: true, - get: function get() { - return _index130.default; - } + var _index135 = require_isThisISOWeek(); + Object.keys(_index135).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index135[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index135[key]; + } + }); }); - Object.defineProperty(exports2, "isThisHour", { - enumerable: true, - get: function get() { - return _index131.default; - } + var _index136 = require_isThisMinute(); + Object.keys(_index136).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index136[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index136[key]; + } + }); }); - Object.defineProperty(exports2, "isThisISOWeek", { - enumerable: true, - get: function get() { - return _index132.default; - } + var _index137 = require_isThisMonth(); + Object.keys(_index137).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index137[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index137[key]; + } + }); }); - Object.defineProperty(exports2, "isThisMinute", { - enumerable: true, - get: function get() { - return _index133.default; - } + var _index138 = require_isThisQuarter(); + Object.keys(_index138).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index138[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index138[key]; + } + }); }); - Object.defineProperty(exports2, "isThisMonth", { - enumerable: true, - get: function get() { - return _index134.default; - } + var _index139 = require_isThisSecond(); + Object.keys(_index139).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index139[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index139[key]; + } + }); }); - Object.defineProperty(exports2, "isThisQuarter", { - enumerable: true, - get: function get() { - return _index135.default; - } + var _index140 = require_isThisWeek(); + Object.keys(_index140).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index140[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index140[key]; + } + }); }); - Object.defineProperty(exports2, "isThisSecond", { - enumerable: true, - get: function get() { - return _index136.default; - } + var _index141 = require_isThisYear(); + Object.keys(_index141).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index141[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index141[key]; + } + }); }); - Object.defineProperty(exports2, "isThisWeek", { - enumerable: true, - get: function get() { - return _index137.default; - } + var _index142 = require_isThursday(); + Object.keys(_index142).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index142[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index142[key]; + } + }); }); - Object.defineProperty(exports2, "isThisYear", { - enumerable: true, - get: function get() { - return _index138.default; - } + var _index143 = require_isToday(); + Object.keys(_index143).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index143[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index143[key]; + } + }); }); - Object.defineProperty(exports2, "isThursday", { - enumerable: true, - get: function get() { - return _index139.default; - } + var _index144 = require_isTomorrow(); + Object.keys(_index144).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index144[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index144[key]; + } + }); }); - Object.defineProperty(exports2, "isToday", { - enumerable: true, - get: function get() { - return _index140.default; - } + var _index145 = require_isTuesday(); + Object.keys(_index145).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index145[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index145[key]; + } + }); }); - Object.defineProperty(exports2, "isTomorrow", { - enumerable: true, - get: function get() { - return _index141.default; - } + var _index146 = require_isValid(); + Object.keys(_index146).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index146[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index146[key]; + } + }); }); - Object.defineProperty(exports2, "isTuesday", { - enumerable: true, - get: function get() { - return _index142.default; - } + var _index147 = require_isWednesday(); + Object.keys(_index147).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index147[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index147[key]; + } + }); }); - Object.defineProperty(exports2, "isValid", { - enumerable: true, - get: function get() { - return _index143.default; - } + var _index148 = require_isWeekend(); + Object.keys(_index148).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index148[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index148[key]; + } + }); }); - Object.defineProperty(exports2, "isWednesday", { - enumerable: true, - get: function get() { - return _index144.default; - } + var _index149 = require_isWithinInterval(); + Object.keys(_index149).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index149[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index149[key]; + } + }); }); - Object.defineProperty(exports2, "isWeekend", { - enumerable: true, - get: function get() { - return _index145.default; - } + var _index150 = require_isYesterday(); + Object.keys(_index150).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index150[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index150[key]; + } + }); }); - Object.defineProperty(exports2, "isWithinInterval", { - enumerable: true, - get: function get() { - return _index146.default; - } + var _index151 = require_lastDayOfDecade(); + Object.keys(_index151).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index151[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index151[key]; + } + }); }); - Object.defineProperty(exports2, "isYesterday", { - enumerable: true, - get: function get() { - return _index147.default; - } + var _index152 = require_lastDayOfISOWeek(); + Object.keys(_index152).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index152[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index152[key]; + } + }); }); - Object.defineProperty(exports2, "lastDayOfDecade", { - enumerable: true, - get: function get() { - return _index148.default; - } + var _index153 = require_lastDayOfISOWeekYear(); + Object.keys(_index153).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index153[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index153[key]; + } + }); }); - Object.defineProperty(exports2, "lastDayOfISOWeek", { - enumerable: true, - get: function get() { - return _index149.default; - } + var _index154 = require_lastDayOfMonth(); + Object.keys(_index154).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index154[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index154[key]; + } + }); }); - Object.defineProperty(exports2, "lastDayOfISOWeekYear", { - enumerable: true, - get: function get() { - return _index150.default; - } + var _index155 = require_lastDayOfQuarter(); + Object.keys(_index155).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index155[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index155[key]; + } + }); }); - Object.defineProperty(exports2, "lastDayOfMonth", { - enumerable: true, - get: function get() { - return _index151.default; - } + var _index156 = require_lastDayOfWeek(); + Object.keys(_index156).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index156[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index156[key]; + } + }); }); - Object.defineProperty(exports2, "lastDayOfQuarter", { - enumerable: true, - get: function get() { - return _index152.default; - } + var _index157 = require_lastDayOfYear(); + Object.keys(_index157).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index157[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index157[key]; + } + }); }); - Object.defineProperty(exports2, "lastDayOfWeek", { - enumerable: true, - get: function get() { - return _index153.default; - } + var _index158 = require_lightFormat(); + Object.keys(_index158).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index158[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index158[key]; + } + }); }); - Object.defineProperty(exports2, "lastDayOfYear", { - enumerable: true, - get: function get() { - return _index154.default; - } + var _index159 = require_max(); + Object.keys(_index159).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index159[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index159[key]; + } + }); }); - Object.defineProperty(exports2, "lightFormat", { - enumerable: true, - get: function get() { - return _index155.default; - } + var _index160 = require_milliseconds(); + Object.keys(_index160).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index160[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index160[key]; + } + }); }); - Object.defineProperty(exports2, "max", { - enumerable: true, - get: function get() { - return _index156.default; - } + var _index161 = require_millisecondsToHours(); + Object.keys(_index161).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index161[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index161[key]; + } + }); }); - Object.defineProperty(exports2, "milliseconds", { - enumerable: true, - get: function get() { - return _index157.default; - } + var _index162 = require_millisecondsToMinutes(); + Object.keys(_index162).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index162[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index162[key]; + } + }); }); - Object.defineProperty(exports2, "millisecondsToHours", { - enumerable: true, - get: function get() { - return _index158.default; - } + var _index163 = require_millisecondsToSeconds(); + Object.keys(_index163).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index163[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index163[key]; + } + }); }); - Object.defineProperty(exports2, "millisecondsToMinutes", { - enumerable: true, - get: function get() { - return _index159.default; - } + var _index164 = require_min(); + Object.keys(_index164).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index164[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index164[key]; + } + }); }); - Object.defineProperty(exports2, "millisecondsToSeconds", { - enumerable: true, - get: function get() { - return _index160.default; - } + var _index165 = require_minutesToHours(); + Object.keys(_index165).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index165[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index165[key]; + } + }); }); - Object.defineProperty(exports2, "min", { - enumerable: true, - get: function get() { - return _index161.default; - } + var _index166 = require_minutesToMilliseconds(); + Object.keys(_index166).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index166[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index166[key]; + } + }); }); - Object.defineProperty(exports2, "minutesToHours", { - enumerable: true, - get: function get() { - return _index162.default; - } + var _index167 = require_minutesToSeconds(); + Object.keys(_index167).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index167[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index167[key]; + } + }); }); - Object.defineProperty(exports2, "minutesToMilliseconds", { - enumerable: true, - get: function get() { - return _index163.default; - } + var _index168 = require_monthsToQuarters(); + Object.keys(_index168).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index168[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index168[key]; + } + }); }); - Object.defineProperty(exports2, "minutesToSeconds", { - enumerable: true, - get: function get() { - return _index164.default; - } + var _index169 = require_monthsToYears(); + Object.keys(_index169).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index169[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index169[key]; + } + }); }); - Object.defineProperty(exports2, "monthsToQuarters", { - enumerable: true, - get: function get() { - return _index165.default; - } + var _index170 = require_nextDay(); + Object.keys(_index170).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index170[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index170[key]; + } + }); }); - Object.defineProperty(exports2, "monthsToYears", { - enumerable: true, - get: function get() { - return _index166.default; - } + var _index171 = require_nextFriday(); + Object.keys(_index171).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index171[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index171[key]; + } + }); }); - Object.defineProperty(exports2, "nextDay", { - enumerable: true, - get: function get() { - return _index167.default; - } + var _index172 = require_nextMonday(); + Object.keys(_index172).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index172[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index172[key]; + } + }); }); - Object.defineProperty(exports2, "nextFriday", { - enumerable: true, - get: function get() { - return _index168.default; - } + var _index173 = require_nextSaturday(); + Object.keys(_index173).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index173[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index173[key]; + } + }); }); - Object.defineProperty(exports2, "nextMonday", { - enumerable: true, - get: function get() { - return _index169.default; - } + var _index174 = require_nextSunday(); + Object.keys(_index174).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index174[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index174[key]; + } + }); }); - Object.defineProperty(exports2, "nextSaturday", { - enumerable: true, - get: function get() { - return _index170.default; - } + var _index175 = require_nextThursday(); + Object.keys(_index175).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index175[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index175[key]; + } + }); }); - Object.defineProperty(exports2, "nextSunday", { - enumerable: true, - get: function get() { - return _index171.default; - } + var _index176 = require_nextTuesday(); + Object.keys(_index176).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index176[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index176[key]; + } + }); }); - Object.defineProperty(exports2, "nextThursday", { - enumerable: true, - get: function get() { - return _index172.default; - } + var _index177 = require_nextWednesday(); + Object.keys(_index177).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index177[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index177[key]; + } + }); }); - Object.defineProperty(exports2, "nextTuesday", { - enumerable: true, - get: function get() { - return _index173.default; - } + var _index178 = require_parse(); + Object.keys(_index178).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index178[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index178[key]; + } + }); }); - Object.defineProperty(exports2, "nextWednesday", { - enumerable: true, - get: function get() { - return _index174.default; - } + var _index179 = require_parseISO(); + Object.keys(_index179).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index179[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index179[key]; + } + }); }); - Object.defineProperty(exports2, "parse", { - enumerable: true, - get: function get() { - return _index175.default; - } + var _index180 = require_parseJSON(); + Object.keys(_index180).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index180[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index180[key]; + } + }); }); - Object.defineProperty(exports2, "parseISO", { - enumerable: true, - get: function get() { - return _index176.default; - } + var _index181 = require_previousDay(); + Object.keys(_index181).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index181[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index181[key]; + } + }); }); - Object.defineProperty(exports2, "parseJSON", { - enumerable: true, - get: function get() { - return _index177.default; - } + var _index182 = require_previousFriday(); + Object.keys(_index182).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index182[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index182[key]; + } + }); }); - Object.defineProperty(exports2, "previousDay", { - enumerable: true, - get: function get() { - return _index178.default; - } + var _index183 = require_previousMonday(); + Object.keys(_index183).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index183[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index183[key]; + } + }); }); - Object.defineProperty(exports2, "previousFriday", { - enumerable: true, - get: function get() { - return _index179.default; - } + var _index184 = require_previousSaturday(); + Object.keys(_index184).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index184[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index184[key]; + } + }); }); - Object.defineProperty(exports2, "previousMonday", { - enumerable: true, - get: function get() { - return _index180.default; - } + var _index185 = require_previousSunday(); + Object.keys(_index185).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index185[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index185[key]; + } + }); }); - Object.defineProperty(exports2, "previousSaturday", { - enumerable: true, - get: function get() { - return _index181.default; - } + var _index186 = require_previousThursday(); + Object.keys(_index186).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index186[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index186[key]; + } + }); }); - Object.defineProperty(exports2, "previousSunday", { - enumerable: true, - get: function get() { - return _index182.default; - } + var _index187 = require_previousTuesday(); + Object.keys(_index187).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index187[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index187[key]; + } + }); }); - Object.defineProperty(exports2, "previousThursday", { - enumerable: true, - get: function get() { - return _index183.default; - } + var _index188 = require_previousWednesday(); + Object.keys(_index188).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index188[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index188[key]; + } + }); }); - Object.defineProperty(exports2, "previousTuesday", { - enumerable: true, - get: function get() { - return _index184.default; - } + var _index189 = require_quartersToMonths(); + Object.keys(_index189).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index189[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index189[key]; + } + }); }); - Object.defineProperty(exports2, "previousWednesday", { - enumerable: true, - get: function get() { - return _index185.default; - } + var _index190 = require_quartersToYears(); + Object.keys(_index190).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index190[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index190[key]; + } + }); }); - Object.defineProperty(exports2, "quartersToMonths", { - enumerable: true, - get: function get() { - return _index186.default; - } + var _index191 = require_roundToNearestHours(); + Object.keys(_index191).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index191[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index191[key]; + } + }); }); - Object.defineProperty(exports2, "quartersToYears", { - enumerable: true, - get: function get() { - return _index187.default; - } + var _index192 = require_roundToNearestMinutes(); + Object.keys(_index192).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index192[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index192[key]; + } + }); }); - Object.defineProperty(exports2, "roundToNearestMinutes", { - enumerable: true, - get: function get() { - return _index188.default; - } + var _index193 = require_secondsToHours(); + Object.keys(_index193).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index193[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index193[key]; + } + }); }); - Object.defineProperty(exports2, "secondsToHours", { - enumerable: true, - get: function get() { - return _index189.default; - } + var _index194 = require_secondsToMilliseconds(); + Object.keys(_index194).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index194[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index194[key]; + } + }); }); - Object.defineProperty(exports2, "secondsToMilliseconds", { - enumerable: true, - get: function get() { - return _index190.default; - } + var _index195 = require_secondsToMinutes(); + Object.keys(_index195).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index195[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index195[key]; + } + }); }); - Object.defineProperty(exports2, "secondsToMinutes", { - enumerable: true, - get: function get() { - return _index191.default; - } + var _index196 = require_set(); + Object.keys(_index196).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index196[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index196[key]; + } + }); }); - Object.defineProperty(exports2, "set", { - enumerable: true, - get: function get() { - return _index192.default; - } + var _index197 = require_setDate(); + Object.keys(_index197).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index197[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index197[key]; + } + }); }); - Object.defineProperty(exports2, "setDate", { - enumerable: true, - get: function get() { - return _index193.default; - } + var _index198 = require_setDay(); + Object.keys(_index198).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index198[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index198[key]; + } + }); }); - Object.defineProperty(exports2, "setDay", { - enumerable: true, - get: function get() { - return _index194.default; - } + var _index199 = require_setDayOfYear(); + Object.keys(_index199).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index199[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index199[key]; + } + }); }); - Object.defineProperty(exports2, "setDayOfYear", { - enumerable: true, - get: function get() { - return _index195.default; - } + var _index200 = require_setDefaultOptions(); + Object.keys(_index200).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index200[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index200[key]; + } + }); }); - Object.defineProperty(exports2, "setDefaultOptions", { - enumerable: true, - get: function get() { - return _index196.default; - } + var _index201 = require_setHours(); + Object.keys(_index201).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index201[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index201[key]; + } + }); }); - Object.defineProperty(exports2, "setHours", { - enumerable: true, - get: function get() { - return _index197.default; - } + var _index202 = require_setISODay(); + Object.keys(_index202).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index202[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index202[key]; + } + }); }); - Object.defineProperty(exports2, "setISODay", { - enumerable: true, - get: function get() { - return _index198.default; - } + var _index203 = require_setISOWeek(); + Object.keys(_index203).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index203[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index203[key]; + } + }); }); - Object.defineProperty(exports2, "setISOWeek", { - enumerable: true, - get: function get() { - return _index199.default; - } + var _index204 = require_setISOWeekYear(); + Object.keys(_index204).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index204[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index204[key]; + } + }); }); - Object.defineProperty(exports2, "setISOWeekYear", { - enumerable: true, - get: function get() { - return _index200.default; - } + var _index205 = require_setMilliseconds(); + Object.keys(_index205).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index205[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index205[key]; + } + }); }); - Object.defineProperty(exports2, "setMilliseconds", { - enumerable: true, - get: function get() { - return _index201.default; - } + var _index206 = require_setMinutes(); + Object.keys(_index206).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index206[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index206[key]; + } + }); }); - Object.defineProperty(exports2, "setMinutes", { - enumerable: true, - get: function get() { - return _index202.default; - } + var _index207 = require_setMonth(); + Object.keys(_index207).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index207[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index207[key]; + } + }); }); - Object.defineProperty(exports2, "setMonth", { - enumerable: true, - get: function get() { - return _index203.default; - } + var _index208 = require_setQuarter(); + Object.keys(_index208).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index208[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index208[key]; + } + }); }); - Object.defineProperty(exports2, "setQuarter", { - enumerable: true, - get: function get() { - return _index204.default; - } + var _index209 = require_setSeconds(); + Object.keys(_index209).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index209[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index209[key]; + } + }); }); - Object.defineProperty(exports2, "setSeconds", { - enumerable: true, - get: function get() { - return _index205.default; - } + var _index210 = require_setWeek(); + Object.keys(_index210).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index210[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index210[key]; + } + }); }); - Object.defineProperty(exports2, "setWeek", { - enumerable: true, - get: function get() { - return _index206.default; - } + var _index211 = require_setWeekYear(); + Object.keys(_index211).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index211[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index211[key]; + } + }); }); - Object.defineProperty(exports2, "setWeekYear", { - enumerable: true, - get: function get() { - return _index207.default; - } + var _index212 = require_setYear(); + Object.keys(_index212).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index212[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index212[key]; + } + }); }); - Object.defineProperty(exports2, "setYear", { - enumerable: true, - get: function get() { - return _index208.default; - } + var _index213 = require_startOfDay(); + Object.keys(_index213).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index213[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index213[key]; + } + }); }); - Object.defineProperty(exports2, "startOfDay", { - enumerable: true, - get: function get() { - return _index209.default; - } + var _index214 = require_startOfDecade(); + Object.keys(_index214).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index214[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index214[key]; + } + }); }); - Object.defineProperty(exports2, "startOfDecade", { - enumerable: true, - get: function get() { - return _index210.default; - } + var _index215 = require_startOfHour(); + Object.keys(_index215).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index215[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index215[key]; + } + }); }); - Object.defineProperty(exports2, "startOfHour", { - enumerable: true, - get: function get() { - return _index211.default; - } + var _index216 = require_startOfISOWeek(); + Object.keys(_index216).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index216[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index216[key]; + } + }); }); - Object.defineProperty(exports2, "startOfISOWeek", { - enumerable: true, - get: function get() { - return _index212.default; - } + var _index217 = require_startOfISOWeekYear(); + Object.keys(_index217).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index217[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index217[key]; + } + }); }); - Object.defineProperty(exports2, "startOfISOWeekYear", { - enumerable: true, - get: function get() { - return _index213.default; - } + var _index218 = require_startOfMinute(); + Object.keys(_index218).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index218[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index218[key]; + } + }); }); - Object.defineProperty(exports2, "startOfMinute", { - enumerable: true, - get: function get() { - return _index214.default; - } + var _index219 = require_startOfMonth(); + Object.keys(_index219).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index219[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index219[key]; + } + }); }); - Object.defineProperty(exports2, "startOfMonth", { - enumerable: true, - get: function get() { - return _index215.default; - } + var _index220 = require_startOfQuarter(); + Object.keys(_index220).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index220[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index220[key]; + } + }); }); - Object.defineProperty(exports2, "startOfQuarter", { - enumerable: true, - get: function get() { - return _index216.default; - } + var _index221 = require_startOfSecond(); + Object.keys(_index221).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index221[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index221[key]; + } + }); }); - Object.defineProperty(exports2, "startOfSecond", { - enumerable: true, - get: function get() { - return _index217.default; - } + var _index222 = require_startOfToday(); + Object.keys(_index222).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index222[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index222[key]; + } + }); }); - Object.defineProperty(exports2, "startOfToday", { - enumerable: true, - get: function get() { - return _index218.default; - } + var _index223 = require_startOfTomorrow(); + Object.keys(_index223).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index223[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index223[key]; + } + }); }); - Object.defineProperty(exports2, "startOfTomorrow", { - enumerable: true, - get: function get() { - return _index219.default; - } + var _index224 = require_startOfWeek(); + Object.keys(_index224).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index224[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index224[key]; + } + }); }); - Object.defineProperty(exports2, "startOfWeek", { - enumerable: true, - get: function get() { - return _index220.default; - } + var _index225 = require_startOfWeekYear(); + Object.keys(_index225).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index225[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index225[key]; + } + }); }); - Object.defineProperty(exports2, "startOfWeekYear", { - enumerable: true, - get: function get() { - return _index221.default; - } + var _index226 = require_startOfYear(); + Object.keys(_index226).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index226[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index226[key]; + } + }); }); - Object.defineProperty(exports2, "startOfYear", { - enumerable: true, - get: function get() { - return _index222.default; - } + var _index227 = require_startOfYesterday(); + Object.keys(_index227).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index227[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index227[key]; + } + }); }); - Object.defineProperty(exports2, "startOfYesterday", { - enumerable: true, - get: function get() { - return _index223.default; - } + var _index228 = require_sub(); + Object.keys(_index228).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index228[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index228[key]; + } + }); }); - Object.defineProperty(exports2, "sub", { - enumerable: true, - get: function get() { - return _index224.default; - } + var _index229 = require_subBusinessDays(); + Object.keys(_index229).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index229[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index229[key]; + } + }); }); - Object.defineProperty(exports2, "subBusinessDays", { - enumerable: true, - get: function get() { - return _index225.default; - } + var _index230 = require_subDays(); + Object.keys(_index230).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index230[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index230[key]; + } + }); }); - Object.defineProperty(exports2, "subDays", { - enumerable: true, - get: function get() { - return _index226.default; - } + var _index231 = require_subHours(); + Object.keys(_index231).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index231[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index231[key]; + } + }); }); - Object.defineProperty(exports2, "subHours", { - enumerable: true, - get: function get() { - return _index227.default; - } + var _index232 = require_subISOWeekYears(); + Object.keys(_index232).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index232[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index232[key]; + } + }); }); - Object.defineProperty(exports2, "subISOWeekYears", { - enumerable: true, - get: function get() { - return _index228.default; - } + var _index233 = require_subMilliseconds(); + Object.keys(_index233).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index233[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index233[key]; + } + }); }); - Object.defineProperty(exports2, "subMilliseconds", { - enumerable: true, - get: function get() { - return _index229.default; - } + var _index234 = require_subMinutes(); + Object.keys(_index234).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index234[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index234[key]; + } + }); }); - Object.defineProperty(exports2, "subMinutes", { - enumerable: true, - get: function get() { - return _index230.default; - } + var _index235 = require_subMonths(); + Object.keys(_index235).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index235[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index235[key]; + } + }); }); - Object.defineProperty(exports2, "subMonths", { - enumerable: true, - get: function get() { - return _index231.default; - } + var _index236 = require_subQuarters(); + Object.keys(_index236).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index236[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index236[key]; + } + }); }); - Object.defineProperty(exports2, "subQuarters", { - enumerable: true, - get: function get() { - return _index232.default; - } + var _index237 = require_subSeconds(); + Object.keys(_index237).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index237[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index237[key]; + } + }); }); - Object.defineProperty(exports2, "subSeconds", { - enumerable: true, - get: function get() { - return _index233.default; - } + var _index238 = require_subWeeks(); + Object.keys(_index238).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index238[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index238[key]; + } + }); }); - Object.defineProperty(exports2, "subWeeks", { - enumerable: true, - get: function get() { - return _index234.default; - } + var _index239 = require_subYears(); + Object.keys(_index239).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index239[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index239[key]; + } + }); }); - Object.defineProperty(exports2, "subYears", { - enumerable: true, - get: function get() { - return _index235.default; - } + var _index240 = require_toDate(); + Object.keys(_index240).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index240[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index240[key]; + } + }); }); - Object.defineProperty(exports2, "toDate", { - enumerable: true, - get: function get() { - return _index236.default; - } + var _index241 = require_transpose(); + Object.keys(_index241).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index241[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index241[key]; + } + }); }); - Object.defineProperty(exports2, "weeksToDays", { - enumerable: true, - get: function get() { - return _index237.default; - } + var _index242 = require_weeksToDays(); + Object.keys(_index242).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index242[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index242[key]; + } + }); }); - Object.defineProperty(exports2, "yearsToMonths", { - enumerable: true, - get: function get() { - return _index238.default; - } + var _index243 = require_yearsToDays(); + Object.keys(_index243).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index243[key]) + return; + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index243[key]; + } + }); }); - Object.defineProperty(exports2, "yearsToQuarters", { - enumerable: true, - get: function get() { - return _index239.default; - } - }); - var _index = _interopRequireDefault(require_add()); - var _index2 = _interopRequireDefault(require_addBusinessDays()); - var _index3 = _interopRequireDefault(require_addDays()); - var _index4 = _interopRequireDefault(require_addHours()); - var _index5 = _interopRequireDefault(require_addISOWeekYears()); - var _index6 = _interopRequireDefault(require_addMilliseconds()); - var _index7 = _interopRequireDefault(require_addMinutes()); - var _index8 = _interopRequireDefault(require_addMonths()); - var _index9 = _interopRequireDefault(require_addQuarters()); - var _index10 = _interopRequireDefault(require_addSeconds()); - var _index11 = _interopRequireDefault(require_addWeeks()); - var _index12 = _interopRequireDefault(require_addYears()); - var _index13 = _interopRequireDefault(require_areIntervalsOverlapping()); - var _index14 = _interopRequireDefault(require_clamp()); - var _index15 = _interopRequireDefault(require_closestIndexTo()); - var _index16 = _interopRequireDefault(require_closestTo()); - var _index17 = _interopRequireDefault(require_compareAsc()); - var _index18 = _interopRequireDefault(require_compareDesc()); - var _index19 = _interopRequireDefault(require_daysToWeeks()); - var _index20 = _interopRequireDefault(require_differenceInBusinessDays()); - var _index21 = _interopRequireDefault(require_differenceInCalendarDays()); - var _index22 = _interopRequireDefault(require_differenceInCalendarISOWeekYears()); - var _index23 = _interopRequireDefault(require_differenceInCalendarISOWeeks()); - var _index24 = _interopRequireDefault(require_differenceInCalendarMonths()); - var _index25 = _interopRequireDefault(require_differenceInCalendarQuarters()); - var _index26 = _interopRequireDefault(require_differenceInCalendarWeeks()); - var _index27 = _interopRequireDefault(require_differenceInCalendarYears()); - var _index28 = _interopRequireDefault(require_differenceInDays()); - var _index29 = _interopRequireDefault(require_differenceInHours()); - var _index30 = _interopRequireDefault(require_differenceInISOWeekYears()); - var _index31 = _interopRequireDefault(require_differenceInMilliseconds()); - var _index32 = _interopRequireDefault(require_differenceInMinutes()); - var _index33 = _interopRequireDefault(require_differenceInMonths()); - var _index34 = _interopRequireDefault(require_differenceInQuarters()); - var _index35 = _interopRequireDefault(require_differenceInSeconds()); - var _index36 = _interopRequireDefault(require_differenceInWeeks()); - var _index37 = _interopRequireDefault(require_differenceInYears()); - var _index38 = _interopRequireDefault(require_eachDayOfInterval()); - var _index39 = _interopRequireDefault(require_eachHourOfInterval()); - var _index40 = _interopRequireDefault(require_eachMinuteOfInterval()); - var _index41 = _interopRequireDefault(require_eachMonthOfInterval()); - var _index42 = _interopRequireDefault(require_eachQuarterOfInterval()); - var _index43 = _interopRequireDefault(require_eachWeekOfInterval()); - var _index44 = _interopRequireDefault(require_eachWeekendOfInterval()); - var _index45 = _interopRequireDefault(require_eachWeekendOfMonth()); - var _index46 = _interopRequireDefault(require_eachWeekendOfYear()); - var _index47 = _interopRequireDefault(require_eachYearOfInterval()); - var _index48 = _interopRequireDefault(require_endOfDay()); - var _index49 = _interopRequireDefault(require_endOfDecade()); - var _index50 = _interopRequireDefault(require_endOfHour()); - var _index51 = _interopRequireDefault(require_endOfISOWeek()); - var _index52 = _interopRequireDefault(require_endOfISOWeekYear()); - var _index53 = _interopRequireDefault(require_endOfMinute()); - var _index54 = _interopRequireDefault(require_endOfMonth()); - var _index55 = _interopRequireDefault(require_endOfQuarter()); - var _index56 = _interopRequireDefault(require_endOfSecond()); - var _index57 = _interopRequireDefault(require_endOfToday()); - var _index58 = _interopRequireDefault(require_endOfTomorrow()); - var _index59 = _interopRequireDefault(require_endOfWeek()); - var _index60 = _interopRequireDefault(require_endOfYear()); - var _index61 = _interopRequireDefault(require_endOfYesterday()); - var _index62 = _interopRequireDefault(require_format()); - var _index63 = _interopRequireDefault(require_formatDistance2()); - var _index64 = _interopRequireDefault(require_formatDistanceStrict()); - var _index65 = _interopRequireDefault(require_formatDistanceToNow()); - var _index66 = _interopRequireDefault(require_formatDistanceToNowStrict()); - var _index67 = _interopRequireDefault(require_formatDuration()); - var _index68 = _interopRequireDefault(require_formatISO()); - var _index69 = _interopRequireDefault(require_formatISO9075()); - var _index70 = _interopRequireDefault(require_formatISODuration()); - var _index71 = _interopRequireDefault(require_formatRFC3339()); - var _index72 = _interopRequireDefault(require_formatRFC7231()); - var _index73 = _interopRequireDefault(require_formatRelative2()); - var _index74 = _interopRequireDefault(require_fromUnixTime()); - var _index75 = _interopRequireDefault(require_getDate()); - var _index76 = _interopRequireDefault(require_getDay()); - var _index77 = _interopRequireDefault(require_getDayOfYear()); - var _index78 = _interopRequireDefault(require_getDaysInMonth()); - var _index79 = _interopRequireDefault(require_getDaysInYear()); - var _index80 = _interopRequireDefault(require_getDecade()); - var _index81 = _interopRequireDefault(require_getDefaultOptions()); - var _index82 = _interopRequireDefault(require_getHours()); - var _index83 = _interopRequireDefault(require_getISODay()); - var _index84 = _interopRequireDefault(require_getISOWeek()); - var _index85 = _interopRequireDefault(require_getISOWeekYear()); - var _index86 = _interopRequireDefault(require_getISOWeeksInYear()); - var _index87 = _interopRequireDefault(require_getMilliseconds()); - var _index88 = _interopRequireDefault(require_getMinutes()); - var _index89 = _interopRequireDefault(require_getMonth()); - var _index90 = _interopRequireDefault(require_getOverlappingDaysInIntervals()); - var _index91 = _interopRequireDefault(require_getQuarter()); - var _index92 = _interopRequireDefault(require_getSeconds()); - var _index93 = _interopRequireDefault(require_getTime()); - var _index94 = _interopRequireDefault(require_getUnixTime()); - var _index95 = _interopRequireDefault(require_getWeek()); - var _index96 = _interopRequireDefault(require_getWeekOfMonth()); - var _index97 = _interopRequireDefault(require_getWeekYear()); - var _index98 = _interopRequireDefault(require_getWeeksInMonth()); - var _index99 = _interopRequireDefault(require_getYear()); - var _index100 = _interopRequireDefault(require_hoursToMilliseconds()); - var _index101 = _interopRequireDefault(require_hoursToMinutes()); - var _index102 = _interopRequireDefault(require_hoursToSeconds()); - var _index103 = _interopRequireDefault(require_intervalToDuration()); - var _index104 = _interopRequireDefault(require_intlFormat()); - var _index105 = _interopRequireDefault(require_intlFormatDistance()); - var _index106 = _interopRequireDefault(require_isAfter()); - var _index107 = _interopRequireDefault(require_isBefore()); - var _index108 = _interopRequireDefault(require_isDate()); - var _index109 = _interopRequireDefault(require_isEqual()); - var _index110 = _interopRequireDefault(require_isExists()); - var _index111 = _interopRequireDefault(require_isFirstDayOfMonth()); - var _index112 = _interopRequireDefault(require_isFriday()); - var _index113 = _interopRequireDefault(require_isFuture()); - var _index114 = _interopRequireDefault(require_isLastDayOfMonth()); - var _index115 = _interopRequireDefault(require_isLeapYear()); - var _index116 = _interopRequireDefault(require_isMatch()); - var _index117 = _interopRequireDefault(require_isMonday()); - var _index118 = _interopRequireDefault(require_isPast()); - var _index119 = _interopRequireDefault(require_isSameDay()); - var _index120 = _interopRequireDefault(require_isSameHour()); - var _index121 = _interopRequireDefault(require_isSameISOWeek()); - var _index122 = _interopRequireDefault(require_isSameISOWeekYear()); - var _index123 = _interopRequireDefault(require_isSameMinute()); - var _index124 = _interopRequireDefault(require_isSameMonth()); - var _index125 = _interopRequireDefault(require_isSameQuarter()); - var _index126 = _interopRequireDefault(require_isSameSecond()); - var _index127 = _interopRequireDefault(require_isSameWeek()); - var _index128 = _interopRequireDefault(require_isSameYear()); - var _index129 = _interopRequireDefault(require_isSaturday()); - var _index130 = _interopRequireDefault(require_isSunday()); - var _index131 = _interopRequireDefault(require_isThisHour()); - var _index132 = _interopRequireDefault(require_isThisISOWeek()); - var _index133 = _interopRequireDefault(require_isThisMinute()); - var _index134 = _interopRequireDefault(require_isThisMonth()); - var _index135 = _interopRequireDefault(require_isThisQuarter()); - var _index136 = _interopRequireDefault(require_isThisSecond()); - var _index137 = _interopRequireDefault(require_isThisWeek()); - var _index138 = _interopRequireDefault(require_isThisYear()); - var _index139 = _interopRequireDefault(require_isThursday()); - var _index140 = _interopRequireDefault(require_isToday()); - var _index141 = _interopRequireDefault(require_isTomorrow()); - var _index142 = _interopRequireDefault(require_isTuesday()); - var _index143 = _interopRequireDefault(require_isValid()); - var _index144 = _interopRequireDefault(require_isWednesday()); - var _index145 = _interopRequireDefault(require_isWeekend()); - var _index146 = _interopRequireDefault(require_isWithinInterval()); - var _index147 = _interopRequireDefault(require_isYesterday()); - var _index148 = _interopRequireDefault(require_lastDayOfDecade()); - var _index149 = _interopRequireDefault(require_lastDayOfISOWeek()); - var _index150 = _interopRequireDefault(require_lastDayOfISOWeekYear()); - var _index151 = _interopRequireDefault(require_lastDayOfMonth()); - var _index152 = _interopRequireDefault(require_lastDayOfQuarter()); - var _index153 = _interopRequireDefault(require_lastDayOfWeek()); - var _index154 = _interopRequireDefault(require_lastDayOfYear()); - var _index155 = _interopRequireDefault(require_lightFormat()); - var _index156 = _interopRequireDefault(require_max()); - var _index157 = _interopRequireDefault(require_milliseconds()); - var _index158 = _interopRequireDefault(require_millisecondsToHours()); - var _index159 = _interopRequireDefault(require_millisecondsToMinutes()); - var _index160 = _interopRequireDefault(require_millisecondsToSeconds()); - var _index161 = _interopRequireDefault(require_min()); - var _index162 = _interopRequireDefault(require_minutesToHours()); - var _index163 = _interopRequireDefault(require_minutesToMilliseconds()); - var _index164 = _interopRequireDefault(require_minutesToSeconds()); - var _index165 = _interopRequireDefault(require_monthsToQuarters()); - var _index166 = _interopRequireDefault(require_monthsToYears()); - var _index167 = _interopRequireDefault(require_nextDay()); - var _index168 = _interopRequireDefault(require_nextFriday()); - var _index169 = _interopRequireDefault(require_nextMonday()); - var _index170 = _interopRequireDefault(require_nextSaturday()); - var _index171 = _interopRequireDefault(require_nextSunday()); - var _index172 = _interopRequireDefault(require_nextThursday()); - var _index173 = _interopRequireDefault(require_nextTuesday()); - var _index174 = _interopRequireDefault(require_nextWednesday()); - var _index175 = _interopRequireDefault(require_parse()); - var _index176 = _interopRequireDefault(require_parseISO()); - var _index177 = _interopRequireDefault(require_parseJSON()); - var _index178 = _interopRequireDefault(require_previousDay()); - var _index179 = _interopRequireDefault(require_previousFriday()); - var _index180 = _interopRequireDefault(require_previousMonday()); - var _index181 = _interopRequireDefault(require_previousSaturday()); - var _index182 = _interopRequireDefault(require_previousSunday()); - var _index183 = _interopRequireDefault(require_previousThursday()); - var _index184 = _interopRequireDefault(require_previousTuesday()); - var _index185 = _interopRequireDefault(require_previousWednesday()); - var _index186 = _interopRequireDefault(require_quartersToMonths()); - var _index187 = _interopRequireDefault(require_quartersToYears()); - var _index188 = _interopRequireDefault(require_roundToNearestMinutes()); - var _index189 = _interopRequireDefault(require_secondsToHours()); - var _index190 = _interopRequireDefault(require_secondsToMilliseconds()); - var _index191 = _interopRequireDefault(require_secondsToMinutes()); - var _index192 = _interopRequireDefault(require_set()); - var _index193 = _interopRequireDefault(require_setDate()); - var _index194 = _interopRequireDefault(require_setDay()); - var _index195 = _interopRequireDefault(require_setDayOfYear()); - var _index196 = _interopRequireDefault(require_setDefaultOptions()); - var _index197 = _interopRequireDefault(require_setHours()); - var _index198 = _interopRequireDefault(require_setISODay()); - var _index199 = _interopRequireDefault(require_setISOWeek()); - var _index200 = _interopRequireDefault(require_setISOWeekYear()); - var _index201 = _interopRequireDefault(require_setMilliseconds()); - var _index202 = _interopRequireDefault(require_setMinutes()); - var _index203 = _interopRequireDefault(require_setMonth()); - var _index204 = _interopRequireDefault(require_setQuarter()); - var _index205 = _interopRequireDefault(require_setSeconds()); - var _index206 = _interopRequireDefault(require_setWeek()); - var _index207 = _interopRequireDefault(require_setWeekYear()); - var _index208 = _interopRequireDefault(require_setYear()); - var _index209 = _interopRequireDefault(require_startOfDay()); - var _index210 = _interopRequireDefault(require_startOfDecade()); - var _index211 = _interopRequireDefault(require_startOfHour()); - var _index212 = _interopRequireDefault(require_startOfISOWeek()); - var _index213 = _interopRequireDefault(require_startOfISOWeekYear()); - var _index214 = _interopRequireDefault(require_startOfMinute()); - var _index215 = _interopRequireDefault(require_startOfMonth()); - var _index216 = _interopRequireDefault(require_startOfQuarter()); - var _index217 = _interopRequireDefault(require_startOfSecond()); - var _index218 = _interopRequireDefault(require_startOfToday()); - var _index219 = _interopRequireDefault(require_startOfTomorrow()); - var _index220 = _interopRequireDefault(require_startOfWeek()); - var _index221 = _interopRequireDefault(require_startOfWeekYear()); - var _index222 = _interopRequireDefault(require_startOfYear()); - var _index223 = _interopRequireDefault(require_startOfYesterday()); - var _index224 = _interopRequireDefault(require_sub()); - var _index225 = _interopRequireDefault(require_subBusinessDays()); - var _index226 = _interopRequireDefault(require_subDays()); - var _index227 = _interopRequireDefault(require_subHours()); - var _index228 = _interopRequireDefault(require_subISOWeekYears()); - var _index229 = _interopRequireDefault(require_subMilliseconds()); - var _index230 = _interopRequireDefault(require_subMinutes()); - var _index231 = _interopRequireDefault(require_subMonths()); - var _index232 = _interopRequireDefault(require_subQuarters()); - var _index233 = _interopRequireDefault(require_subSeconds()); - var _index234 = _interopRequireDefault(require_subWeeks()); - var _index235 = _interopRequireDefault(require_subYears()); - var _index236 = _interopRequireDefault(require_toDate()); - var _index237 = _interopRequireDefault(require_weeksToDays()); - var _index238 = _interopRequireDefault(require_yearsToMonths()); - var _index239 = _interopRequireDefault(require_yearsToQuarters()); - var _index240 = require_constants(); - Object.keys(_index240).forEach(function(key) { + var _index244 = require_yearsToMonths(); + Object.keys(_index244).forEach(function(key) { if (key === "default" || key === "__esModule") return; - if (Object.prototype.hasOwnProperty.call(_exportNames, key)) + if (key in exports2 && exports2[key] === _index244[key]) return; - if (key in exports2 && exports2[key] === _index240[key]) + Object.defineProperty(exports2, key, { + enumerable: true, + get: function() { + return _index244[key]; + } + }); + }); + var _index245 = require_yearsToQuarters(); + Object.keys(_index245).forEach(function(key) { + if (key === "default" || key === "__esModule") + return; + if (key in exports2 && exports2[key] === _index245[key]) return; Object.defineProperty(exports2, key, { enumerable: true, - get: function get() { - return _index240[key]; + get: function() { + return _index245[key]; } }); }); @@ -16324,7 +14291,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs2.read); - fs2.readSync = typeof fs2.readSync !== "function" ? fs2.readSync : function(fs$readSync) { + fs2.readSync = typeof fs2.readSync !== "function" ? fs2.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -17219,18 +15186,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs2 = require_graceful_fs(); - function utimesMillis(path2, atime, mtime, callback) { - fs2.open(path2, "r+", (err, fd) => { - if (err) - return callback(err); - fs2.futimes(fd, atime, mtime, (futimesErr) => { - fs2.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs2 = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path2, atime, mtime) { + const fd = await fs2.open(path2, "r+"); + let closeErr = null; + try { + await fs2.futimes(fd, atime, mtime); + } finally { + try { + await fs2.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path2, atime, mtime) { const fd = fs2.openSync(path2, "r+"); @@ -17238,7 +15210,7 @@ var require_utimes = __commonJS({ return fs2.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -17250,7 +15222,7 @@ var require_stat = __commonJS({ "use strict"; var fs2 = require_fs(); var path2 = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs2.stat(file, { bigint: true }) : (file) => fs2.lstat(file, { bigint: true }); return Promise.all([ @@ -17275,32 +15247,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path2.basename(src); - const destBaseName = path2.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path2.basename(src); + const destBaseName = path2.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); + } + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -17325,22 +15293,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path2.resolve(path2.dirname(src)); const destParent = path2.resolve(path2.dirname(dest)); if (destParent === srcParent || destParent === path2.parse(destParent).root) - return cb(); - fs2.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs2.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path2.resolve(path2.dirname(src)); @@ -17366,16 +15335,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path2.resolve(src).split(path2.sep).filter((i) => i); const destArr = path2.resolve(dest).split(path2.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -17386,22 +15358,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs2 = require_graceful_fs(); + var fs2 = require_fs(); var path2 = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -17411,204 +15377,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path2.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); - } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs2.stat : fs2.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); - } - function onFile(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); + return true; + return opts.filter(src, dest); + } + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs2.stat : fs2.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function mayCopyFile(srcStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { + if (!destStat) + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs2.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs2.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); - } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + await fs2.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } + } + async function copyFile(srcStat, src, dest, opts) { + await fs2.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs2.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs2.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs2.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs2.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs2.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs2.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs2.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path2.join(src, item); - const destItem = path2.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs2.mkdir(dest); + } + const items = await fs2.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path2.join(src, item); + const destItem = path2.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs2.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path2.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs2.symlink(resolvedSrc, dest, cb); - } else { - fs2.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs2.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path2.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs2.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs2.unlink(dest, (err) => { - if (err) - return cb(err); - return fs2.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs2.readlink(src); + if (opts.dereference) { + resolvedSrc = path2.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs2.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs2.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs2.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path2.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs2.unlink(dest); + return fs2.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -17759,7 +15632,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -17829,43 +15702,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path2 = require("path"); - var fs2 = require_graceful_fs(); + var fs2 = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs2.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs2.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path2.dirname(file); + let dirStats = null; + try { + dirStats = await fs2.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs2.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs2.writeFile(file, ""); + } else { + await fs2.readdir(dir); } - fs2.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path2.dirname(file); - fs2.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs2.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -17899,42 +15765,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path2 = require("path"); - var fs2 = require_graceful_fs(); + var fs2 = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs2.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs2.lstat(dstpath); + } catch { } - fs2.lstat(dstpath, (_, dstStat) => { - fs2.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path2.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs2.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path2.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs2.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -17969,78 +15826,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path2 = require("path"); - var fs2 = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs2 = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path2.isAbsolute(srcpath)) { - return fs2.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path2.dirname(dstpath); - const relativeToDst = path2.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs2.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path2.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs2.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path2.dirname(dstpath); + const relativeToDst = path2.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs2.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path2.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path2.isAbsolute(srcpath)) { - exists = fs2.existsSync(srcpath); - if (!exists) + const exists2 = fs2.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path2.dirname(dstpath); - const relativeToDst = path2.join(dstdir, srcpath); - exists = fs2.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs2.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path2.relative(dstdir, srcpath) - }; - } } + const dstdir = path2.dirname(dstpath); + const relativeToDst = path2.join(dstdir, srcpath); + const exists = fs2.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs2.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path2.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -18050,23 +15900,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs2 = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs2 = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs2.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs2.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs2.lstatSync(srcpath); } catch { @@ -18075,7 +15925,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -18085,59 +15935,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path2 = require("path"); var fs2 = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs2.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs2.stat(srcpath), - fs2.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path2.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs2.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs2.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs2.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs2.stat(srcpath), + fs2.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path2.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs2.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -18304,35 +16131,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs2 = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs2 = require_fs(); var path2 = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path2.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs2.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs2.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs2.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path2.dirname(file); - if (fs2.existsSync(dir)) { - return fs2.writeFileSync(file, ...args); + if (!fs2.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs2.writeFileSync(file, ...args); } module2.exports = { @@ -18392,80 +16207,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs2 = require_graceful_fs(); + var fs2 = require_fs(); var path2 = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path2.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path2.dirname(dest); - const parsedPath = path2.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path2.dirname(dest); + const parsedParentPath = path2.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs2.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs2.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -18532,7 +16316,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() diff --git a/dist/actions/catalog-status/index.js b/dist/actions/catalog-status/index.js index 90979ae2..72510201 100644 --- a/dist/actions/catalog-status/index.js +++ b/dist/actions/catalog-status/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/check-solution/index.js b/dist/actions/check-solution/index.js index b86fcb4f..96fa410e 100644 --- a/dist/actions/check-solution/index.js +++ b/dist/actions/check-solution/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/clone-solution/index.js b/dist/actions/clone-solution/index.js index 992fc73b..918277d9 100644 --- a/dist/actions/clone-solution/index.js +++ b/dist/actions/clone-solution/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/copy-environment/index.js b/dist/actions/copy-environment/index.js index d6cc3604..25a7478c 100644 --- a/dist/actions/copy-environment/index.js +++ b/dist/actions/copy-environment/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24200,56 +24098,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/create-environment/index.js b/dist/actions/create-environment/index.js index e91143a6..4cd818d2 100644 --- a/dist/actions/create-environment/index.js +++ b/dist/actions/create-environment/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24200,56 +24098,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } @@ -24347,12 +24245,14 @@ function main() { credentials: (0, getCredentials_1.default)(), environmentName: parameterMap["name"], environmentType: parameterMap["type"], + user: parameterMap["user"], region: parameterMap["region"], currency: parameterMap["currency"], language: parameterMap["language"], templates: parameterMap["templates"], domainName: parameterMap["domain"], teamId: parameterMap["team-id"], + securityGroupId: parameterMap["security-group-id"], logToConsole: false }, runnerParameters_1.runnerParameters, new ActionsHost_1.ActionsHost()); if (!result.environmentId || !result.environmentUrl) { diff --git a/dist/actions/delete-environment/index.js b/dist/actions/delete-environment/index.js index 0ca54d96..9d139e17 100644 --- a/dist/actions/delete-environment/index.js +++ b/dist/actions/delete-environment/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24200,56 +24098,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/delete-solution/index.js b/dist/actions/delete-solution/index.js index 71eab053..bc05f1b0 100644 --- a/dist/actions/delete-solution/index.js +++ b/dist/actions/delete-solution/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/deploy-package/index.js b/dist/actions/deploy-package/index.js index 9997e3cc..66b7dddb 100644 --- a/dist/actions/deploy-package/index.js +++ b/dist/actions/deploy-package/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/download-paportal/index.js b/dist/actions/download-paportal/index.js index 9a4afc82..7641bcdd 100644 --- a/dist/actions/download-paportal/index.js +++ b/dist/actions/download-paportal/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/export-data/index.js b/dist/actions/export-data/index.js index 1ad35aa3..f8ed1d56 100644 --- a/dist/actions/export-data/index.js +++ b/dist/actions/export-data/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/export-solution/index.js b/dist/actions/export-solution/index.js index d555905f..b2e60989 100644 --- a/dist/actions/export-solution/index.js +++ b/dist/actions/export-solution/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/import-data/index.js b/dist/actions/import-data/index.js index 0c9253e1..529e2a9c 100644 --- a/dist/actions/import-data/index.js +++ b/dist/actions/import-data/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/import-solution/index.js b/dist/actions/import-solution/index.js index 97998fe6..be6bb6b3 100644 --- a/dist/actions/import-solution/index.js +++ b/dist/actions/import-solution/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/install-catalog/index.js b/dist/actions/install-catalog/index.js index f6e1ee7d..c24e6229 100644 --- a/dist/actions/install-catalog/index.js +++ b/dist/actions/install-catalog/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/pack-solution/index.js b/dist/actions/pack-solution/index.js index d4717d65..d474a9dd 100644 --- a/dist/actions/pack-solution/index.js +++ b/dist/actions/pack-solution/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24152,56 +24050,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/publish-solution/index.js b/dist/actions/publish-solution/index.js index 1f2f1613..14bd7dd5 100644 --- a/dist/actions/publish-solution/index.js +++ b/dist/actions/publish-solution/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18398,7 +18296,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18453,7 +18351,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/reset-environment/index.js b/dist/actions/reset-environment/index.js index 216a82f5..ad844106 100644 --- a/dist/actions/reset-environment/index.js +++ b/dist/actions/reset-environment/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24200,56 +24098,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/restore-environment/index.js b/dist/actions/restore-environment/index.js index 0a853a03..86e174c5 100644 --- a/dist/actions/restore-environment/index.js +++ b/dist/actions/restore-environment/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24200,56 +24098,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/set-online-solution-version/index.js b/dist/actions/set-online-solution-version/index.js index 5e2a336b..ea1e82f0 100644 --- a/dist/actions/set-online-solution-version/index.js +++ b/dist/actions/set-online-solution-version/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/submit-catalog/index.js b/dist/actions/submit-catalog/index.js index 92c8582e..d1996e15 100644 --- a/dist/actions/submit-catalog/index.js +++ b/dist/actions/submit-catalog/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/unpack-solution/index.js b/dist/actions/unpack-solution/index.js index 11996b0f..ea30e472 100644 --- a/dist/actions/unpack-solution/index.js +++ b/dist/actions/unpack-solution/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24152,56 +24050,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/update-solution-version/index.js b/dist/actions/update-solution-version/index.js index 43654e8f..f31d1700 100644 --- a/dist/actions/update-solution-version/index.js +++ b/dist/actions/update-solution-version/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24152,56 +24050,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/upgrade-solution/index.js b/dist/actions/upgrade-solution/index.js index 392e664e..80458e34 100644 --- a/dist/actions/upgrade-solution/index.js +++ b/dist/actions/upgrade-solution/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/upload-paportal/index.js b/dist/actions/upload-paportal/index.js index 56f2ced2..4d19c22b 100644 --- a/dist/actions/upload-paportal/index.js +++ b/dist/actions/upload-paportal/index.js @@ -1595,7 +1595,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -2297,11 +2297,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -2490,8 +2508,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2601,8 +2619,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -2669,8 +2687,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -4522,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4896,6 +4914,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -4922,14 +4942,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -5113,6 +5135,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -5170,6 +5197,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -5402,10 +5458,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -5702,8 +5759,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5765,9 +5824,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6657,9 +6716,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6695,14 +6754,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7275,7 +7334,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7300,7 +7359,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7312,7 +7371,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -8629,6 +8690,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -8918,7 +8983,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -8991,10 +9056,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9007,7 +9079,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9236,7 +9315,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9458,7 +9537,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9681,7 +9760,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10576,18 +10655,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10595,7 +10679,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -10607,7 +10691,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10632,32 +10716,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10682,22 +10762,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10723,16 +10804,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -10743,22 +10827,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -10768,204 +10846,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -11116,7 +11101,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11186,43 +11171,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -11256,42 +11234,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11326,78 +11295,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -11407,23 +11369,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11432,7 +11394,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -11442,59 +11404,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11661,35 +11600,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11749,80 +11676,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -11889,7 +11785,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11951,7 +11847,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -11959,8 +11855,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib2(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -12311,12 +12207,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -12385,8 +12283,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12618,8 +12516,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12685,8 +12583,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -12764,8 +12662,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -13299,8 +13197,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -18337,7 +18235,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18392,7 +18290,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24213,56 +24111,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } diff --git a/dist/actions/who-am-i/index.js b/dist/actions/who-am-i/index.js index 98c45805..99be94b1 100644 --- a/dist/actions/who-am-i/index.js +++ b/dist/actions/who-am-i/index.js @@ -131,11 +131,29 @@ var require_authenticate = __commonJS({ return ["--url", url]; } function addCredentials(credentials) { - return isUsernamePassword(credentials) ? addUsernamePassword(credentials) : addClientCredentials(credentials); + if (isUsernamePassword(credentials)) { + return addUsernamePassword(credentials); + } else if (isFederatedCredentials(credentials)) { + return addFederatedCredentials(credentials); + } else { + return addClientCredentials(credentials); + } } function isUsernamePassword(credentials) { return "username" in credentials; } + function isFederatedCredentials(credentials) { + return "federationProvider" in credentials; + } + function addFederatedCredentials(parameters) { + return [ + "--applicationId", + parameters.appId, + "--tenant", + parameters.tenantId, + parameters.federationProvider == "AzureDevOps" ? "--azureDevOpsFederated" : "--githubFederated" + ]; + } function addClientCredentials(parameters) { if (parameters.scheme == "ManagedServiceIdentity") { return ["--managedIdentity"]; @@ -324,8 +342,8 @@ var require_exportSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function exportSolution(parameters, runnerParameters, host) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -435,8 +453,8 @@ var require_whoAmI = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function whoAmI(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -503,8 +521,8 @@ var require_importSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var path = require("path"); function importSolution(parameters, runnerParameters, host) { - var _a, _b, _c; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b, _c; function resolveFolder(folder) { if (!folder || typeof folder !== "string") return void 0; @@ -2356,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js -var require_cjs2 = __commonJS({ - "node_modules/path-scurry/node_modules/lru-cache/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +var require_commonjs = __commonJS({ + "node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2730,6 +2748,8 @@ var require_cjs2 = __commonJS({ if (ttls[index]) { const ttl = ttls[index]; const start = starts[index]; + if (!ttl || !start) + return; status.ttl = ttl; status.start = start; status.now = cachedNow || getNow(); @@ -2756,14 +2776,16 @@ var require_cjs2 = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (ttl === 0 || start === 0) { + if (!ttl || !start) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; + const s = starts[index]; + const t = ttls[index]; + return !!t && !!s && (cachedNow || getNow()) - s > t; }; } // conditionally set private methods related to TTL @@ -2947,6 +2969,11 @@ var require_cjs2 = __commonJS({ [Symbol.iterator]() { return this.entries(); } + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + [Symbol.toStringTag] = "LRUCache"; /** * Find a value for which the supplied fn method returns a truthy value, * similar to Array.find(). fn is called as fn(value, key, cache). @@ -3004,6 +3031,35 @@ var require_cjs2 = __commonJS({ } return deleted; } + /** + * Get the extended info about a given entry, to get its value, size, and + * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a + * single key. Always returns stale values, if their info is found in the + * cache, so be sure to check for expired TTLs if relevant. + */ + info(key) { + const i = this.#keyMap.get(key); + if (i === void 0) + return void 0; + const v = this.#valList[i]; + const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (value === void 0) + return void 0; + const entry = { value }; + if (this.#ttls && this.#starts) { + const ttl = this.#ttls[i]; + const start = this.#starts[i]; + if (ttl && start) { + const remain = ttl - (perf.now() - start); + entry.ttl = remain; + entry.start = Date.now(); + } + } + if (this.#sizes) { + entry.size = this.#sizes[i]; + } + return entry; + } /** * Return an array of [key, {@link LRUCache.Entry}] tuples which can be * passed to cache.load() @@ -3236,10 +3292,11 @@ var require_cjs2 = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index !== void 0 && (allowStale || !this.#isStale(index))) { - const v = this.#valList[index]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; + if (index === void 0 || !allowStale && this.#isStale(index)) { + return; } + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } #backgroundFetch(k, index, options, context) { const v = index === void 0 ? void 0 : this.#valList[index]; @@ -3536,8 +3593,10 @@ var require_cjs2 = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - this.#next[this.#prev[index]] = this.#next[index]; - this.#prev[this.#next[index]] = this.#prev[index]; + const pi = this.#prev[index]; + this.#next[pi] = this.#next[index]; + const ni = this.#next[index]; + this.#prev[ni] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3599,9 +3658,9 @@ var require_cjs2 = __commonJS({ } }); -// node_modules/minipass/dist/cjs/index.js -var require_cjs3 = __commonJS({ - "node_modules/minipass/dist/cjs/index.js"(exports2) { +// node_modules/minipass/dist/commonjs/index.js +var require_commonjs2 = __commonJS({ + "node_modules/minipass/dist/commonjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4491,9 +4550,9 @@ var require_cjs3 = __commonJS({ } }); -// node_modules/path-scurry/dist/cjs/index.js -var require_cjs4 = __commonJS({ - "node_modules/path-scurry/dist/cjs/index.js"(exports2) { +// node_modules/path-scurry/dist/commonjs/index.js +var require_commonjs3 = __commonJS({ + "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4529,14 +4588,14 @@ var require_cjs4 = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_cjs2(); + var lru_cache_1 = require_commonjs(); var path_1 = require("path"); var url_1 = require("url"); var actualFS = __importStar(require("fs")); var fs_1 = require("fs"); var realpathSync = fs_1.realpathSync.native; var promises_1 = require("fs/promises"); - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5109,7 +5168,7 @@ var require_cjs4 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = (await this.parent.realpath())?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5134,7 +5193,7 @@ var require_cjs4 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.resolve(read); + const linkTarget = this.parent.realpathSync()?.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5146,7 +5205,9 @@ var require_cjs4 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - children[p].#markENOENT(); + const c = children[p]; + if (c) + c.#markENOENT(); } } #markENOENT() { @@ -6463,6 +6524,10 @@ var require_ignore = __commonJS({ if (!parsed || !globParts) { throw new Error("invalid pattern object"); } + while (parsed[0] === "." && globParts[0] === ".") { + parsed.shift(); + globParts.shift(); + } const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === "**"; @@ -6752,7 +6817,7 @@ var require_walker = __commonJS({ "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_cjs3(); + var minipass_1 = require_commonjs2(); var ignore_js_1 = require_ignore(); var processor_js_1 = require_processor(); var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; @@ -6825,10 +6890,17 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); + const s = needStat ? await e.lstat() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = await s.realpath(); + if (target && (target.isUnknown() || this.opts.stat)) { + await target.lstat(); + } + } + return this.matchCheckTest(s, ifDir); } matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6841,7 +6913,14 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); + const s = needStat ? e.lstatSync() : e; + if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { + const target = s.realpathSync(); + if (target && (target?.isUnknown() || this.opts.stat)) { + target.lstatSync(); + } + } + return this.matchCheckTest(s, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7070,7 +7149,7 @@ var require_glob = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Glob = void 0; var minimatch_1 = require_cjs(); - var path_scurry_1 = require_cjs4(); + var path_scurry_1 = require_commonjs3(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7292,7 +7371,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs = __commonJS({ +var require_commonjs4 = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7515,7 +7594,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8410,18 +8489,23 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function utimesMillis(path, atime, mtime, callback) { - fs.open(path, "r+", (err, fd) => { - if (err) - return callback(err); - fs.futimes(fd, atime, mtime, (futimesErr) => { - fs.close(fd, (closeErr) => { - if (callback) - callback(futimesErr || closeErr); - }); - }); - }); + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function utimesMillis(path, atime, mtime) { + const fd = await fs.open(path, "r+"); + let closeErr = null; + try { + await fs.futimes(fd, atime, mtime); + } finally { + try { + await fs.close(fd); + } catch (e) { + closeErr = e; + } + } + if (closeErr) { + throw closeErr; + } } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8429,7 +8513,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis, + utimesMillis: u(utimesMillis), utimesMillisSync }; } @@ -8441,7 +8525,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var util = require("util"); + var u = require_universalify().fromPromise; function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8466,32 +8550,28 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkPaths(src, dest, funcName, opts, cb) { - util.callbackify(getStats)(src, dest, opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - if (destStat) { - if (areIdentical(srcStat, destStat)) { - const srcBaseName = path.basename(src); - const destBaseName = path.basename(dest); - if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { - return cb(null, { srcStat, destStat, isChangingCase: true }); - } - return cb(new Error("Source and destination must not be the same.")); - } - if (srcStat.isDirectory() && !destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)); - } - if (!srcStat.isDirectory() && destStat.isDirectory()) { - return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)); + async function checkPaths(src, dest, funcName, opts) { + const { srcStat, destStat } = await getStats(src, dest, opts); + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src); + const destBaseName = path.basename(dest); + if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true }; } + throw new Error("Source and destination must not be the same."); } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - return cb(new Error(errMsg(src, dest, funcName))); + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`); } - return cb(null, { srcStat, destStat }); - }); + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + } + } + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)); + } + return { srcStat, destStat }; } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8516,22 +8596,23 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - function checkParentPaths(src, srcStat, dest, funcName, cb) { + async function checkParentPaths(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - return cb(); - fs.stat(destParent, { bigint: true }, (err, destStat) => { - if (err) { - if (err.code === "ENOENT") - return cb(); - return cb(err); - } - if (areIdentical(srcStat, destStat)) { - return cb(new Error(errMsg(src, dest, funcName))); - } - return checkParentPaths(src, srcStat, destParent, funcName, cb); - }); + return; + let destStat; + try { + destStat = await fs.stat(destParent, { bigint: true }); + } catch (err) { + if (err.code === "ENOENT") + return; + throw err; + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)); + } + return checkParentPaths(src, srcStat, destParent, funcName); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8557,16 +8638,19 @@ var require_stat = __commonJS({ function isSrcSubdir(src, dest) { const srcArr = path.resolve(src).split(path.sep).filter((i) => i); const destArr = path.resolve(dest).split(path.sep).filter((i) => i); - return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); + return srcArr.every((cur, i) => destArr[i] === cur); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - checkPaths, + // checkPaths + checkPaths: u(checkPaths), checkPathsSync, - checkParentPaths, + // checkParent + checkParentPaths: u(checkParentPaths), checkParentPathsSync, + // Misc isSrcSubdir, areIdentical }; @@ -8577,22 +8661,16 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var mkdirs = require_mkdirs().mkdirs; - var pathExists = require_path_exists().pathExists; - var utimesMillis = require_utimes().utimesMillis; + var { mkdirs } = require_mkdirs(); + var { pathExists } = require_path_exists(); + var { utimesMillis } = require_utimes(); var stat = require_stat(); - function copy(src, dest, opts, cb) { - if (typeof opts === "function" && !cb) { - cb = opts; - opts = {}; - } else if (typeof opts === "function") { + async function copy(src, dest, opts = {}) { + if (typeof opts === "function") { opts = { filter: opts }; } - cb = cb || function() { - }; - opts = opts || {}; opts.clobber = "clobber" in opts ? !!opts.clobber : true; opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber; if (opts.preserveTimestamps && process.arch === "ia32") { @@ -8602,204 +8680,111 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - stat.checkPaths(src, dest, "copy", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, destStat } = stats; - stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => { - if (err2) - return cb(err2); - runFilter(src, dest, opts, (err3, include) => { - if (err3) - return cb(err3); - if (!include) - return cb(); - checkParentDir(destStat, src, dest, opts, cb); - }); - }); - }); - } - function checkParentDir(destStat, src, dest, opts, cb) { + const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts); + await stat.checkParentPaths(src, srcStat, dest, "copy"); + const include = await runFilter(src, dest, opts); + if (!include) + return; const destParent = path.dirname(dest); - pathExists(destParent, (err, dirExists) => { - if (err) - return cb(err); - if (dirExists) - return getStats(destStat, src, dest, opts, cb); - mkdirs(destParent, (err2) => { - if (err2) - return cb(err2); - return getStats(destStat, src, dest, opts, cb); - }); - }); + const dirExists = await pathExists(destParent); + if (!dirExists) { + await mkdirs(destParent); + } + await getStatsAndPerformCopy(destStat, src, dest, opts); } - function runFilter(src, dest, opts, cb) { + async function runFilter(src, dest, opts) { if (!opts.filter) - return cb(null, true); - Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); + return true; + return opts.filter(src, dest); } - function getStats(destStat, src, dest, opts, cb) { - const stat2 = opts.dereference ? fs.stat : fs.lstat; - stat2(src, (err, srcStat) => { - if (err) - return cb(err); - if (srcStat.isDirectory()) - return onDir(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) - return onFile(srcStat, destStat, src, dest, opts, cb); - else if (srcStat.isSymbolicLink()) - return onLink(destStat, src, dest, opts, cb); - else if (srcStat.isSocket()) - return cb(new Error(`Cannot copy a socket file: ${src}`)); - else if (srcStat.isFIFO()) - return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)); - return cb(new Error(`Unknown file: ${src}`)); - }); + async function getStatsAndPerformCopy(destStat, src, dest, opts) { + const statFn = opts.dereference ? fs.stat : fs.lstat; + const srcStat = await statFn(src); + if (srcStat.isDirectory()) + return onDir(srcStat, destStat, src, dest, opts); + if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) + return onFile(srcStat, destStat, src, dest, opts); + if (srcStat.isSymbolicLink()) + return onLink(destStat, src, dest, opts); + if (srcStat.isSocket()) + throw new Error(`Cannot copy a socket file: ${src}`); + if (srcStat.isFIFO()) + throw new Error(`Cannot copy a FIFO pipe: ${src}`); + throw new Error(`Unknown file: ${src}`); } - function onFile(srcStat, destStat, src, dest, opts, cb) { + async function onFile(srcStat, destStat, src, dest, opts) { if (!destStat) - return copyFile(srcStat, src, dest, opts, cb); - return mayCopyFile(srcStat, src, dest, opts, cb); - } - function mayCopyFile(srcStat, src, dest, opts, cb) { + return copyFile(srcStat, src, dest, opts); if (opts.overwrite) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return copyFile(srcStat, src, dest, opts, cb); - }); - } else if (opts.errorOnExist) { - return cb(new Error(`'${dest}' already exists`)); - } else - return cb(); - } - function copyFile(srcStat, src, dest, opts, cb) { - fs.copyFile(src, dest, (err) => { - if (err) - return cb(err); - if (opts.preserveTimestamps) - return handleTimestampsAndMode(srcStat.mode, src, dest, cb); - return setDestMode(dest, srcStat.mode, cb); - }); + await fs.unlink(dest); + return copyFile(srcStat, src, dest, opts); + } + if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`); + } } - function handleTimestampsAndMode(srcMode, src, dest, cb) { - if (fileIsNotWritable(srcMode)) { - return makeFileWritable(dest, srcMode, (err) => { - if (err) - return cb(err); - return setDestTimestampsAndMode(srcMode, src, dest, cb); - }); + async function copyFile(srcStat, src, dest, opts) { + await fs.copyFile(src, dest); + if (opts.preserveTimestamps) { + if (fileIsNotWritable(srcStat.mode)) { + await makeFileWritable(dest, srcStat.mode); + } + const updatedSrcStat = await fs.stat(src); + await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime); } - return setDestTimestampsAndMode(srcMode, src, dest, cb); + return fs.chmod(dest, srcStat.mode); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode, cb) { - return setDestMode(dest, srcMode | 128, cb); - } - function setDestTimestampsAndMode(srcMode, src, dest, cb) { - setDestTimestamps(src, dest, (err) => { - if (err) - return cb(err); - return setDestMode(dest, srcMode, cb); - }); - } - function setDestMode(dest, srcMode, cb) { - return fs.chmod(dest, srcMode, cb); - } - function setDestTimestamps(src, dest, cb) { - fs.stat(src, (err, updatedSrcStat) => { - if (err) - return cb(err); - return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb); - }); - } - function onDir(srcStat, destStat, src, dest, opts, cb) { - if (!destStat) - return mkDirAndCopy(srcStat.mode, src, dest, opts, cb); - return copyDir(src, dest, opts, cb); - } - function mkDirAndCopy(srcMode, src, dest, opts, cb) { - fs.mkdir(dest, (err) => { - if (err) - return cb(err); - copyDir(src, dest, opts, (err2) => { - if (err2) - return cb(err2); - return setDestMode(dest, srcMode, cb); - }); - }); - } - function copyDir(src, dest, opts, cb) { - fs.readdir(src, (err, items) => { - if (err) - return cb(err); - return copyDirItems(items, src, dest, opts, cb); - }); - } - function copyDirItems(items, src, dest, opts, cb) { - const item = items.pop(); - if (!item) - return cb(); - return copyDirItem(items, item, src, dest, opts, cb); + function makeFileWritable(dest, srcMode) { + return fs.chmod(dest, srcMode | 128); } - function copyDirItem(items, item, src, dest, opts, cb) { - const srcItem = path.join(src, item); - const destItem = path.join(dest, item); - runFilter(srcItem, destItem, opts, (err, include) => { - if (err) - return cb(err); + async function onDir(srcStat, destStat, src, dest, opts) { + if (!destStat) { + await fs.mkdir(dest); + } + const items = await fs.readdir(src); + await Promise.all(items.map(async (item) => { + const srcItem = path.join(src, item); + const destItem = path.join(dest, item); + const include = await runFilter(srcItem, destItem, opts); if (!include) - return copyDirItems(items, src, dest, opts, cb); - stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => { - if (err2) - return cb(err2); - const { destStat } = stats; - getStats(destStat, srcItem, destItem, opts, (err3) => { - if (err3) - return cb(err3); - return copyDirItems(items, src, dest, opts, cb); - }); - }); - }); - } - function onLink(destStat, src, dest, opts, cb) { - fs.readlink(src, (err, resolvedSrc) => { - if (err) - return cb(err); - if (opts.dereference) { - resolvedSrc = path.resolve(process.cwd(), resolvedSrc); - } - if (!destStat) { - return fs.symlink(resolvedSrc, dest, cb); - } else { - fs.readlink(dest, (err2, resolvedDest) => { - if (err2) { - if (err2.code === "EINVAL" || err2.code === "UNKNOWN") - return fs.symlink(resolvedSrc, dest, cb); - return cb(err2); - } - if (opts.dereference) { - resolvedDest = path.resolve(process.cwd(), resolvedDest); - } - if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { - return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)); - } - if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { - return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)); - } - return copyLink(resolvedSrc, dest, cb); - }); - } - }); + return; + const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts); + return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts); + })); + if (!destStat) { + await fs.chmod(dest, srcStat.mode); + } } - function copyLink(resolvedSrc, dest, cb) { - fs.unlink(dest, (err) => { - if (err) - return cb(err); - return fs.symlink(resolvedSrc, dest, cb); - }); + async function onLink(destStat, src, dest, opts) { + let resolvedSrc = await fs.readlink(src); + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc); + } + if (!destStat) { + return fs.symlink(resolvedSrc, dest); + } + let resolvedDest = null; + try { + resolvedDest = await fs.readlink(dest); + } catch (e) { + if (e.code === "EINVAL" || e.code === "UNKNOWN") + return fs.symlink(resolvedSrc, dest); + throw e; + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest); + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`); + } + if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`); + } + await fs.unlink(dest); + return fs.symlink(resolvedSrc, dest); } module2.exports = copy; } @@ -8950,7 +8935,7 @@ var require_copy_sync = __commonJS({ var require_copy2 = __commonJS({ "node_modules/fs-extra/lib/copy/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9020,43 +9005,36 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - function createFile(file, callback) { - function makeFile() { - fs.writeFile(file, "", (err) => { - if (err) - return callback(err); - callback(); - }); + async function createFile(file) { + let stats; + try { + stats = await fs.stat(file); + } catch { + } + if (stats && stats.isFile()) + return; + const dir = path.dirname(file); + let dirStats = null; + try { + dirStats = await fs.stat(dir); + } catch (err) { + if (err.code === "ENOENT") { + await mkdir.mkdirs(dir); + await fs.writeFile(file, ""); + return; + } else { + throw err; + } + } + if (dirStats.isDirectory()) { + await fs.writeFile(file, ""); + } else { + await fs.readdir(dir); } - fs.stat(file, (err, stats) => { - if (!err && stats.isFile()) - return callback(); - const dir = path.dirname(file); - fs.stat(dir, (err2, stats2) => { - if (err2) { - if (err2.code === "ENOENT") { - return mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeFile(); - }); - } - return callback(err2); - } - if (stats2.isDirectory()) - makeFile(); - else { - fs.readdir(dir, (err3) => { - if (err3) - return callback(err3); - }); - } - }); - }); } function createFileSync(file) { let stats; @@ -9090,42 +9068,33 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); - var fs = require_graceful_fs(); + var fs = require_fs(); var mkdir = require_mkdirs(); - var pathExists = require_path_exists().pathExists; + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createLink(srcpath, dstpath, callback) { - function makeLink(srcpath2, dstpath2) { - fs.link(srcpath2, dstpath2, (err) => { - if (err) - return callback(err); - callback(null); - }); + async function createLink(srcpath, dstpath) { + let dstStat; + try { + dstStat = await fs.lstat(dstpath); + } catch { } - fs.lstat(dstpath, (_, dstStat) => { - fs.lstat(srcpath, (err, srcStat) => { - if (err) { - err.message = err.message.replace("lstat", "ensureLink"); - return callback(err); - } - if (dstStat && areIdentical(srcStat, dstStat)) - return callback(null); - const dir = path.dirname(dstpath); - pathExists(dir, (err2, dirExists) => { - if (err2) - return callback(err2); - if (dirExists) - return makeLink(srcpath, dstpath); - mkdir.mkdirs(dir, (err3) => { - if (err3) - return callback(err3); - makeLink(srcpath, dstpath); - }); - }); - }); - }); + let srcStat; + try { + srcStat = await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureLink"); + throw err; + } + if (dstStat && areIdentical(srcStat, dstStat)) + return; + const dir = path.dirname(dstpath); + const dirExists = await pathExists(dir); + if (!dirExists) { + await mkdir.mkdirs(dir); + } + await fs.link(srcpath, dstpath); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9160,78 +9129,71 @@ var require_symlink_paths = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) { "use strict"; var path = require("path"); - var fs = require_graceful_fs(); - var pathExists = require_path_exists().pathExists; - function symlinkPaths(srcpath, dstpath, callback) { + var fs = require_fs(); + var { pathExists } = require_path_exists(); + var u = require_universalify().fromPromise; + async function symlinkPaths(srcpath, dstpath) { if (path.isAbsolute(srcpath)) { - return fs.lstat(srcpath, (err) => { - if (err) { - err.message = err.message.replace("lstat", "ensureSymlink"); - return callback(err); - } - return callback(null, { - toCwd: srcpath, - toDst: srcpath - }); - }); - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - return pathExists(relativeToDst, (err, exists) => { - if (err) - return callback(err); - if (exists) { - return callback(null, { - toCwd: relativeToDst, - toDst: srcpath - }); - } else { - return fs.lstat(srcpath, (err2) => { - if (err2) { - err2.message = err2.message.replace("lstat", "ensureSymlink"); - return callback(err2); - } - return callback(null, { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }); - }); - } - }); + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: srcpath + }; } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = await pathExists(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + try { + await fs.lstat(srcpath); + } catch (err) { + err.message = err.message.replace("lstat", "ensureSymlink"); + throw err; + } + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } function symlinkPathsSync(srcpath, dstpath) { - let exists; if (path.isAbsolute(srcpath)) { - exists = fs.existsSync(srcpath); - if (!exists) + const exists2 = fs.existsSync(srcpath); + if (!exists2) throw new Error("absolute srcpath does not exist"); return { toCwd: srcpath, toDst: srcpath }; - } else { - const dstdir = path.dirname(dstpath); - const relativeToDst = path.join(dstdir, srcpath); - exists = fs.existsSync(relativeToDst); - if (exists) { - return { - toCwd: relativeToDst, - toDst: srcpath - }; - } else { - exists = fs.existsSync(srcpath); - if (!exists) - throw new Error("relative srcpath does not exist"); - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; - } } + const dstdir = path.dirname(dstpath); + const relativeToDst = path.join(dstdir, srcpath); + const exists = fs.existsSync(relativeToDst); + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + }; + } + const srcExists = fs.existsSync(srcpath); + if (!srcExists) + throw new Error("relative srcpath does not exist"); + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }; } module2.exports = { - symlinkPaths, + symlinkPaths: u(symlinkPaths), symlinkPathsSync }; } @@ -9241,23 +9203,23 @@ var require_symlink_paths = __commonJS({ var require_symlink_type = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); - function symlinkType(srcpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; + var fs = require_fs(); + var u = require_universalify().fromPromise; + async function symlinkType(srcpath, type) { if (type) - return callback(null, type); - fs.lstat(srcpath, (err, stats) => { - if (err) - return callback(null, "file"); - type = stats && stats.isDirectory() ? "dir" : "file"; - callback(null, type); - }); + return type; + let stats; + try { + stats = await fs.lstat(srcpath); + } catch { + return "file"; + } + return stats && stats.isDirectory() ? "dir" : "file"; } function symlinkTypeSync(srcpath, type) { - let stats; if (type) return type; + let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9266,7 +9228,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType, + symlinkType: u(symlinkType), symlinkTypeSync }; } @@ -9276,59 +9238,36 @@ var require_symlink_type = __commonJS({ var require_symlink = __commonJS({ "node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; var path = require("path"); var fs = require_fs(); - var _mkdirs = require_mkdirs(); - var mkdirs = _mkdirs.mkdirs; - var mkdirsSync = _mkdirs.mkdirsSync; - var _symlinkPaths = require_symlink_paths(); - var symlinkPaths = _symlinkPaths.symlinkPaths; - var symlinkPathsSync = _symlinkPaths.symlinkPathsSync; - var _symlinkType = require_symlink_type(); - var symlinkType = _symlinkType.symlinkType; - var symlinkTypeSync = _symlinkType.symlinkTypeSync; - var pathExists = require_path_exists().pathExists; + var { mkdirs, mkdirsSync } = require_mkdirs(); + var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); + var { symlinkType, symlinkTypeSync } = require_symlink_type(); + var { pathExists } = require_path_exists(); var { areIdentical } = require_stat(); - function createSymlink(srcpath, dstpath, type, callback) { - callback = typeof type === "function" ? type : callback; - type = typeof type === "function" ? false : type; - fs.lstat(dstpath, (err, stats) => { - if (!err && stats.isSymbolicLink()) { - Promise.all([ - fs.stat(srcpath), - fs.stat(dstpath) - ]).then(([srcStat, dstStat]) => { - if (areIdentical(srcStat, dstStat)) - return callback(null); - _createSymlink(srcpath, dstpath, type, callback); - }); - } else - _createSymlink(srcpath, dstpath, type, callback); - }); - } - function _createSymlink(srcpath, dstpath, type, callback) { - symlinkPaths(srcpath, dstpath, (err, relative) => { - if (err) - return callback(err); - srcpath = relative.toDst; - symlinkType(relative.toCwd, type, (err2, type2) => { - if (err2) - return callback(err2); - const dir = path.dirname(dstpath); - pathExists(dir, (err3, dirExists) => { - if (err3) - return callback(err3); - if (dirExists) - return fs.symlink(srcpath, dstpath, type2, callback); - mkdirs(dir, (err4) => { - if (err4) - return callback(err4); - fs.symlink(srcpath, dstpath, type2, callback); - }); - }); - }); - }); + async function createSymlink(srcpath, dstpath, type) { + let stats; + try { + stats = await fs.lstat(dstpath); + } catch { + } + if (stats && stats.isSymbolicLink()) { + const [srcStat, dstStat] = await Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]); + if (areIdentical(srcStat, dstStat)) + return; + } + const relative = await symlinkPaths(srcpath, dstpath); + srcpath = relative.toDst; + const toType = await symlinkType(relative.toCwd, type); + const dir = path.dirname(dstpath); + if (!await pathExists(dir)) { + await mkdirs(dir); + } + return fs.symlink(srcpath, dstpath, toType); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9495,35 +9434,23 @@ var require_jsonfile2 = __commonJS({ var require_output_file = __commonJS({ "node_modules/fs-extra/lib/output-file/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; - var fs = require_graceful_fs(); + var u = require_universalify().fromPromise; + var fs = require_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - function outputFile(file, data, encoding, callback) { - if (typeof encoding === "function") { - callback = encoding; - encoding = "utf8"; - } + async function outputFile(file, data, encoding = "utf-8") { const dir = path.dirname(file); - pathExists(dir, (err, itDoes) => { - if (err) - return callback(err); - if (itDoes) - return fs.writeFile(file, data, encoding, callback); - mkdir.mkdirs(dir, (err2) => { - if (err2) - return callback(err2); - fs.writeFile(file, data, encoding, callback); - }); - }); + if (!await pathExists(dir)) { + await mkdir.mkdirs(dir); + } + return fs.writeFile(file, data, encoding); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (fs.existsSync(dir)) { - return fs.writeFileSync(file, ...args); + if (!fs.existsSync(dir)) { + mkdir.mkdirsSync(dir); } - mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9583,80 +9510,49 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_graceful_fs(); + var fs = require_fs(); var path = require("path"); - var copy = require_copy2().copy; - var remove = require_remove().remove; - var mkdirp = require_mkdirs().mkdirp; - var pathExists = require_path_exists().pathExists; + var { copy } = require_copy2(); + var { remove } = require_remove(); + var { mkdirp } = require_mkdirs(); + var { pathExists } = require_path_exists(); var stat = require_stat(); - function move(src, dest, opts, cb) { - if (typeof opts === "function") { - cb = opts; - opts = {}; - } - opts = opts || {}; + async function move(src, dest, opts = {}) { const overwrite = opts.overwrite || opts.clobber || false; - stat.checkPaths(src, dest, "move", opts, (err, stats) => { - if (err) - return cb(err); - const { srcStat, isChangingCase = false } = stats; - stat.checkParentPaths(src, srcStat, dest, "move", (err2) => { - if (err2) - return cb(err2); - if (isParentRoot(dest)) - return doRename(src, dest, overwrite, isChangingCase, cb); - mkdirp(path.dirname(dest), (err3) => { - if (err3) - return cb(err3); - return doRename(src, dest, overwrite, isChangingCase, cb); - }); - }); - }); - } - function isParentRoot(dest) { - const parent = path.dirname(dest); - const parsedPath = path.parse(parent); - return parsedPath.root === parent; - } - function doRename(src, dest, overwrite, isChangingCase, cb) { - if (isChangingCase) - return rename(src, dest, overwrite, cb); - if (overwrite) { - return remove(dest, (err) => { - if (err) - return cb(err); - return rename(src, dest, overwrite, cb); - }); + const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts); + await stat.checkParentPaths(src, srcStat, dest, "move"); + const destParent = path.dirname(dest); + const parsedParentPath = path.parse(destParent); + if (parsedParentPath.root !== destParent) { + await mkdirp(destParent); } - pathExists(dest, (err, destExists) => { - if (err) - return cb(err); - if (destExists) - return cb(new Error("dest already exists.")); - return rename(src, dest, overwrite, cb); - }); + return doRename(src, dest, overwrite, isChangingCase); } - function rename(src, dest, overwrite, cb) { - fs.rename(src, dest, (err) => { - if (!err) - return cb(); - if (err.code !== "EXDEV") - return cb(err); - return moveAcrossDevice(src, dest, overwrite, cb); - }); + async function doRename(src, dest, overwrite, isChangingCase) { + if (!isChangingCase) { + if (overwrite) { + await remove(dest); + } else if (await pathExists(dest)) { + throw new Error("dest already exists."); + } + } + try { + await fs.rename(src, dest); + } catch (err) { + if (err.code !== "EXDEV") { + throw err; + } + await moveAcrossDevice(src, dest, overwrite); + } } - function moveAcrossDevice(src, dest, overwrite, cb) { + async function moveAcrossDevice(src, dest, overwrite) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - copy(src, dest, opts, (err) => { - if (err) - return cb(err); - return remove(src, cb); - }); + await copy(src, dest, opts); + return remove(src); } module2.exports = move; } @@ -9723,7 +9619,7 @@ var require_move_sync = __commonJS({ var require_move2 = __commonJS({ "node_modules/fs-extra/lib/move/index.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromCallback; + var u = require_universalify().fromPromise; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9785,7 +9681,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs(); + var glob = require_commonjs4(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -9793,8 +9689,8 @@ var require_checkSolution = __commonJS({ var authenticate_1 = require_authenticate(); var fs_extra_1 = require_lib(); function checkSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const validator = new InputValidator_1.InputValidator(host); @@ -10145,12 +10041,14 @@ var require_createEnvironment = __commonJS({ const validator = new InputValidator_1.InputValidator(host); validator.pushInput(pacArgs, "--name", parameters.environmentName); validator.pushInput(pacArgs, "--type", parameters.environmentType); + validator.pushInput(pacArgs, "--user", parameters.user); validator.pushInput(pacArgs, "--templates", parameters.templates); validator.pushInput(pacArgs, "--region", parameters.region, InputValidator_1.normalizeRegion); validator.pushInput(pacArgs, "--currency", parameters.currency); validator.pushInput(pacArgs, "--language", parameters.language, InputValidator_1.normalizeLanguage); validator.pushInput(pacArgs, "--domain", parameters.domainName); validator.pushInput(pacArgs, "--team-id", parameters.teamId); + validator.pushInput(pacArgs, "--security-group-id", parameters.securityGroupId); validator.pushCommon(pacArgs, parameters); logger.log("Calling pac cli inputs: " + pacArgs.join(" ")); const pacResult = yield pac(...pacArgs); @@ -10219,8 +10117,8 @@ var require_restoreEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function restoreEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10452,8 +10350,8 @@ var require_unpackSolution = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var solutionPackagingBase_1 = require_solutionPackagingBase(); function unpackSolution(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10519,8 +10417,8 @@ var require_resetEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function resetEnvironment(parameters, runnerParameters, host) { - var _a, _b; return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -10598,8 +10496,8 @@ var require_copyEnvironment = __commonJS({ var createPacRunner_1 = require_createPacRunner(); var createEnvironment_1 = require_createEnvironment(); function copyEnvironment(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); try { @@ -11133,8 +11031,8 @@ var require_addSolutionComponent = __commonJS({ var authenticate_1 = require_authenticate(); var createPacRunner_1 = require_createPacRunner(); function addSolutionComponent(parameters, runnerParameters, host) { - var _a; return __awaiter2(this, void 0, void 0, function* () { + var _a; const logger = runnerParameters.logger; const pac = (0, createPacRunner_1.default)(runnerParameters); const pacArgs = ["solution", "add-solution-component"]; @@ -13465,7 +13363,7 @@ var require_oidc_utils = __commonJS({ Error Code : ${error.statusCode} - Error Message: ${error.result.message}`); + Error Message: ${error.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; if (!id_token) { @@ -14211,56 +14109,56 @@ var require_package = __commonJS({ devDependencies: { "@types/async": "^3.2.24", "@types/chai": "^4.3.6", - "@types/fancy-log": "^2.0.0", - "@types/fs-extra": "^11.0.1", + "@types/fancy-log": "^2.0.2", + "@types/fs-extra": "^11.0.4", "@types/glob": "^8.1.0", - "@types/js-yaml": "^4.0.7", - "@types/mocha": "^10.0.1", - "@types/node": "^20.4.8", + "@types/js-yaml": "^4.0.9", + "@types/mocha": "^10.0.6", + "@types/node": "^20.12.7", "@types/sinon": "^10.0.15", - "@types/sinon-chai": "^3.2.9", - "@types/unzip-stream": "^0.3.1", - "@types/uuid": "^9.0.2", - "@types/yargs": "^17.0.24", + "@types/sinon-chai": "^3.2.12", + "@types/unzip-stream": "^0.3.4", + "@types/uuid": "^9.0.8", + "@types/yargs": "^17.0.32", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", async: "^3.2.5", - chai: "^4.3.8", - dotenv: "^16.3.1", - esbuild: "^0.19.3", + chai: "^4.4.1", + dotenv: "^16.4.5", + esbuild: "^0.20.2", eslint: "^8.49.0", "fancy-log": "^2.0.0", - glob: "^10.3.4", + glob: "^10.3.12", "glob-parent": "^6.0.2", - gulp: "^4.0.2", - "gulp-eslint-new": "^1.8.3", + gulp: "^5.0.0", + "gulp-eslint-new": "^2.0.0", "gulp-mocha": "^8.0.0", "gulp-sourcemaps": "^3.0.0", "gulp-typescript": "^6.0.0-alpha.1", - mocha: "^10.2.0", + mocha: "^10.4.0", "node-fetch": "^3.3.2", - postcss: "^8.4.31", + postcss: "^8.4.38", "ps-list": "^8.1.1", rewiremock: "^3.14.5", sinon: "^15.2.0", "sinon-chai": "^3.5.0", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "ts-sinon": "^2.0.1", typescript: "^5.1.6", - "unzip-stream": "^0.3.1", - winston: "^3.10.0", + "unzip-stream": "^0.3.4", + winston: "^3.13.0", yargs: "^17.7.2" }, dependencies: { "@actions/artifact": "^1.1.1", - "@actions/core": "^1.10.0", + "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.118", - "date-fns": "^2.30.0", - "fs-extra": "^11.1.1", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", + "date-fns": "^3.6.0", + "fs-extra": "^11.2.0", "js-yaml": "^4.1", - uuid: "^9.0.0" + uuid: "^9.0.1" } }; } @@ -15661,7 +15559,7 @@ var require_unzip_stream = __commonJS({ UnzipStream.prototype._prepareOutStream = function(vars, entry) { var self = this; var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -15716,7 +15614,7 @@ var require_unzip_stream = __commonJS({ var message = isEncrypted ? "Encrypted files are not supported!" : "Zip version " + Math.floor(vars.versionsNeededToExtract / 10) + "." + vars.versionsNeededToExtract % 10 + " is not supported"; entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; diff --git a/package-lock.json b/package-lock.json index fc55e48f..3ebb3dd2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.120", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", "date-fns": "^3.6.0", "fs-extra": "^11.2.0", "js-yaml": "^4.1", @@ -842,9 +842,10 @@ } }, "node_modules/@microsoft/powerplatform-cli-wrapper": { - "version": "0.1.120", - "resolved": "https://npm.pkg.github.com/download/@microsoft/powerplatform-cli-wrapper/0.1.120/6b6620bf13e829db7d5ee24bb61e2d020ac29d54", - "integrity": "sha512-bjRYLrUB5GHtwnflArvGTSp3pw3iG/K6Iv/kBRFOdKoOu0GyCCFkiL3Qp8zg8jbuYhngxwu8L3hlwZzJGnMncg==", + "version": "0.1.121", + "resolved": "https://npm.pkg.github.com/download/@microsoft/powerplatform-cli-wrapper/0.1.121/2f2b1c03aafddbaf481c3c5a03f37d16fa6bb57a", + "integrity": "sha512-t/Qb0TKcznerlpnrC/uWKalsnw6+OJvdEsA+SrW7+ZuRgnQZV6qmmPZPNK+SGua4Ow+9u3x4RE3jB57HiGnd7g==", + "license": "MIT", "dependencies": { "fs-extra": "^11.1.1", "glob": "^10.3.10" @@ -8421,9 +8422,9 @@ } }, "@microsoft/powerplatform-cli-wrapper": { - "version": "0.1.120", - "resolved": "https://npm.pkg.github.com/download/@microsoft/powerplatform-cli-wrapper/0.1.120/6b6620bf13e829db7d5ee24bb61e2d020ac29d54", - "integrity": "sha512-bjRYLrUB5GHtwnflArvGTSp3pw3iG/K6Iv/kBRFOdKoOu0GyCCFkiL3Qp8zg8jbuYhngxwu8L3hlwZzJGnMncg==", + "version": "0.1.121", + "resolved": "https://npm.pkg.github.com/download/@microsoft/powerplatform-cli-wrapper/0.1.121/2f2b1c03aafddbaf481c3c5a03f37d16fa6bb57a", + "integrity": "sha512-t/Qb0TKcznerlpnrC/uWKalsnw6+OJvdEsA+SrW7+ZuRgnQZV6qmmPZPNK+SGua4Ow+9u3x4RE3jB57HiGnd7g==", "requires": { "fs-extra": "^11.1.1", "glob": "^10.3.10" diff --git a/package.json b/package.json index 164fde84..6bf57a31 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", "@actions/io": "^1.1.3", - "@microsoft/powerplatform-cli-wrapper": "^0.1.120", + "@microsoft/powerplatform-cli-wrapper": "^0.1.121", "date-fns": "^3.6.0", "fs-extra": "^11.2.0", "js-yaml": "^4.1", diff --git a/src/actions/create-environment/index.ts b/src/actions/create-environment/index.ts index 63006de2..edceb10b 100644 --- a/src/actions/create-environment/index.ts +++ b/src/actions/create-environment/index.ts @@ -26,6 +26,7 @@ export async function main(): Promise { credentials: getCredentials(), environmentName: parameterMap['name'], environmentType: parameterMap['type'], + user: parameterMap['user'], region: parameterMap['region'], currency: parameterMap['currency'], language: parameterMap['language'], diff --git a/src/test/createEnvironment.test.ts b/src/test/createEnvironment.test.ts index 37f99934..a22c4d2d 100644 --- a/src/test/createEnvironment.test.ts +++ b/src/test/createEnvironment.test.ts @@ -42,6 +42,7 @@ describe("create-environment tests", () => { credentials: credentials, environmentName: { name: 'name', required: true, defaultValue: undefined }, environmentType: { name: 'type', required: true, defaultValue: 'Sandbox' }, + user: { name: 'user', required: false, defaultValue: undefined }, region: { name: 'region', required: true, defaultValue: 'unitedstates' }, currency: { name: 'currency', required: false, defaultValue: 'USD' }, language: { name: 'language', required: false, defaultValue: 'English (United States)' },