From a3bdfea80f17ed1523d9a2edcf5f7151bbd37011 Mon Sep 17 00:00:00 2001 From: Crash Collison <3751389+tehcrashxor@users.noreply.github.com> Date: Mon, 13 May 2024 16:45:54 -0700 Subject: [PATCH] PoC: Federated SPN credentials (#540) --- .../workflows/rolling-instance-actions.yml | 10 + dist/actions/add-solution-component/index.js | 1000 +- dist/actions/assign-group/index.js | 1000 +- dist/actions/assign-user/index.js | 1000 +- dist/actions/backup-environment/index.js | 1000 +- dist/actions/branch-solution/index.js | 20456 +++++++++------- dist/actions/catalog-status/index.js | 1000 +- dist/actions/check-solution/index.js | 1000 +- dist/actions/clone-solution/index.js | 1000 +- dist/actions/copy-environment/index.js | 1000 +- dist/actions/create-environment/index.js | 1000 +- dist/actions/delete-environment/index.js | 1000 +- dist/actions/delete-solution/index.js | 1000 +- dist/actions/deploy-package/index.js | 1000 +- dist/actions/download-paportal/index.js | 1000 +- dist/actions/export-data/index.js | 1000 +- dist/actions/export-solution/index.js | 1000 +- dist/actions/import-data/index.js | 1000 +- dist/actions/import-solution/index.js | 1000 +- dist/actions/install-catalog/index.js | 1000 +- dist/actions/pack-solution/index.js | 982 +- dist/actions/publish-solution/index.js | 1000 +- dist/actions/reset-environment/index.js | 1000 +- dist/actions/restore-environment/index.js | 1000 +- .../set-online-solution-version/index.js | 1000 +- dist/actions/submit-catalog/index.js | 1000 +- dist/actions/unpack-solution/index.js | 982 +- dist/actions/update-solution-version/index.js | 982 +- dist/actions/upgrade-solution/index.js | 1000 +- dist/actions/upload-paportal/index.js | 1000 +- dist/actions/who-am-i/index.js | 1000 +- src/lib/auth/getCredentials.ts | 24 +- src/pacPackageInfo.json | 2 +- 33 files changed, 27792 insertions(+), 21646 deletions(-) diff --git a/.github/workflows/rolling-instance-actions.yml b/.github/workflows/rolling-instance-actions.yml index 0f86fafe..ca22b4a8 100644 --- a/.github/workflows/rolling-instance-actions.yml +++ b/.github/workflows/rolling-instance-actions.yml @@ -12,6 +12,9 @@ on: push: branches: [ main ] +permissions: + id-token: write # OIDC token for Workload Identity Federation + jobs: instance-actions: runs-on: ${{ matrix.os }} @@ -72,6 +75,13 @@ jobs: client-secret: ${{ secrets.CLIENT_SECRET_PPDEVTOOLS }} tenant-id: ${{ env.WF_TENANT_ID }} + - name: Test who-am-i action with appId + Workload Identity Federation + uses: ./who-am-i + with: + environment-url: ${{ steps.create-source-environment.outputs.environment-url }} + app-id: ${{ env.WF_APPID }} + tenant-id: ${{ env.WF_TENANT_ID }} + - name: Test who-am-i action with username/password uses: ./who-am-i with: diff --git a/dist/actions/add-solution-component/index.js b/dist/actions/add-solution-component/index.js index bccddf1e..e89b907d 100644 --- a/dist/actions/add-solution-component/index.js +++ b/dist/actions/add-solution-component/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/assign-group/index.js b/dist/actions/assign-group/index.js index 15549fde..0f9c6a93 100644 --- a/dist/actions/assign-group/index.js +++ b/dist/actions/assign-group/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/assign-user/index.js b/dist/actions/assign-user/index.js index d58868df..9888be1e 100644 --- a/dist/actions/assign-user/index.js +++ b/dist/actions/assign-user/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/backup-environment/index.js b/dist/actions/backup-environment/index.js index e73b9dec..a4d83969 100644 --- a/dist/actions/backup-environment/index.js +++ b/dist/actions/backup-environment/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/branch-solution/index.js b/dist/actions/branch-solution/index.js index b5ffc9a5..60dc0aa2 100644 --- a/dist/actions/branch-solution/index.js +++ b/dist/actions/branch-solution/index.js @@ -2544,261 +2544,362 @@ var require_lib2 = __commonJS({ } }); -// node_modules/date-fns/toDate.js -var require_toDate = __commonJS({ - "node_modules/date-fns/toDate.js"(exports2) { +// 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"; - 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); + 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) { + "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"); } } + module2.exports = exports2.default; } }); -// node_modules/date-fns/constructFrom.js -var require_constructFrom = __commonJS({ - "node_modules/date-fns/constructFrom.js"(exports2) { +// node_modules/date-fns/toDate/index.js +var require_toDate = __commonJS({ + "node_modules/date-fns/toDate/index.js"(exports2, module2) { "use strict"; - exports2.constructFrom = constructFrom; - function constructFrom(date, value) { - if (date instanceof Date) { - return new date.constructor(value); + 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); } else { - return new Date(value); + 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); } } + module2.exports = exports2.default; } }); -// node_modules/date-fns/addDays.js +// node_modules/date-fns/addDays/index.js var require_addDays = __commonJS({ - "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); + "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); + } 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.js +// node_modules/date-fns/addMonths/index.js var require_addMonths = __commonJS({ - "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); + "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); + } if (!amount) { - return _date; + return date; } - const dayOfMonth = _date.getDate(); - const endOfDesiredMonth = (0, _index2.constructFrom)(date, _date.getTime()); - endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); - const daysInMonth = endOfDesiredMonth.getDate(); + var dayOfMonth = date.getDate(); + var endOfDesiredMonth = new Date(date.getTime()); + endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0); + var 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.js +// node_modules/date-fns/add/index.js var require_add = __commonJS({ - "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 - ); + "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); return finalDate; } + module2.exports = exports2.default; } }); -// 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; +// 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSunday.js +// node_modules/date-fns/isSunday/index.js var require_isSunday = __commonJS({ - "node_modules/date-fns/isSunday.js"(exports2) { + "node_modules/date-fns/isSunday/index.js"(exports2, module2) { "use strict"; - exports2.isSunday = isSunday; - var _index = require_toDate(); - function isSunday(date) { - return (0, _index.toDate)(date).getDay() === 0; + 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isWeekend.js -var require_isWeekend = __commonJS({ - "node_modules/date-fns/isWeekend.js"(exports2) { +// node_modules/date-fns/isSaturday/index.js +var require_isSaturday = __commonJS({ + "node_modules/date-fns/isSaturday/index.js"(exports2, module2) { "use strict"; - exports2.isWeekend = isWeekend; - var _index = require_toDate(); - function isWeekend(date) { - const day = (0, _index.toDate)(date).getDay(); - return day === 0 || day === 6; + 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/addBusinessDays.js +// node_modules/date-fns/addBusinessDays/index.js var require_addBusinessDays = __commonJS({ - "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); + "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); if (isNaN(amount)) - 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); + 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); while (restDays > 0) { - _date.setDate(_date.getDate() + sign); - if (!(0, _index4.isWeekend)(_date)) + date.setDate(date.getDate() + sign); + if (!(0, _index.default)(date)) restDays -= 1; } - 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)); + 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)); } - _date.setHours(hours); - return _date; + date.setHours(hours); + return date; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/addMilliseconds.js +// node_modules/date-fns/addMilliseconds/index.js var require_addMilliseconds = __commonJS({ - "node_modules/date-fns/addMilliseconds.js"(exports2) { + "node_modules/date-fns/addMilliseconds/index.js"(exports2, module2) { "use strict"; - 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); + 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); } + module2.exports = exports2.default; } }); -// 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 +// node_modules/date-fns/addHours/index.js var require_addHours = __commonJS({ - "node_modules/date-fns/addHours.js"(exports2) { + "node_modules/date-fns/addHours/index.js"(exports2, module2) { "use strict"; - exports2.addHours = addHours; - var _index = require_addMilliseconds(); - var _index2 = require_constants(); - function addHours(date, amount) { - return (0, _index.addMilliseconds)(date, amount * _index2.millisecondsInHour); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/_lib/defaultOptions.js +// node_modules/date-fns/_lib/defaultOptions/index.js var require_defaultOptions = __commonJS({ - "node_modules/date-fns/_lib/defaultOptions.js"(exports2) { + "node_modules/date-fns/_lib/defaultOptions/index.js"(exports2) { "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); exports2.getDefaultOptions = getDefaultOptions; exports2.setDefaultOptions = setDefaultOptions; var defaultOptions = {}; @@ -2811,405 +2912,571 @@ var require_defaultOptions = __commonJS({ } }); -// node_modules/date-fns/startOfWeek.js +// node_modules/date-fns/startOfWeek/index.js var require_startOfWeek = __commonJS({ - "node_modules/date-fns/startOfWeek.js"(exports2) { + "node_modules/date-fns/startOfWeek/index.js"(exports2, module2) { "use strict"; - 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; + 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfISOWeek.js +// node_modules/date-fns/startOfISOWeek/index.js var require_startOfISOWeek = __commonJS({ - "node_modules/date-fns/startOfISOWeek.js"(exports2) { + "node_modules/date-fns/startOfISOWeek/index.js"(exports2, module2) { "use strict"; - exports2.startOfISOWeek = startOfISOWeek; - var _index = require_startOfWeek(); - function startOfISOWeek(date) { - return (0, _index.startOfWeek)(date, { weekStartsOn: 1 }); + 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 + }); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getISOWeekYear.js +// node_modules/date-fns/getISOWeekYear/index.js var require_getISOWeekYear = __commonJS({ - "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); + "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); fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); - const startOfNextYear = (0, _index2.startOfISOWeek)( - fourthOfJanuaryOfNextYear - ); - const fourthOfJanuaryOfThisYear = (0, _index.constructFrom)(date, 0); + var startOfNextYear = (0, _index2.default)(fourthOfJanuaryOfNextYear); + var fourthOfJanuaryOfThisYear = /* @__PURE__ */ new Date(0); fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); - const startOfThisYear = (0, _index2.startOfISOWeek)( - fourthOfJanuaryOfThisYear - ); - if (_date.getTime() >= startOfNextYear.getTime()) { + var startOfThisYear = (0, _index2.default)(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/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; +// 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +// node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js var require_getTimezoneOffsetInMilliseconds = __commonJS({ - "node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js"(exports2) { + "node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds/index.js"(exports2, module2) { "use strict"; - exports2.getTimezoneOffsetInMilliseconds = getTimezoneOffsetInMilliseconds; - var _index = require_toDate(); + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = getTimezoneOffsetInMilliseconds; function getTimezoneOffsetInMilliseconds(date) { - 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; + 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(); } + module2.exports = exports2.default; } }); -// 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 - ); +// 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; } + module2.exports = exports2.default; } }); -// 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); +// 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setISOWeekYear.js +// node_modules/date-fns/setISOWeekYear/index.js var require_setISOWeekYear = __commonJS({ - "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); + "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); fourthOfJanuary.setHours(0, 0, 0, 0); - _date = (0, _index3.startOfISOWeekYear)(fourthOfJanuary); - _date.setDate(_date.getDate() + diff); - return _date; + date = (0, _index3.default)(fourthOfJanuary); + date.setDate(date.getDate() + diff); + return date; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/addISOWeekYears.js +// node_modules/date-fns/addISOWeekYears/index.js var require_addISOWeekYears = __commonJS({ - "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 - ); + "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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/addMinutes.js +// node_modules/date-fns/addMinutes/index.js var require_addMinutes = __commonJS({ - "node_modules/date-fns/addMinutes.js"(exports2) { + "node_modules/date-fns/addMinutes/index.js"(exports2, module2) { "use strict"; - exports2.addMinutes = addMinutes; - var _index = require_addMilliseconds(); - var _index2 = require_constants(); - function addMinutes(date, amount) { - return (0, _index.addMilliseconds)( - date, - amount * _index2.millisecondsInMinute - ); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/addQuarters.js +// node_modules/date-fns/addQuarters/index.js var require_addQuarters = __commonJS({ - "node_modules/date-fns/addQuarters.js"(exports2) { + "node_modules/date-fns/addQuarters/index.js"(exports2, module2) { "use strict"; - exports2.addQuarters = addQuarters; - var _index = require_addMonths(); - function addQuarters(date, amount) { - const months = amount * 3; - return (0, _index.addMonths)(date, months); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/addSeconds.js +// node_modules/date-fns/addSeconds/index.js var require_addSeconds = __commonJS({ - "node_modules/date-fns/addSeconds.js"(exports2) { + "node_modules/date-fns/addSeconds/index.js"(exports2, module2) { "use strict"; - exports2.addSeconds = addSeconds; - var _index = require_addMilliseconds(); - function addSeconds(date, amount) { - return (0, _index.addMilliseconds)(date, amount * 1e3); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/addWeeks.js +// node_modules/date-fns/addWeeks/index.js var require_addWeeks = __commonJS({ - "node_modules/date-fns/addWeeks.js"(exports2) { + "node_modules/date-fns/addWeeks/index.js"(exports2, module2) { "use strict"; - exports2.addWeeks = addWeeks; - var _index = require_addDays(); - function addWeeks(date, amount) { - const days = amount * 7; - return (0, _index.addDays)(date, days); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/addYears.js +// node_modules/date-fns/addYears/index.js var require_addYears = __commonJS({ - "node_modules/date-fns/addYears.js"(exports2) { + "node_modules/date-fns/addYears/index.js"(exports2, module2) { "use strict"; - exports2.addYears = addYears; - var _index = require_addMonths(); - function addYears(date, amount) { - return (0, _index.addMonths)(date, amount * 12); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/areIntervalsOverlapping.js +// node_modules/date-fns/areIntervalsOverlapping/index.js var require_areIntervalsOverlapping = __commonJS({ - "node_modules/date-fns/areIntervalsOverlapping.js"(exports2) { + "node_modules/date-fns/areIntervalsOverlapping/index.js"(exports2, module2) { "use strict"; - exports2.areIntervalsOverlapping = areIntervalsOverlapping; - var _index = require_toDate(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = areIntervalsOverlapping; + var _index = _interopRequireDefault(require_toDate()); + var _index2 = _interopRequireDefault(require_requiredArgs()); function areIntervalsOverlapping(intervalLeft, intervalRight, options) { - 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) + (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) { return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime; + } return leftStartTime < rightEndTime && rightStartTime < leftEndTime; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/max.js +// node_modules/date-fns/max/index.js var require_max = __commonJS({ - "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); + "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); 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.js +// node_modules/date-fns/min/index.js var require_min = __commonJS({ - "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; + "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; } }); return result || /* @__PURE__ */ new Date(NaN); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/clamp.js +// node_modules/date-fns/clamp/index.js var require_clamp = __commonJS({ - "node_modules/date-fns/clamp.js"(exports2) { + "node_modules/date-fns/clamp/index.js"(exports2, module2) { "use strict"; - 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 - ]); + 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]); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/closestIndexTo.js +// node_modules/date-fns/closestIndexTo/index.js var require_closestIndexTo = __commonJS({ - "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))) + "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))) return NaN; - const timeToCompare = date.getTime(); - let result; - let minDistance; - dates.forEach(function(dirtyDate, index) { - const currentDate = (0, _index.toDate)(dirtyDate); + 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); if (isNaN(Number(currentDate))) { result = NaN; minDistance = NaN; return; } - const distance = Math.abs(timeToCompare - currentDate.getTime()); - if (result == null || distance < minDistance) { + var distance = Math.abs(timeToCompare - currentDate.getTime()); + if (result == null || distance < Number(minDistance)) { result = index; minDistance = distance; } }); return result; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/closestTo.js +// node_modules/date-fns/closestTo/index.js var require_closestTo = __commonJS({ - "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); + "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); if (isNaN(Number(currentDate))) { - result = (0, _index.constructFrom)(dateToCompare, NaN); + result = /* @__PURE__ */ new Date(NaN); minDistance = NaN; return; } - const distance = Math.abs(timeToCompare - currentDate.getTime()); - if (result == null || distance < minDistance) { + var distance = Math.abs(timeToCompare - currentDate.getTime()); + if (result == null || distance < Number(minDistance)) { result = currentDate; minDistance = distance; } }); return result; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/compareAsc.js +// node_modules/date-fns/compareAsc/index.js var require_compareAsc = __commonJS({ - "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(); + "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(); if (diff < 0) { return -1; } else if (diff > 0) { @@ -3218,19 +3485,26 @@ var require_compareAsc = __commonJS({ return diff; } } + module2.exports = exports2.default; } }); -// node_modules/date-fns/compareDesc.js +// node_modules/date-fns/compareDesc/index.js var require_compareDesc = __commonJS({ - "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(); + "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(); if (diff > 0) { return -1; } else if (diff < 0) { @@ -3239,246 +3513,351 @@ var require_compareDesc = __commonJS({ return diff; } } + module2.exports = exports2.default; } }); -// 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 +// 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 var require_daysToWeeks = __commonJS({ - "node_modules/date-fns/daysToWeeks.js"(exports2) { + "node_modules/date-fns/daysToWeeks/index.js"(exports2, module2) { "use strict"; - exports2.daysToWeeks = daysToWeeks; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = daysToWeeks; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function daysToWeeks(days) { - const weeks = days / _index.daysInWeek; - const result = Math.trunc(weeks); - return result === 0 ? 0 : result; + (0, _index.default)(1, arguments); + var weeks = days / _index2.daysInWeek; + return Math.floor(weeks); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameDay.js +// node_modules/date-fns/isSameDay/index.js var require_isSameDay = __commonJS({ - "node_modules/date-fns/isSameDay.js"(exports2) { + "node_modules/date-fns/isSameDay/index.js"(exports2, module2) { "use strict"; - 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; + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isDate.js +// node_modules/date-fns/isDate/index.js var require_isDate = __commonJS({ - "node_modules/date-fns/isDate.js"(exports2) { + "node_modules/date-fns/isDate/index.js"(exports2, module2) { "use strict"; - exports2.isDate = isDate; + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isDate; + var _typeof2 = _interopRequireDefault(require_typeof()); + var _index = _interopRequireDefault(require_requiredArgs()); function isDate(value) { - return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]"; + (0, _index.default)(1, arguments); + return value instanceof Date || (0, _typeof2.default)(value) === "object" && Object.prototype.toString.call(value) === "[object Date]"; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isValid.js +// node_modules/date-fns/isValid/index.js var require_isValid = __commonJS({ - "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") { + "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") { return false; } - const _date = (0, _index2.toDate)(date); - return !isNaN(Number(_date)); + var date = (0, _index2.default)(dirtyDate); + return !isNaN(Number(date)); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInBusinessDays.js +// node_modules/date-fns/differenceInBusinessDays/index.js var require_differenceInBusinessDays = __commonJS({ - "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)) + "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)) return NaN; - 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); + 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); } return result === 0 ? 0 : result; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarISOWeekYears.js +// node_modules/date-fns/differenceInCalendarISOWeekYears/index.js var require_differenceInCalendarISOWeekYears = __commonJS({ - "node_modules/date-fns/differenceInCalendarISOWeekYears.js"(exports2) { + "node_modules/date-fns/differenceInCalendarISOWeekYears/index.js"(exports2, module2) { "use strict"; - exports2.differenceInCalendarISOWeekYears = differenceInCalendarISOWeekYears; - var _index = require_getISOWeekYear(); - function differenceInCalendarISOWeekYears(dateLeft, dateRight) { - return (0, _index.getISOWeekYear)(dateLeft) - (0, _index.getISOWeekYear)(dateRight); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarISOWeeks.js +// node_modules/date-fns/differenceInCalendarISOWeeks/index.js var require_differenceInCalendarISOWeeks = __commonJS({ - "node_modules/date-fns/differenceInCalendarISOWeeks.js"(exports2) { + "node_modules/date-fns/differenceInCalendarISOWeeks/index.js"(exports2, module2) { "use strict"; - 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 - ); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarMonths.js +// node_modules/date-fns/differenceInCalendarMonths/index.js var require_differenceInCalendarMonths = __commonJS({ - "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(); + "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(); return yearDiff * 12 + monthDiff; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getQuarter.js +// node_modules/date-fns/getQuarter/index.js var require_getQuarter = __commonJS({ - "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; + "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; return quarter; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarQuarters.js +// node_modules/date-fns/differenceInCalendarQuarters/index.js var require_differenceInCalendarQuarters = __commonJS({ - "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); + "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); return yearDiff * 4 + quarterDiff; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarWeeks.js +// node_modules/date-fns/differenceInCalendarWeeks/index.js var require_differenceInCalendarWeeks = __commonJS({ - "node_modules/date-fns/differenceInCalendarWeeks.js"(exports2) { + "node_modules/date-fns/differenceInCalendarWeeks/index.js"(exports2, module2) { "use strict"; - 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 - ); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInCalendarYears.js +// node_modules/date-fns/differenceInCalendarYears/index.js var require_differenceInCalendarYears = __commonJS({ - "node_modules/date-fns/differenceInCalendarYears.js"(exports2) { + "node_modules/date-fns/differenceInCalendarYears/index.js"(exports2, module2) { "use strict"; - 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(); + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInDays.js +// node_modules/date-fns/differenceInDays/index.js var require_differenceInDays = __commonJS({ - "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; - } + "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()); function compareLocalAsc(dateLeft, dateRight) { - 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(); + 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(); if (diff < 0) { return -1; } else if (diff > 0) { @@ -3487,1592 +3866,1462 @@ 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/_lib/getRoundingMethod.js -var require_getRoundingMethod = __commonJS({ - "node_modules/date-fns/_lib/getRoundingMethod.js"(exports2) { +// node_modules/date-fns/differenceInMilliseconds/index.js +var require_differenceInMilliseconds = __commonJS({ + "node_modules/date-fns/differenceInMilliseconds/index.js"(exports2, module2) { "use strict"; - exports2.getRoundingMethod = getRoundingMethod; - function getRoundingMethod(method) { - return (number) => { - const round = method ? Math[method] : Math.trunc; - const result = round(number); - return result === 0 ? 0 : result; - }; + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInMilliseconds.js -var require_differenceInMilliseconds = __commonJS({ - "node_modules/date-fns/differenceInMilliseconds.js"(exports2) { +// node_modules/date-fns/_lib/roundingMethods/index.js +var require_roundingMethods = __commonJS({ + "node_modules/date-fns/_lib/roundingMethods/index.js"(exports2) { "use strict"; - exports2.differenceInMilliseconds = differenceInMilliseconds; - var _index = require_toDate(); - function differenceInMilliseconds(dateLeft, dateRight) { - return +(0, _index.toDate)(dateLeft) - +(0, _index.toDate)(dateRight); + 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]; } } }); -// node_modules/date-fns/differenceInHours.js +// node_modules/date-fns/differenceInHours/index.js var require_differenceInHours = __commonJS({ - "node_modules/date-fns/differenceInHours.js"(exports2) { + "node_modules/date-fns/differenceInHours/index.js"(exports2, module2) { "use strict"; - exports2.differenceInHours = differenceInHours; - var _index = require_getRoundingMethod(); - var _index2 = require_constants(); - var _index3 = require_differenceInMilliseconds(); + 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(); function differenceInHours(dateLeft, dateRight, options) { - const diff = (0, _index3.differenceInMilliseconds)(dateLeft, dateRight) / _index2.millisecondsInHour; - return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); + (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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/subISOWeekYears.js +// node_modules/date-fns/subISOWeekYears/index.js var require_subISOWeekYears = __commonJS({ - "node_modules/date-fns/subISOWeekYears.js"(exports2) { + "node_modules/date-fns/subISOWeekYears/index.js"(exports2, module2) { "use strict"; - exports2.subISOWeekYears = subISOWeekYears; - var _index = require_addISOWeekYears(); - function subISOWeekYears(date, amount) { - return (0, _index.addISOWeekYears)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInISOWeekYears.js +// node_modules/date-fns/differenceInISOWeekYears/index.js var require_differenceInISOWeekYears = __commonJS({ - "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); + "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); return result === 0 ? 0 : result; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInMinutes.js +// node_modules/date-fns/differenceInMinutes/index.js var require_differenceInMinutes = __commonJS({ - "node_modules/date-fns/differenceInMinutes.js"(exports2) { + "node_modules/date-fns/differenceInMinutes/index.js"(exports2, module2) { "use strict"; - exports2.differenceInMinutes = differenceInMinutes; - var _index = require_getRoundingMethod(); - var _index2 = require_constants(); - var _index3 = require_differenceInMilliseconds(); + 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(); function differenceInMinutes(dateLeft, dateRight, options) { - const diff = (0, _index3.differenceInMilliseconds)(dateLeft, dateRight) / _index2.millisecondsInMinute; - return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); + (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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfDay.js +// node_modules/date-fns/endOfDay/index.js var require_endOfDay = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfMonth.js +// node_modules/date-fns/endOfMonth/index.js var require_endOfMonth = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isLastDayOfMonth.js +// node_modules/date-fns/isLastDayOfMonth/index.js var require_isLastDayOfMonth = __commonJS({ - "node_modules/date-fns/isLastDayOfMonth.js"(exports2) { + "node_modules/date-fns/isLastDayOfMonth/index.js"(exports2, module2) { "use strict"; - 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); + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInMonths.js +// node_modules/date-fns/differenceInMonths/index.js var require_differenceInMonths = __commonJS({ - "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; + "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; 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); - let isLastMonthNotFull = (0, _index.compareAsc)(_dateLeft, _dateRight) === -sign; - if ((0, _index3.isLastDayOfMonth)((0, _index4.toDate)(dateLeft)) && difference === 1 && (0, _index.compareAsc)(dateLeft, _dateRight) === 1) { + 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) { isLastMonthNotFull = false; } result = sign * (difference - Number(isLastMonthNotFull)); } return result === 0 ? 0 : result; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInQuarters.js +// node_modules/date-fns/differenceInQuarters/index.js var require_differenceInQuarters = __commonJS({ - "node_modules/date-fns/differenceInQuarters.js"(exports2) { + "node_modules/date-fns/differenceInQuarters/index.js"(exports2, module2) { "use strict"; - exports2.differenceInQuarters = differenceInQuarters; - var _index = require_getRoundingMethod(); - var _index2 = require_differenceInMonths(); + 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(); function differenceInQuarters(dateLeft, dateRight, options) { - const diff = (0, _index2.differenceInMonths)(dateLeft, dateRight) / 3; - return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); + (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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInSeconds.js +// node_modules/date-fns/differenceInSeconds/index.js var require_differenceInSeconds = __commonJS({ - "node_modules/date-fns/differenceInSeconds.js"(exports2) { + "node_modules/date-fns/differenceInSeconds/index.js"(exports2, module2) { "use strict"; - exports2.differenceInSeconds = differenceInSeconds; - var _index = require_getRoundingMethod(); - var _index2 = require_differenceInMilliseconds(); + 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(); function differenceInSeconds(dateLeft, dateRight, options) { - const diff = (0, _index2.differenceInMilliseconds)(dateLeft, dateRight) / 1e3; - return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); + (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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInWeeks.js +// node_modules/date-fns/differenceInWeeks/index.js var require_differenceInWeeks = __commonJS({ - "node_modules/date-fns/differenceInWeeks.js"(exports2) { + "node_modules/date-fns/differenceInWeeks/index.js"(exports2, module2) { "use strict"; - exports2.differenceInWeeks = differenceInWeeks; - var _index = require_getRoundingMethod(); - var _index2 = require_differenceInDays(); + 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(); function differenceInWeeks(dateLeft, dateRight, options) { - const diff = (0, _index2.differenceInDays)(dateLeft, dateRight) / 7; - return (0, _index.getRoundingMethod)(options?.roundingMethod)(diff); + (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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/differenceInYears.js +// node_modules/date-fns/differenceInYears/index.js var require_differenceInYears = __commonJS({ - "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); + "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)); return result === 0 ? 0 : result; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/eachDayOfInterval.js +// node_modules/date-fns/eachDayOfInterval/index.js var require_eachDayOfInterval = __commonJS({ - "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; + "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; currentDate.setHours(0, 0, 0, 0); - 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)); + 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)); currentDate.setDate(currentDate.getDate() + step); currentDate.setHours(0, 0, 0, 0); } - return reversed ? dates.reverse() : dates; + return dates; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/eachHourOfInterval.js +// node_modules/date-fns/eachHourOfInterval/index.js var require_eachHourOfInterval = __commonJS({ - "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; + "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; currentDate.setMinutes(0, 0, 0); - 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); + 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); } - return reversed ? dates.reverse() : dates; + return dates; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfMinute.js +// node_modules/date-fns/startOfMinute/index.js var require_startOfMinute = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/eachMinuteOfInterval.js +// node_modules/date-fns/eachMinuteOfInterval/index.js var require_eachMinuteOfInterval = __commonJS({ - "node_modules/date-fns/eachMinuteOfInterval.js"(exports2) { + "node_modules/date-fns/eachMinuteOfInterval/index.js"(exports2, module2) { "use strict"; - exports2.eachMinuteOfInterval = eachMinuteOfInterval; - var _index = require_addMinutes(); - var _index2 = require_startOfMinute(); - var _index3 = require_toDate(); + 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()); function eachMinuteOfInterval(interval, options) { - 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 _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 dates = []; - while (+currentDate <= endTime) { - dates.push((0, _index3.toDate)(currentDate)); - currentDate = (0, _index.addMinutes)(currentDate, step); + 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); } - return reversed ? dates.reverse() : dates; + return dates; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/eachMonthOfInterval.js +// node_modules/date-fns/eachMonthOfInterval/index.js var require_eachMonthOfInterval = __commonJS({ - "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; + "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; currentDate.setHours(0, 0, 0, 0); currentDate.setDate(1); - let step = options?.step ?? 1; - if (!step) - return []; - if (step < 0) { - step = -step; - reversed = !reversed; + while (currentDate.getTime() <= endTime) { + dates.push((0, _index.default)(currentDate)); + currentDate.setMonth(currentDate.getMonth() + 1); } - const dates = []; - while (+currentDate <= endTime) { - dates.push((0, _index.toDate)(currentDate)); - currentDate.setMonth(currentDate.getMonth() + step); - } - return reversed ? dates.reverse() : dates; + return dates; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfQuarter.js +// node_modules/date-fns/startOfQuarter/index.js var require_startOfQuarter = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/eachQuarterOfInterval.js +// node_modules/date-fns/eachQuarterOfInterval/index.js var require_eachQuarterOfInterval = __commonJS({ - "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 + "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 var require_eachWeekOfInterval = __commonJS({ - "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); + "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); startDateWeek.setHours(15); endDateWeek.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); + 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); } - return reversed ? dates.reverse() : dates; + return weeks; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/eachWeekendOfInterval.js +// node_modules/date-fns/eachWeekendOfInterval/index.js var require_eachWeekendOfInterval = __commonJS({ - "node_modules/date-fns/eachWeekendOfInterval.js"(exports2) { + "node_modules/date-fns/eachWeekendOfInterval/index.js"(exports2, module2) { "use strict"; - exports2.eachWeekendOfInterval = eachWeekendOfInterval; - var _index = require_eachDayOfInterval(); - var _index2 = require_isWeekend(); + 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()); function eachWeekendOfInterval(interval) { - const dateInterval = (0, _index.eachDayOfInterval)(interval); - const weekends = []; - let index = 0; + (0, _index4.default)(1, arguments); + var dateInterval = (0, _index.default)(interval); + var weekends = []; + var index = 0; while (index < dateInterval.length) { - const date = dateInterval[index++]; - if ((0, _index2.isWeekend)(date)) + var date = dateInterval[index++]; + if ((0, _index3.default)(date)) { weekends.push(date); + if ((0, _index2.default)(date)) + index = index + 5; + } } return weekends; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfMonth.js +// node_modules/date-fns/startOfMonth/index.js var require_startOfMonth = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/eachWeekendOfMonth.js +// node_modules/date-fns/eachWeekendOfMonth/index.js var require_eachWeekendOfMonth = __commonJS({ - "node_modules/date-fns/eachWeekendOfMonth.js"(exports2) { + "node_modules/date-fns/eachWeekendOfMonth/index.js"(exports2, module2) { "use strict"; - 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 }); + 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 + }); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfYear.js +// node_modules/date-fns/endOfYear/index.js var require_endOfYear = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfYear.js +// node_modules/date-fns/startOfYear/index.js var require_startOfYear = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/eachWeekendOfYear.js +// node_modules/date-fns/eachWeekendOfYear/index.js var require_eachWeekendOfYear = __commonJS({ - "node_modules/date-fns/eachWeekendOfYear.js"(exports2) { + "node_modules/date-fns/eachWeekendOfYear/index.js"(exports2, module2) { "use strict"; - 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 }); + 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 + }); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/eachYearOfInterval.js +// node_modules/date-fns/eachYearOfInterval/index.js var require_eachYearOfInterval = __commonJS({ - "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; + "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; currentDate.setHours(0, 0, 0, 0); currentDate.setMonth(0, 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); + while (currentDate.getTime() <= endTime) { + dates.push((0, _index.default)(currentDate)); + currentDate.setFullYear(currentDate.getFullYear() + 1); } - return reversed ? dates.reverse() : dates; + return dates; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfDecade.js +// node_modules/date-fns/endOfDecade/index.js var require_endOfDecade = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfHour.js +// node_modules/date-fns/endOfHour/index.js var require_endOfHour = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfWeek.js +// node_modules/date-fns/endOfWeek/index.js var require_endOfWeek = __commonJS({ - "node_modules/date-fns/endOfWeek.js"(exports2) { + "node_modules/date-fns/endOfWeek/index.js"(exports2, module2) { "use strict"; - 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; + 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfISOWeek.js +// node_modules/date-fns/endOfISOWeek/index.js var require_endOfISOWeek = __commonJS({ - "node_modules/date-fns/endOfISOWeek.js"(exports2) { + "node_modules/date-fns/endOfISOWeek/index.js"(exports2, module2) { "use strict"; - exports2.endOfISOWeek = endOfISOWeek; - var _index = require_endOfWeek(); - function endOfISOWeek(date) { - return (0, _index.endOfWeek)(date, { weekStartsOn: 1 }); + 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 + }); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfISOWeekYear.js +// node_modules/date-fns/endOfISOWeekYear/index.js var require_endOfISOWeekYear = __commonJS({ - "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); + "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); fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); - const _date = (0, _index2.startOfISOWeek)(fourthOfJanuaryOfNextYear); - _date.setMilliseconds(_date.getMilliseconds() - 1); - return _date; + var date = (0, _index2.default)(fourthOfJanuaryOfNextYear); + date.setMilliseconds(date.getMilliseconds() - 1); + return date; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfMinute.js +// node_modules/date-fns/endOfMinute/index.js var require_endOfMinute = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfQuarter.js +// node_modules/date-fns/endOfQuarter/index.js var require_endOfQuarter = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfSecond.js +// node_modules/date-fns/endOfSecond/index.js var require_endOfSecond = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfToday.js +// node_modules/date-fns/endOfToday/index.js var require_endOfToday = __commonJS({ - "node_modules/date-fns/endOfToday.js"(exports2) { + "node_modules/date-fns/endOfToday/index.js"(exports2, module2) { "use strict"; - exports2.endOfToday = endOfToday; - var _index = require_endOfDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = endOfToday; + var _index = _interopRequireDefault(require_endOfDay()); function endOfToday() { - return (0, _index.endOfDay)(Date.now()); + return (0, _index.default)(Date.now()); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/endOfTomorrow.js +// node_modules/date-fns/endOfTomorrow/index.js var require_endOfTomorrow = __commonJS({ - "node_modules/date-fns/endOfTomorrow.js"(exports2) { + "node_modules/date-fns/endOfTomorrow/index.js"(exports2, module2) { "use strict"; - exports2.endOfTomorrow = endOfTomorrow; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = endOfTomorrow; function endOfTomorrow() { - const now = /* @__PURE__ */ new Date(); - const year = now.getFullYear(); - const month = now.getMonth(); - const day = now.getDate(); - const date = /* @__PURE__ */ new Date(0); + var now = /* @__PURE__ */ new Date(); + var year = now.getFullYear(); + var month = now.getMonth(); + var day = now.getDate(); + var 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.js +// node_modules/date-fns/endOfYesterday/index.js var require_endOfYesterday = __commonJS({ - "node_modules/date-fns/endOfYesterday.js"(exports2) { + "node_modules/date-fns/endOfYesterday/index.js"(exports2, module2) { "use strict"; - exports2.endOfYesterday = endOfYesterday; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = endOfYesterday; function endOfYesterday() { - const now = /* @__PURE__ */ new Date(); - const year = now.getFullYear(); - const month = now.getMonth(); - const day = now.getDate(); - const date = /* @__PURE__ */ new Date(0); + var now = /* @__PURE__ */ new Date(); + var year = now.getFullYear(); + var month = now.getMonth(); + var day = now.getDate(); + var 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/locale/en-US/_lib/formatDistance.js -var require_formatDistance = __commonJS({ - "node_modules/date-fns/locale/en-US/_lib/formatDistance.js"(exports2) { +// 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) { "use strict"; - 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 { - result = tokenValue.other.replace("{{count}}", count.toString()); - } - if (options?.addSuffix) { - if (options.comparison && options.comparison > 0) { - return "in " + result; - } else { - return result + " ago"; - } - } - return result; - }; - exports2.formatDistance = formatDistance; + 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/locale/_lib/buildFormatLongFn.js -var require_buildFormatLongFn = __commonJS({ - "node_modules/date-fns/locale/_lib/buildFormatLongFn.js"(exports2) { +// node_modules/date-fns/_lib/getUTCISOWeek/index.js +var require_getUTCISOWeek = __commonJS({ + "node_modules/date-fns/_lib/getUTCISOWeek/index.js"(exports2, module2) { "use strict"; - 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; - }; + 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/locale/en-US/_lib/formatLong.js -var require_formatLong = __commonJS({ - "node_modules/date-fns/locale/en-US/_lib/formatLong.js"(exports2) { +// node_modules/date-fns/_lib/startOfUTCWeek/index.js +var require_startOfUTCWeek = __commonJS({ + "node_modules/date-fns/_lib/startOfUTCWeek/index.js"(exports2, module2) { "use strict"; - 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" - }) - }; + 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/locale/en-US/_lib/formatRelative.js -var require_formatRelative = __commonJS({ - "node_modules/date-fns/locale/en-US/_lib/formatRelative.js"(exports2) { +// node_modules/date-fns/_lib/getUTCWeekYear/index.js +var require_getUTCWeekYear = __commonJS({ + "node_modules/date-fns/_lib/getUTCWeekYear/index.js"(exports2, module2) { "use strict"; - 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; + 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; + } else { + return year - 1; + } + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/locale/_lib/buildLocalizeFn.js -var require_buildLocalizeFn = __commonJS({ - "node_modules/date-fns/locale/_lib/buildLocalizeFn.js"(exports2) { +// node_modules/date-fns/_lib/startOfUTCWeekYear/index.js +var require_startOfUTCWeekYear = __commonJS({ + "node_modules/date-fns/_lib/startOfUTCWeekYear/index.js"(exports2, module2) { "use strict"; - 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]; - } - const index = args.argumentCallback ? args.argumentCallback(value) : value; - return valuesArray[index]; - }; + 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; } + module2.exports = exports2.default; } }); -// 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) { +// node_modules/date-fns/_lib/getUTCWeek/index.js +var require_getUTCWeek = __commonJS({ + "node_modules/date-fns/_lib/getUTCWeek/index.js"(exports2, module2) { "use strict"; - exports2.localize = void 0; - var _index = 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" + 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; + } +}); + +// node_modules/date-fns/_lib/addLeadingZeros/index.js +var require_addLeadingZeros = __commonJS({ + "node_modules/date-fns/_lib/addLeadingZeros/index.js"(exports2, module2) { + "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; + } +}); + +// node_modules/date-fns/_lib/format/lightFormatters/index.js +var require_lightFormatters = __commonJS({ + "node_modules/date-fns/_lib/format/lightFormatters/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_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); }, - abbreviated: { - am: "AM", - pm: "PM", - midnight: "midnight", - noon: "noon", - morning: "morning", - afternoon: "afternoon", - evening: "evening", - night: "night" + // Month + M: function M(date, token) { + var month = date.getUTCMonth(); + return token === "M" ? String(month + 1) : (0, _index.default)(month + 1, 2); }, - 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" + // Day of the month + d: function d(date, token) { + return (0, _index.default)(date.getUTCDate(), token.length); }, - 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."; - } + // 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."; + } }, // Hour [1-12] - h(date, token) { - return (0, _index.addLeadingZeros)( - date.getHours() % 12 || 12, - token.length - ); + h: function h(date, token) { + return (0, _index.default)(date.getUTCHours() % 12 || 12, token.length); }, // Hour [0-23] - H(date, token) { - return (0, _index.addLeadingZeros)(date.getHours(), token.length); + H: function H(date, token) { + return (0, _index.default)(date.getUTCHours(), token.length); }, // Minute - m(date, token) { - return (0, _index.addLeadingZeros)(date.getMinutes(), token.length); + m: function m(date, token) { + return (0, _index.default)(date.getUTCMinutes(), token.length); }, // Second - s(date, token) { - return (0, _index.addLeadingZeros)(date.getSeconds(), token.length); + s: function s(date, token) { + return (0, _index.default)(date.getUTCSeconds(), 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); + 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; } }); -// node_modules/date-fns/_lib/format/formatters.js +// node_modules/date-fns/_lib/format/formatters/index.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(); + "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", @@ -5083,48 +5332,58 @@ var require_formatters = __commonJS({ evening: "evening", night: "night" }; - var formatters = exports2.formatters = { + var formatters = { // Era - G: function(date, token, localize) { - const era = date.getFullYear() > 0 ? 1 : 0; + 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" }); + return localize.era(era, { + width: "abbreviated" + }); case "GGGGG": - return localize.era(era, { width: "narrow" }); + return localize.era(era, { + width: "narrow" + }); case "GGGG": default: - return localize.era(era, { width: "wide" }); + return localize.era(era, { + width: "wide" + }); } }, // Year - y: function(date, token, localize) { + y: function y(date, token, localize) { if (token === "yo") { - const signedYear = date.getFullYear(); - const year = signedYear > 0 ? signedYear : 1 - signedYear; - return localize.ordinalNumber(year, { unit: "year" }); + var signedYear = date.getUTCFullYear(); + var year = signedYear > 0 ? signedYear : 1 - signedYear; + return localize.ordinalNumber(year, { + unit: "year" + }); } - return _index7.lightFormatters.y(date, token); + return _index7.default.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; + Y: function Y(date, token, localize, options) { + var signedWeekYear = (0, _index5.default)(date, options); + var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; if (token === "YY") { - const twoDigitYear = weekYear % 100; - return (0, _index6.addLeadingZeros)(twoDigitYear, 2); + var twoDigitYear = weekYear % 100; + return (0, _index6.default)(twoDigitYear, 2); } if (token === "Yo") { - return localize.ordinalNumber(weekYear, { unit: "year" }); + return localize.ordinalNumber(weekYear, { + unit: "year" + }); } - return (0, _index6.addLeadingZeros)(weekYear, token.length); + return (0, _index6.default)(weekYear, token.length); }, // ISO week-numbering year - R: function(date, token) { - const isoWeekYear = (0, _index3.getISOWeekYear)(date); - return (0, _index6.addLeadingZeros)(isoWeekYear, token.length); + R: function R(date, token) { + var isoWeekYear = (0, _index3.default)(date); + return (0, _index6.default)(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: @@ -5135,20 +5394,22 @@ 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(date, token) { - const year = date.getFullYear(); - return (0, _index6.addLeadingZeros)(year, token.length); + u: function u(date, token) { + var year = date.getUTCFullYear(); + return (0, _index6.default)(year, token.length); }, // Quarter - Q: function(date, token, localize) { - const quarter = Math.ceil((date.getMonth() + 1) / 3); + Q: function Q(date, token, localize) { + var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); switch (token) { case "Q": return String(quarter); case "QQ": - return (0, _index6.addLeadingZeros)(quarter, 2); + return (0, _index6.default)(quarter, 2); case "Qo": - return localize.ordinalNumber(quarter, { unit: "quarter" }); + return localize.ordinalNumber(quarter, { + unit: "quarter" + }); case "QQQ": return localize.quarter(quarter, { width: "abbreviated", @@ -5168,15 +5429,17 @@ var require_formatters = __commonJS({ } }, // Stand-alone quarter - q: function(date, token, localize) { - const quarter = Math.ceil((date.getMonth() + 1) / 3); + q: function q(date, token, localize) { + var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); switch (token) { case "q": return String(quarter); case "qq": - return (0, _index6.addLeadingZeros)(quarter, 2); + return (0, _index6.default)(quarter, 2); case "qo": - return localize.ordinalNumber(quarter, { unit: "quarter" }); + return localize.ordinalNumber(quarter, { + unit: "quarter" + }); case "qqq": return localize.quarter(quarter, { width: "abbreviated", @@ -5196,14 +5459,16 @@ var require_formatters = __commonJS({ } }, // Month - M: function(date, token, localize) { - const month = date.getMonth(); + M: function M(date, token, localize) { + var month = date.getUTCMonth(); switch (token) { case "M": case "MM": - return _index7.lightFormatters.M(date, token); + return _index7.default.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", @@ -5216,19 +5481,24 @@ 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(date, token, localize) { - const month = date.getMonth(); + L: function L(date, token, localize) { + var month = date.getUTCMonth(); switch (token) { case "L": return String(month + 1); case "LL": - return (0, _index6.addLeadingZeros)(month + 1, 2); + return (0, _index6.default)(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", @@ -5241,43 +5511,54 @@ 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(date, token, localize, options) { - const week = (0, _index4.getWeek)(date, options); + w: function w(date, token, localize, options) { + var week = (0, _index4.default)(date, options); if (token === "wo") { - return localize.ordinalNumber(week, { unit: "week" }); + return localize.ordinalNumber(week, { + unit: "week" + }); } - return (0, _index6.addLeadingZeros)(week, token.length); + return (0, _index6.default)(week, token.length); }, // ISO week of year - I: function(date, token, localize) { - const isoWeek = (0, _index2.getISOWeek)(date); + I: function I(date, token, localize) { + var isoWeek = (0, _index2.default)(date); if (token === "Io") { - return localize.ordinalNumber(isoWeek, { unit: "week" }); + return localize.ordinalNumber(isoWeek, { + unit: "week" + }); } - return (0, _index6.addLeadingZeros)(isoWeek, token.length); + return (0, _index6.default)(isoWeek, token.length); }, // Day of the month - d: function(date, token, localize) { + d: function d(date, token, localize) { if (token === "do") { - return localize.ordinalNumber(date.getDate(), { unit: "date" }); + return localize.ordinalNumber(date.getUTCDate(), { + unit: "date" + }); } - return _index7.lightFormatters.d(date, token); + return _index7.default.d(date, token); }, // Day of year - D: function(date, token, localize) { - const dayOfYear = (0, _index.getDayOfYear)(date); + D: function D(date, token, localize) { + var dayOfYear = (0, _index.default)(date); if (token === "Do") { - return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); + return localize.ordinalNumber(dayOfYear, { + unit: "dayOfYear" + }); } - return (0, _index6.addLeadingZeros)(dayOfYear, token.length); + return (0, _index6.default)(dayOfYear, token.length); }, // Day of week - E: function(date, token, localize) { - const dayOfWeek = date.getDay(); + E: function E(date, token, localize) { + var dayOfWeek = date.getUTCDay(); switch (token) { case "E": case "EE": @@ -5305,16 +5586,18 @@ var require_formatters = __commonJS({ } }, // Local day of week - e: function(date, token, localize, options) { - const dayOfWeek = date.getDay(); - const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + e: function e(date, token, localize, options) { + var dayOfWeek = date.getUTCDay(); + var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; switch (token) { case "e": return String(localDayOfWeek); case "ee": - return (0, _index6.addLeadingZeros)(localDayOfWeek, 2); + return (0, _index6.default)(localDayOfWeek, 2); case "eo": - return localize.ordinalNumber(localDayOfWeek, { unit: "day" }); + return localize.ordinalNumber(localDayOfWeek, { + unit: "day" + }); case "eee": return localize.day(dayOfWeek, { width: "abbreviated", @@ -5339,16 +5622,18 @@ var require_formatters = __commonJS({ } }, // Stand-alone local day of week - c: function(date, token, localize, options) { - const dayOfWeek = date.getDay(); - const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + c: function c(date, token, localize, options) { + var dayOfWeek = date.getUTCDay(); + var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; switch (token) { case "c": return String(localDayOfWeek); case "cc": - return (0, _index6.addLeadingZeros)(localDayOfWeek, token.length); + return (0, _index6.default)(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", @@ -5373,16 +5658,18 @@ var require_formatters = __commonJS({ } }, // ISO day of week - i: function(date, token, localize) { - const dayOfWeek = date.getDay(); - const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; + i: function i(date, token, localize) { + var dayOfWeek = date.getUTCDay(); + var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; switch (token) { case "i": return String(isoDayOfWeek); case "ii": - return (0, _index6.addLeadingZeros)(isoDayOfWeek, token.length); + return (0, _index6.default)(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", @@ -5407,9 +5694,9 @@ var require_formatters = __commonJS({ } }, // AM or PM - a: function(date, token, localize) { - const hours = date.getHours(); - const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; + a: function a(date, token, localize) { + var hours = date.getUTCHours(); + var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; switch (token) { case "a": case "aa": @@ -5436,9 +5723,9 @@ var require_formatters = __commonJS({ } }, // AM, PM, midnight, noon - b: function(date, token, localize) { - const hours = date.getHours(); - let dayPeriodEnumValue; + b: function b(date, token, localize) { + var hours = date.getUTCHours(); + var dayPeriodEnumValue; if (hours === 12) { dayPeriodEnumValue = dayPeriodEnum.noon; } else if (hours === 0) { @@ -5472,9 +5759,9 @@ var require_formatters = __commonJS({ } }, // in the morning, in the afternoon, in the evening, at night - B: function(date, token, localize) { - const hours = date.getHours(); - let dayPeriodEnumValue; + B: function B(date, token, localize) { + var hours = date.getUTCHours(); + var dayPeriodEnumValue; if (hours >= 17) { dayPeriodEnumValue = dayPeriodEnum.evening; } else if (hours >= 12) { @@ -5506,61 +5793,74 @@ var require_formatters = __commonJS({ } }, // Hour [1-12] - h: function(date, token, localize) { + h: function h(date, token, localize) { if (token === "ho") { - let hours = date.getHours() % 12; + var hours = date.getUTCHours() % 12; if (hours === 0) hours = 12; - return localize.ordinalNumber(hours, { unit: "hour" }); + return localize.ordinalNumber(hours, { + unit: "hour" + }); } - return _index7.lightFormatters.h(date, token); + return _index7.default.h(date, token); }, // Hour [0-23] - H: function(date, token, localize) { + H: function H(date, token, localize) { if (token === "Ho") { - return localize.ordinalNumber(date.getHours(), { unit: "hour" }); + return localize.ordinalNumber(date.getUTCHours(), { + unit: "hour" + }); } - return _index7.lightFormatters.H(date, token); + return _index7.default.H(date, token); }, // Hour [0-11] - K: function(date, token, localize) { - const hours = date.getHours() % 12; + K: function K(date, token, localize) { + var hours = date.getUTCHours() % 12; if (token === "Ko") { - return localize.ordinalNumber(hours, { unit: "hour" }); + return localize.ordinalNumber(hours, { + unit: "hour" + }); } - return (0, _index6.addLeadingZeros)(hours, token.length); + return (0, _index6.default)(hours, token.length); }, // Hour [1-24] - k: function(date, token, localize) { - let hours = date.getHours(); + 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 localize.ordinalNumber(hours, { + unit: "hour" + }); } - return (0, _index6.addLeadingZeros)(hours, token.length); + return (0, _index6.default)(hours, token.length); }, // Minute - m: function(date, token, localize) { + m: function m(date, token, localize) { if (token === "mo") { - return localize.ordinalNumber(date.getMinutes(), { unit: "minute" }); + return localize.ordinalNumber(date.getUTCMinutes(), { + unit: "minute" + }); } - return _index7.lightFormatters.m(date, token); + return _index7.default.m(date, token); }, // Second - s: function(date, token, localize) { + s: function s(date, token, localize) { if (token === "so") { - return localize.ordinalNumber(date.getSeconds(), { unit: "second" }); + return localize.ordinalNumber(date.getUTCSeconds(), { + unit: "second" + }); } - return _index7.lightFormatters.s(date, token); + return _index7.default.s(date, token); }, // Fraction of second - S: function(date, token) { - return _index7.lightFormatters.S(date, token); + S: function S(date, token) { + return _index7.default.S(date, token); }, // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) - X: function(date, token, _localize) { - const timezoneOffset = date.getTimezoneOffset(); + X: function X(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); if (timezoneOffset === 0) { return "Z"; } @@ -5577,8 +5877,9 @@ var require_formatters = __commonJS({ } }, // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) - x: function(date, token, _localize) { - const timezoneOffset = date.getTimezoneOffset(); + x: function x(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); switch (token) { case "x": return formatTimezoneWithOptionalMinutes(timezoneOffset); @@ -5592,8 +5893,9 @@ var require_formatters = __commonJS({ } }, // Timezone (GMT) - O: function(date, token, _localize) { - const timezoneOffset = date.getTimezoneOffset(); + O: function O(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); switch (token) { case "O": case "OO": @@ -5605,8 +5907,9 @@ var require_formatters = __commonJS({ } }, // Timezone (specific non-location) - z: function(date, token, _localize) { - const timezoneOffset = date.getTimezoneOffset(); + z: function z(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); switch (token) { case "z": case "zz": @@ -5618,2632 +5921,4430 @@ var require_formatters = __commonJS({ } }, // Seconds timestamp - t: function(date, token, _localize) { - const timestamp = Math.trunc(date.getTime() / 1e3); - return (0, _index6.addLeadingZeros)(timestamp, token.length); + 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(date, token, _localize) { - const timestamp = date.getTime(); - return (0, _index6.addLeadingZeros)(timestamp, token.length); + 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, delimiter = "") { - const sign = offset > 0 ? "-" : "+"; - const absOffset = Math.abs(offset); - const hours = Math.trunc(absOffset / 60); - const minutes = absOffset % 60; + 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); } - return sign + String(hours) + delimiter + (0, _index6.addLeadingZeros)(minutes, 2); + var delimiter = dirtyDelimiter || ""; + return sign + String(hours) + delimiter + (0, _index6.default)(minutes, 2); } - function formatTimezoneWithOptionalMinutes(offset, delimiter) { + function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) { if (offset % 60 === 0) { - const sign = offset > 0 ? "-" : "+"; - return sign + (0, _index6.addLeadingZeros)(Math.abs(offset) / 60, 2); + var sign = offset > 0 ? "-" : "+"; + return sign + (0, _index6.default)(Math.abs(offset) / 60, 2); } - return formatTimezone(offset, delimiter); + return formatTimezone(offset, dirtyDelimiter); } - 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); + 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.js +// node_modules/date-fns/_lib/format/longFormatters/index.js var require_longFormatters = __commonJS({ - "node_modules/date-fns/_lib/format/longFormatters.js"(exports2) { + "node_modules/date-fns/_lib/format/longFormatters/index.js"(exports2, module2) { "use strict"; - exports2.longFormatters = void 0; - var dateLongFormatter = (pattern, formatLong) => { + 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" }); + return formatLong.date({ + width: "short" + }); case "PP": - return formatLong.date({ width: "medium" }); + return formatLong.date({ + width: "medium" + }); case "PPP": - return formatLong.date({ width: "long" }); + return formatLong.date({ + width: "long" + }); case "PPPP": default: - return formatLong.date({ width: "full" }); + return formatLong.date({ + width: "full" + }); } }; - var timeLongFormatter = (pattern, formatLong) => { + var timeLongFormatter = function timeLongFormatter2(pattern, formatLong) { switch (pattern) { case "p": - return formatLong.time({ width: "short" }); + return formatLong.time({ + width: "short" + }); case "pp": - return formatLong.time({ width: "medium" }); + return formatLong.time({ + width: "medium" + }); case "ppp": - return formatLong.time({ width: "long" }); + return formatLong.time({ + width: "long" + }); case "pppp": default: - return formatLong.time({ width: "full" }); + return formatLong.time({ + width: "full" + }); } }; - var dateTimeLongFormatter = (pattern, formatLong) => { - const matchResult = pattern.match(/(P+)(p+)?/) || []; - const datePattern = matchResult[1]; - const timePattern = matchResult[2]; + 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); } - let dateTimeFormat; + var dateTimeFormat; switch (datePattern) { case "P": - dateTimeFormat = formatLong.dateTime({ width: "short" }); + dateTimeFormat = formatLong.dateTime({ + width: "short" + }); break; case "PP": - dateTimeFormat = formatLong.dateTime({ width: "medium" }); + dateTimeFormat = formatLong.dateTime({ + width: "medium" + }); break; case "PPP": - dateTimeFormat = formatLong.dateTime({ width: "long" }); + dateTimeFormat = formatLong.dateTime({ + width: "long" + }); break; case "PPPP": default: - dateTimeFormat = formatLong.dateTime({ width: "full" }); + dateTimeFormat = formatLong.dateTime({ + width: "full" + }); break; } return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong)); }; - var longFormatters = exports2.longFormatters = { + var longFormatters = { p: timeLongFormatter, P: dateTimeLongFormatter }; + var _default = longFormatters; + exports2.default = _default; + module2.exports = exports2.default; } }); -// node_modules/date-fns/_lib/protectedTokens.js +// node_modules/date-fns/_lib/protectedTokens/index.js var require_protectedTokens = __commonJS({ - "node_modules/date-fns/_lib/protectedTokens.js"(exports2) { + "node_modules/date-fns/_lib/protectedTokens/index.js"(exports2) { "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); exports2.isProtectedDayOfYearToken = isProtectedDayOfYearToken; exports2.isProtectedWeekYearToken = isProtectedWeekYearToken; - exports2.warnOrThrowProtectedError = warnOrThrowProtectedError; - var dayOfYearTokenRE = /^D+$/; - var weekYearTokenRE = /^Y+$/; - var throwTokens = ["D", "DD", "YY", "YYYY"]; + exports2.throwProtectedError = throwProtectedError; + var protectedDayOfYearTokens = ["D", "DD"]; + var protectedWeekYearTokens = ["YY", "YYYY"]; function isProtectedDayOfYearToken(token) { - return dayOfYearTokenRE.test(token); + return protectedDayOfYearTokens.indexOf(token) !== -1; } 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.js -var require_format = __commonJS({ - "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(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"); - } - let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => { - const firstCharacter = substring[0]; - if (firstCharacter === "p" || firstCharacter === "P") { - const longFormatter = _index4.longFormatters[firstCharacter]; - return longFormatter(substring, locale.formatLong); - } - return substring; - }).join("").match(formattingTokensRegExp).map((substring) => { - if (substring === "''") { - return { isToken: false, value: "'" }; - } - const firstCharacter = substring[0]; - if (firstCharacter === "'") { - return { isToken: false, value: cleanEscapedString(substring) }; - } - 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 + "`" - ); - } - 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 protectedWeekYearTokens.indexOf(token) !== -1; } - function cleanEscapedString(input) { - const matched = input.match(escapedStringRegExp); - if (!matched) { - return input; + 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")); } - return matched[1].replace(doubleQuoteRegExp, "'"); } } }); -// node_modules/date-fns/formatDistance.js -var require_formatDistance2 = __commonJS({ - "node_modules/date-fns/formatDistance.js"(exports2) { +// 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"; - 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"); + 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" + }, + 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" } - const localizeOptions = Object.assign({}, options, { - addSuffix: options?.addSuffix, - comparison - }); - let dateLeft; - let dateRight; - if (comparison > 0) { - dateLeft = (0, _index5.toDate)(baseDate); - dateRight = (0, _index5.toDate)(date); + }; + 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 { - dateLeft = (0, _index5.toDate)(date); - dateRight = (0, _index5.toDate)(baseDate); - } - 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?.includeSeconds) { - if (seconds < 5) { - return locale.formatDistance("lessThanXSeconds", 5, localizeOptions); - } else if (seconds < 10) { - return locale.formatDistance("lessThanXSeconds", 10, localizeOptions); - } else if (seconds < 20) { - return locale.formatDistance("lessThanXSeconds", 20, localizeOptions); - } else if (seconds < 40) { - return locale.formatDistance("halfAMinute", 0, localizeOptions); - } else if (seconds < 60) { - return locale.formatDistance("lessThanXMinutes", 1, localizeOptions); - } else { - return locale.formatDistance("xMinutes", 1, localizeOptions); - } - } else { - if (minutes === 0) { - return locale.formatDistance("lessThanXMinutes", 1, localizeOptions); - } else { - return locale.formatDistance("xMinutes", minutes, localizeOptions); - } - } - } else if (minutes < 45) { - return locale.formatDistance("xMinutes", minutes, localizeOptions); - } else if (minutes < 90) { - return locale.formatDistance("aboutXHours", 1, localizeOptions); - } else if (minutes < _index2.minutesInDay) { - const hours = Math.round(minutes / 60); - return locale.formatDistance("aboutXHours", hours, localizeOptions); - } else if (minutes < minutesInAlmostTwoDays) { - return locale.formatDistance("xDays", 1, localizeOptions); - } else if (minutes < _index2.minutesInMonth) { - const days = Math.round(minutes / _index2.minutesInDay); - return locale.formatDistance("xDays", days, localizeOptions); - } else if (minutes < _index2.minutesInMonth * 2) { - months = Math.round(minutes / _index2.minutesInMonth); - return locale.formatDistance("aboutXMonths", months, localizeOptions); + result = tokenValue.other.replace("{{count}}", count.toString()); } - months = (0, _index3.differenceInMonths)(dateRight, dateLeft); - if (months < 12) { - const nearestMonth = Math.round(minutes / _index2.minutesInMonth); - return locale.formatDistance("xMonths", nearestMonth, localizeOptions); - } else { - const monthsSinceStartOfYear = months % 12; - const years = Math.trunc(months / 12); - if (monthsSinceStartOfYear < 3) { - return locale.formatDistance("aboutXYears", years, localizeOptions); - } else if (monthsSinceStartOfYear < 9) { - return locale.formatDistance("overXYears", years, localizeOptions); + if (options !== null && options !== void 0 && options.addSuffix) { + if (options.comparison && options.comparison > 0) { + return "in " + result; } else { - return locale.formatDistance("almostXYears", years + 1, localizeOptions); + return result + " ago"; } } - } + return result; + }; + var _default = formatDistance; + exports2.default = _default; + module2.exports = exports2.default; } }); -// node_modules/date-fns/formatDistanceStrict.js -var require_formatDistanceStrict = __commonJS({ - "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"); - } - const localizeOptions = Object.assign({}, options, { - addSuffix: options?.addSuffix, - comparison - }); - let dateLeft; - let dateRight; - if (comparison > 0) { - dateLeft = (0, _index7.toDate)(baseDate); - dateRight = (0, _index7.toDate)(date); - } else { - 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 < _index6.minutesInDay) { - unit = "hour"; - } else if (dstNormalizedMinutes < _index6.minutesInMonth) { - unit = "day"; - } else if (dstNormalizedMinutes < _index6.minutesInYear) { - unit = "month"; - } else { - unit = "year"; - } - } else { - unit = defaultUnit; - } - if (unit === "second") { - const seconds = roundingMethod(milliseconds / 1e3); - return locale.formatDistance("xSeconds", seconds, localizeOptions); - } else if (unit === "minute") { - const roundedMinutes = roundingMethod(minutes); - return locale.formatDistance("xMinutes", roundedMinutes, localizeOptions); - } else if (unit === "hour") { - const hours = roundingMethod(minutes / 60); - return locale.formatDistance("xHours", hours, localizeOptions); - } else if (unit === "day") { - const days = roundingMethod(dstNormalizedMinutes / _index6.minutesInDay); - return locale.formatDistance("xDays", days, localizeOptions); - } else if (unit === "month") { - const months = roundingMethod( - dstNormalizedMinutes / _index6.minutesInMonth - ); - return months === 12 && defaultUnit !== "month" ? locale.formatDistance("xYears", 1, localizeOptions) : locale.formatDistance("xMonths", months, localizeOptions); - } else { - const years = roundingMethod(dstNormalizedMinutes / _index6.minutesInYear); - return locale.formatDistance("xYears", years, localizeOptions); - } +// 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/formatDistanceToNow.js -var require_formatDistanceToNow = __commonJS({ - "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 - ); - } - } -}); - -// node_modules/date-fns/formatDistanceToNowStrict.js -var require_formatDistanceToNowStrict = __commonJS({ - "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 - ); - } +// 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/formatDuration.js -var require_formatDuration = __commonJS({ - "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) { - 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 ""; - } - 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; - } +// 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/formatISO.js -var require_formatISO = __commonJS({ - "node_modules/date-fns/formatISO.js"(exports2) { +// 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"; - exports2.formatISO = formatISO; - var _index = require_toDate(); - var _index2 = require_addLeadingZeros(); - function formatISO(date, options) { - const _date = (0, _index.toDate)(date); - if (isNaN(_date.getTime())) { - throw new RangeError("Invalid time value"); - } - 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") { - 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") { - const offset = _date.getTimezoneOffset(); - if (offset !== 0) { - 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}`; + 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 { - tzOffset = "Z"; + 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]; } - 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; + var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; + return valuesArray[index]; + }; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/formatISO9075.js -var require_formatISO9075 = __commonJS({ - "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"); +// 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" + }, + abbreviated: { + am: "AM", + pm: "PM", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" + }, + wide: { + am: "a.m.", + pm: "p.m.", + midnight: "midnight", + noon: "noon", + morning: "morning", + afternoon: "afternoon", + evening: "evening", + night: "night" } - const format = options?.format ?? "extended"; - const representation = options?.representation ?? "complete"; - let result = ""; - const dateDelimiter = format === "extended" ? "-" : ""; - const timeDelimiter = format === "extended" ? ":" : ""; - if (representation !== "time") { - 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}`; + }; + 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" } - if (representation !== "date") { - 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}`; + }; + 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"; + } } - return result; - } + 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; + } + }), + 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/formatISODuration.js -var require_formatISODuration = __commonJS({ - "node_modules/date-fns/formatISODuration.js"(exports2) { +// 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"; - exports2.formatISODuration = formatISODuration; - function formatISODuration(duration) { - 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`; + 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; + } + 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 + }; + }; } - } -}); - -// node_modules/date-fns/formatRFC3339.js -var require_formatRFC3339 = __commonJS({ - "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"); - } - 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) { - const milliseconds = _date.getMilliseconds(); - const fractionalSeconds = Math.trunc( - milliseconds * Math.pow(10, fractionDigits - 3) - ); - fractionalSecond = "." + (0, _index3.addLeadingZeros)(fractionalSeconds, fractionDigits); + function findKey(object, predicate) { + for (var key in object) { + if (object.hasOwnProperty(key) && predicate(object[key])) { + return key; + } } - let offset = ""; - const tzOffset = _date.getTimezoneOffset(); - if (tzOffset !== 0) { - 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 void 0; + } + function findIndex(array, predicate) { + for (var key = 0; key < array.length; key++) { + if (predicate(array[key])) { + return key; + } } - return `${year}-${month}-${day}T${hour}:${minute}:${second}${fractionalSecond}${offset}`; + return void 0; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/formatRFC7231.js -var require_formatRFC7231 = __commonJS({ - "node_modules/date-fns/formatRFC7231.js"(exports2) { +// 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"; - 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(date) { - const _date = (0, _index2.toDate)(date); - if (!(0, _index.isValid)(_date)) { - throw new RangeError("Invalid time value"); - } - 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`; + 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 + }; + }; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/formatRelative.js -var require_formatRelative2 = __commonJS({ - "node_modules/date-fns/formatRelative.js"(exports2) { +// 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) { "use strict"; - 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"); - } - let token; - if (diff < -6) { - token = "other"; - } else if (diff < -1) { - token = "lastWeek"; - } else if (diff < 0) { - token = "yesterday"; - } else if (diff < 1) { - token = "today"; - } else if (diff < 2) { - token = "tomorrow"; - } else if (diff < 7) { - token = "nextWeek"; - } else { - token = "other"; + 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 } - const formatStr = locale.formatRelative(token, _date, _baseDate, { - locale, - weekStartsOn - }); - return (0, _index2.format)(_date, formatStr, { locale, weekStartsOn }); - } - } -}); - -// node_modules/date-fns/fromUnixTime.js -var require_fromUnixTime = __commonJS({ - "node_modules/date-fns/fromUnixTime.js"(exports2) { - "use strict"; - exports2.fromUnixTime = fromUnixTime; - var _index = require_toDate(); - function fromUnixTime(unixTime) { - return (0, _index.toDate)(unixTime * 1e3); - } - } -}); - -// node_modules/date-fns/getDate.js -var require_getDate = __commonJS({ - "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; - } - } -}); - -// node_modules/date-fns/getDay.js -var require_getDay = __commonJS({ - "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; - } + }; + 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 _default = match; + exports2.default = _default; + module2.exports = exports2.default; } }); -// node_modules/date-fns/getDaysInMonth.js -var require_getDaysInMonth = __commonJS({ - "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(); - } +// 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 _default = locale; + exports2.default = _default; + module2.exports = exports2.default; } }); -// node_modules/date-fns/isLeapYear.js -var require_isLeapYear = __commonJS({ - "node_modules/date-fns/isLeapYear.js"(exports2) { +// node_modules/date-fns/_lib/defaultLocale/index.js +var require_defaultLocale = __commonJS({ + "node_modules/date-fns/_lib/defaultLocale/index.js"(exports2, module2) { "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; - } + 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; } }); -// node_modules/date-fns/getDaysInYear.js -var require_getDaysInYear = __commonJS({ - "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; +// node_modules/date-fns/format/index.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()); + 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)) { + throw new RangeError("Invalid time value"); } - return (0, _index.isLeapYear)(_date) ? 366 : 365; + 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]; + if (firstCharacter === "p" || firstCharacter === "P") { + var longFormatter = _index5.default[firstCharacter]; + return longFormatter(substring, locale.formatLong); + } + return substring; + }).join("").match(formattingTokensRegExp).map(function(substring) { + if (substring === "''") { + return "'"; + } + var firstCharacter = substring[0]; + if (firstCharacter === "'") { + return 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 (firstCharacter.match(unescapedLatinCharacterRegExp)) { + throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"); + } + return substring; + }).join(""); + return result; } - } -}); - -// node_modules/date-fns/getDecade.js -var require_getDecade = __commonJS({ - "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; + function cleanEscapedString(input) { + var matched = input.match(escapedStringRegExp); + if (!matched) { + return input; + } + return matched[1].replace(doubleQuoteRegExp, "'"); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getDefaultOptions.js -var require_getDefaultOptions = __commonJS({ - "node_modules/date-fns/getDefaultOptions.js"(exports2) { +// node_modules/date-fns/_lib/assign/index.js +var require_assign = __commonJS({ + "node_modules/date-fns/_lib/assign/index.js"(exports2, module2) { "use strict"; - exports2.getDefaultOptions = getDefaultOptions; - var _index = require_defaultOptions(); - function getDefaultOptions() { - return Object.assign({}, (0, _index.getDefaultOptions)()); + 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/getHours.js -var require_getHours = __commonJS({ - "node_modules/date-fns/getHours.js"(exports2) { +// node_modules/date-fns/_lib/cloneObject/index.js +var require_cloneObject = __commonJS({ + "node_modules/date-fns/_lib/cloneObject/index.js"(exports2, module2) { "use strict"; - exports2.getHours = getHours; - var _index = require_toDate(); - function getHours(date) { - const _date = (0, _index.toDate)(date); - const hours = _date.getHours(); - return hours; + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getISODay.js -var require_getISODay = __commonJS({ - "node_modules/date-fns/getISODay.js"(exports2) { +// node_modules/date-fns/formatDistance/index.js +var require_formatDistance2 = __commonJS({ + "node_modules/date-fns/formatDistance/index.js"(exports2, module2) { "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; + 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); + 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), + comparison + }); + var dateLeft; + var dateRight; + if (comparison > 0) { + dateLeft = (0, _index6.default)(dirtyBaseDate); + dateRight = (0, _index6.default)(dirtyDate); + } else { + dateLeft = (0, _index6.default)(dirtyDate); + dateRight = (0, _index6.default)(dirtyBaseDate); + } + 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; + if (minutes < 2) { + if (options !== null && options !== void 0 && options.includeSeconds) { + if (seconds < 5) { + return locale.formatDistance("lessThanXSeconds", 5, localizeOptions); + } else if (seconds < 10) { + return locale.formatDistance("lessThanXSeconds", 10, localizeOptions); + } else if (seconds < 20) { + return locale.formatDistance("lessThanXSeconds", 20, localizeOptions); + } else if (seconds < 40) { + return locale.formatDistance("halfAMinute", 0, localizeOptions); + } else if (seconds < 60) { + return locale.formatDistance("lessThanXMinutes", 1, localizeOptions); + } else { + return locale.formatDistance("xMinutes", 1, localizeOptions); + } + } else { + if (minutes === 0) { + return locale.formatDistance("lessThanXMinutes", 1, localizeOptions); + } else { + return locale.formatDistance("xMinutes", minutes, localizeOptions); + } + } + } else if (minutes < 45) { + 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); + return locale.formatDistance("aboutXHours", hours, localizeOptions); + } else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) { + return locale.formatDistance("xDays", 1, localizeOptions); + } else if (minutes < MINUTES_IN_MONTH) { + var days = Math.round(minutes / MINUTES_IN_DAY); + return locale.formatDistance("xDays", days, localizeOptions); + } else if (minutes < MINUTES_IN_TWO_MONTHS) { + months = Math.round(minutes / MINUTES_IN_MONTH); + return locale.formatDistance("aboutXMonths", months, localizeOptions); + } + months = (0, _index3.default)(dateRight, dateLeft); + if (months < 12) { + var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH); + return locale.formatDistance("xMonths", nearestMonth, localizeOptions); + } else { + var monthsSinceStartOfYear = months % 12; + var years = Math.floor(months / 12); + if (monthsSinceStartOfYear < 3) { + return locale.formatDistance("aboutXYears", years, localizeOptions); + } else if (monthsSinceStartOfYear < 9) { + return locale.formatDistance("overXYears", years, localizeOptions); + } else { + return locale.formatDistance("almostXYears", years + 1, localizeOptions); + } } - return day; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getISOWeeksInYear.js -var require_getISOWeeksInYear = __commonJS({ - "node_modules/date-fns/getISOWeeksInYear.js"(exports2) { +// node_modules/date-fns/formatDistanceStrict/index.js +var require_formatDistanceStrict = __commonJS({ + "node_modules/date-fns/formatDistanceStrict/index.js"(exports2, module2) { "use strict"; - 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); - } - } -}); - -// node_modules/date-fns/getMilliseconds.js -var require_getMilliseconds = __commonJS({ - "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; + 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); + 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), + comparison + }); + var dateLeft; + var 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; + } 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; + if (!defaultUnit) { + if (minutes < 1) { + unit = "second"; + } else if (minutes < 60) { + unit = "minute"; + } else if (minutes < MINUTES_IN_DAY) { + unit = "hour"; + } else if (dstNormalizedMinutes < MINUTES_IN_MONTH) { + unit = "day"; + } else if (dstNormalizedMinutes < MINUTES_IN_YEAR) { + unit = "month"; + } else { + unit = "year"; + } + } else { + unit = String(defaultUnit); + } + if (unit === "second") { + var seconds = roundingMethodFn(milliseconds / 1e3); + return locale.formatDistance("xSeconds", seconds, localizeOptions); + } else if (unit === "minute") { + var roundedMinutes = roundingMethodFn(minutes); + return locale.formatDistance("xMinutes", roundedMinutes, localizeOptions); + } else if (unit === "hour") { + var hours = roundingMethodFn(minutes / 60); + return locale.formatDistance("xHours", hours, localizeOptions); + } else if (unit === "day") { + var days = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_DAY); + return locale.formatDistance("xDays", days, localizeOptions); + } else if (unit === "month") { + var months = roundingMethodFn(dstNormalizedMinutes / MINUTES_IN_MONTH); + 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); + 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/getMinutes.js -var require_getMinutes = __commonJS({ - "node_modules/date-fns/getMinutes.js"(exports2) { +// node_modules/date-fns/formatDistanceToNow/index.js +var require_formatDistanceToNow = __commonJS({ + "node_modules/date-fns/formatDistanceToNow/index.js"(exports2, module2) { "use strict"; - exports2.getMinutes = getMinutes; - var _index = require_toDate(); - function getMinutes(date) { - const _date = (0, _index.toDate)(date); - const minutes = _date.getMinutes(); - return minutes; + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getMonth.js -var require_getMonth = __commonJS({ - "node_modules/date-fns/getMonth.js"(exports2) { +// node_modules/date-fns/formatDistanceToNowStrict/index.js +var require_formatDistanceToNowStrict = __commonJS({ + "node_modules/date-fns/formatDistanceToNowStrict/index.js"(exports2, module2) { "use strict"; - exports2.getMonth = getMonth; - var _index = require_toDate(); - function getMonth(date) { - const _date = (0, _index.toDate)(date); - const month = _date.getMonth(); - return month; + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getOverlappingDaysInIntervals.js -var require_getOverlappingDaysInIntervals = __commonJS({ - "node_modules/date-fns/getOverlappingDaysInIntervals.js"(exports2) { +// node_modules/date-fns/formatDuration/index.js +var require_formatDuration = __commonJS({ + "node_modules/date-fns/formatDuration/index.js"(exports2, module2) { "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; - 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); + 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"]; + 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 : " "; + 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])) { + return acc.concat(locale.formatDistance(token, value)); + } + return acc; + }, []).join(delimiter); + return result; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getSeconds.js -var require_getSeconds = __commonJS({ - "node_modules/date-fns/getSeconds.js"(exports2) { +// node_modules/date-fns/formatISO/index.js +var require_formatISO = __commonJS({ + "node_modules/date-fns/formatISO/index.js"(exports2, module2) { "use strict"; - exports2.getSeconds = getSeconds; - var _index = require_toDate(); - function getSeconds(date) { - const _date = (0, _index.toDate)(date); - const seconds = _date.getSeconds(); - return seconds; + 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()); + function formatISO(date, options) { + var _options$format, _options$representati; + (0, _index3.default)(1, arguments); + var originalDate = (0, _index.default)(date); + if (isNaN(originalDate.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" ? ":" : ""; + 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); + } + if (representation !== "date") { + var offset = originalDate.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); + } 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); + } + return result; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getTime.js -var require_getTime = __commonJS({ - "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; +// node_modules/date-fns/formatISO9075/index.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)) { + 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" ? ":" : ""; + 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); + } + 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); + } + return result; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getUnixTime.js -var require_getUnixTime = __commonJS({ - "node_modules/date-fns/getUnixTime.js"(exports2) { +// node_modules/date-fns/formatISODuration/index.js +var require_formatISODuration = __commonJS({ + "node_modules/date-fns/formatISODuration/index.js"(exports2, module2) { "use strict"; - exports2.getUnixTime = getUnixTime; - var _index = require_toDate(); - function getUnixTime(date) { - return Math.trunc(+(0, _index.toDate)(date) / 1e3); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = formatISODuration; + var _typeof2 = _interopRequireDefault(require_typeof()); + var _index = _interopRequireDefault(require_requiredArgs()); + 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"); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getWeekOfMonth.js -var require_getWeekOfMonth = __commonJS({ - "node_modules/date-fns/getWeekOfMonth.js"(exports2) { - "use strict"; - exports2.getWeekOfMonth = getWeekOfMonth; - var _index = require_getDate(); - var _index2 = require_getDay(); - var _index3 = require_startOfMonth(); - var _index4 = require_defaultOptions(); - function getWeekOfMonth(date, options) { - 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; - const startWeekDay = (0, _index2.getDay)((0, _index3.startOfMonth)(date)); - let lastDayOfFirstWeek = weekStartsOn - startWeekDay; - if (lastDayOfFirstWeek <= 0) - lastDayOfFirstWeek += 7; - const remainingDaysAfterFirstWeek = currentDayOfMonth - lastDayOfFirstWeek; - return Math.ceil(remainingDaysAfterFirstWeek / 7) + 1; +// node_modules/date-fns/formatRFC3339/index.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)) { + 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 = ""; + if (fractionDigits > 0) { + var milliseconds = originalDate.getMilliseconds(); + var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, fractionDigits - 3)); + fractionalSecond = "." + (0, _index3.default)(fractionalSeconds, fractionDigits); + } + var offset = ""; + var tzOffset = originalDate.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); + } else { + offset = "Z"; + } + return "".concat(year, "-").concat(month, "-").concat(day, "T").concat(hour, ":").concat(minute, ":").concat(second).concat(fractionalSecond).concat(offset); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfMonth.js -var require_lastDayOfMonth = __commonJS({ - "node_modules/date-fns/lastDayOfMonth.js"(exports2) { +// node_modules/date-fns/formatRFC7231/index.js +var require_formatRFC7231 = __commonJS({ + "node_modules/date-fns/formatRFC7231/index.js"(exports2, module2) { "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; + 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()); + 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)) { + 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"); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getWeeksInMonth.js -var require_getWeeksInMonth = __commonJS({ - "node_modules/date-fns/getWeeksInMonth.js"(exports2) { +// node_modules/date-fns/formatRelative/index.js +var require_formatRelative2 = __commonJS({ + "node_modules/date-fns/formatRelative/index.js"(exports2, module2) { "use strict"; - exports2.getWeeksInMonth = getWeeksInMonth; - var _index = require_differenceInCalendarWeeks(); - var _index2 = require_lastDayOfMonth(); - var _index3 = require_startOfMonth(); - function getWeeksInMonth(date, options) { - return (0, _index.differenceInCalendarWeeks)( - (0, _index2.lastDayOfMonth)(date), - (0, _index3.startOfMonth)(date), - options - ) + 1; + 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); + if (isNaN(diff)) { + throw new RangeError("Invalid time value"); + } + var token; + if (diff < -6) { + token = "other"; + } else if (diff < -1) { + token = "lastWeek"; + } else if (diff < 0) { + token = "yesterday"; + } else if (diff < 1) { + token = "today"; + } else if (diff < 2) { + token = "tomorrow"; + } else if (diff < 7) { + token = "nextWeek"; + } 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, { + locale, + weekStartsOn + }); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/getYear.js -var require_getYear = __commonJS({ - "node_modules/date-fns/getYear.js"(exports2) { +// node_modules/date-fns/fromUnixTime/index.js +var require_fromUnixTime = __commonJS({ + "node_modules/date-fns/fromUnixTime/index.js"(exports2, module2) { "use strict"; - exports2.getYear = getYear; - var _index = require_toDate(); - function getYear(date) { - return (0, _index.toDate)(date).getFullYear(); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/hoursToMilliseconds.js -var require_hoursToMilliseconds = __commonJS({ - "node_modules/date-fns/hoursToMilliseconds.js"(exports2) { - "use strict"; - exports2.hoursToMilliseconds = hoursToMilliseconds; - var _index = require_constants(); - function hoursToMilliseconds(hours) { - return Math.trunc(hours * _index.millisecondsInHour); +// node_modules/date-fns/getDate/index.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(); + return dayOfMonth; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/hoursToMinutes.js -var require_hoursToMinutes = __commonJS({ - "node_modules/date-fns/hoursToMinutes.js"(exports2) { - "use strict"; - exports2.hoursToMinutes = hoursToMinutes; - var _index = require_constants(); - function hoursToMinutes(hours) { - return Math.trunc(hours * _index.minutesInHour); +// node_modules/date-fns/getDay/index.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(); + return day; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/hoursToSeconds.js -var require_hoursToSeconds = __commonJS({ - "node_modules/date-fns/hoursToSeconds.js"(exports2) { - "use strict"; - exports2.hoursToSeconds = hoursToSeconds; - var _index = require_constants(); - function hoursToSeconds(hours) { - return Math.trunc(hours * _index.secondsInHour); +// 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/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 }; +// node_modules/date-fns/getDaysInMonth/index.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); + lastDayOfMonth.setFullYear(year, monthIndex + 1, 0); + lastDayOfMonth.setHours(0, 0, 0, 0); + return lastDayOfMonth.getDate(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/intervalToDuration.js -var require_intervalToDuration = __commonJS({ - "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) { - 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; +// node_modules/date-fns/isLeapYear/index.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(); + return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/intlFormat.js -var require_intlFormat = __commonJS({ - "node_modules/date-fns/intlFormat.js"(exports2) { - "use strict"; - exports2.intlFormat = intlFormat; - var _index = require_toDate(); - function intlFormat(date, formatOrLocale, localeOptions) { - let formatOptions; - if (isFormatOptions(formatOrLocale)) { - formatOptions = formatOrLocale; - } else { - localeOptions = formatOrLocale; +// node_modules/date-fns/getDaysInYear/index.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") { + return NaN; } - return new Intl.DateTimeFormat(localeOptions?.locale, formatOptions).format( - (0, _index.toDate)(date) - ); - } - function isFormatOptions(opts) { - return opts !== void 0 && !("locale" in opts); + return (0, _index2.default)(date) ? 366 : 365; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/intlFormatDistance.js -var require_intlFormatDistance = __commonJS({ - "node_modules/date-fns/intlFormatDistance.js"(exports2) { - "use strict"; - exports2.intlFormatDistance = intlFormatDistance; - var _index = require_constants(); - 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) { - 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.differenceInSeconds)(dateLeft, dateRight); - unit = "second"; - } else if (Math.abs(diffInSeconds) < _index.secondsInHour) { - value = (0, _index8.differenceInMinutes)(dateLeft, dateRight); - unit = "minute"; - } 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.differenceInCalendarDays)(dateLeft, dateRight)) && Math.abs(value) < 7) { - unit = "day"; - } else if (Math.abs(diffInSeconds) < _index.secondsInMonth) { - value = (0, _index5.differenceInCalendarWeeks)(dateLeft, dateRight); - unit = "week"; - } else if (Math.abs(diffInSeconds) < _index.secondsInQuarter) { - value = (0, _index3.differenceInCalendarMonths)(dateLeft, dateRight); - unit = "month"; - } else if (Math.abs(diffInSeconds) < _index.secondsInYear) { - if ((0, _index4.differenceInCalendarQuarters)(dateLeft, dateRight) < 4) { - value = (0, _index4.differenceInCalendarQuarters)(dateLeft, dateRight); - unit = "quarter"; - } else { - value = (0, _index6.differenceInCalendarYears)(dateLeft, dateRight); - unit = "year"; - } - } else { - value = (0, _index6.differenceInCalendarYears)(dateLeft, dateRight); - unit = "year"; - } - } else { - unit = options?.unit; - if (unit === "second") { - value = (0, _index9.differenceInSeconds)(dateLeft, dateRight); - } else if (unit === "minute") { - value = (0, _index8.differenceInMinutes)(dateLeft, dateRight); - } else if (unit === "hour") { - value = (0, _index7.differenceInHours)(dateLeft, dateRight); - } else if (unit === "day") { - value = (0, _index2.differenceInCalendarDays)(dateLeft, dateRight); - } else if (unit === "week") { - value = (0, _index5.differenceInCalendarWeeks)(dateLeft, dateRight); - } else if (unit === "month") { - value = (0, _index3.differenceInCalendarMonths)(dateLeft, dateRight); - } else if (unit === "quarter") { - value = (0, _index4.differenceInCalendarQuarters)(dateLeft, dateRight); - } else if (unit === "year") { - value = (0, _index6.differenceInCalendarYears)(dateLeft, dateRight); - } - } - const rtf = new Intl.RelativeTimeFormat(options?.locale, { - localeMatcher: options?.localeMatcher, - numeric: options?.numeric || "auto", - style: options?.style - }); - return rtf.format(value, unit); +// node_modules/date-fns/getDecade/index.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; + return decade; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isAfter.js -var require_isAfter = __commonJS({ - "node_modules/date-fns/isAfter.js"(exports2) { +// node_modules/date-fns/getDefaultOptions/index.js +var require_getDefaultOptions = __commonJS({ + "node_modules/date-fns/getDefaultOptions/index.js"(exports2, module2) { "use strict"; - 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(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = getDefaultOptions; + var _index = require_defaultOptions(); + var _index2 = _interopRequireDefault(require_assign()); + function getDefaultOptions() { + return (0, _index2.default)({}, (0, _index.getDefaultOptions)()); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isBefore.js -var require_isBefore = __commonJS({ - "node_modules/date-fns/isBefore.js"(exports2) { - "use strict"; - 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; +// node_modules/date-fns/getHours/index.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(); + return hours; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isEqual.js -var require_isEqual = __commonJS({ - "node_modules/date-fns/isEqual.js"(exports2) { - "use strict"; - 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; - } - } +// node_modules/date-fns/getISODay/index.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(); + if (day === 0) { + day = 7; + } + return day; + } + module2.exports = exports2.default; + } }); -// node_modules/date-fns/isExists.js -var require_isExists = __commonJS({ - "node_modules/date-fns/isExists.js"(exports2) { +// node_modules/date-fns/getISOWeek/index.js +var require_getISOWeek = __commonJS({ + "node_modules/date-fns/getISOWeek/index.js"(exports2, module2) { "use strict"; - exports2.isExists = isExists; - function isExists(year, month, day) { - const date = new Date(year, month, day); - return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day; + 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/isFirstDayOfMonth.js -var require_isFirstDayOfMonth = __commonJS({ - "node_modules/date-fns/isFirstDayOfMonth.js"(exports2) { +// node_modules/date-fns/getISOWeeksInYear/index.js +var require_getISOWeeksInYear = __commonJS({ + "node_modules/date-fns/getISOWeeksInYear/index.js"(exports2, module2) { "use strict"; - exports2.isFirstDayOfMonth = isFirstDayOfMonth; - var _index = require_toDate(); - function isFirstDayOfMonth(date) { - return (0, _index.toDate)(date).getDate() === 1; + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isFriday.js -var require_isFriday = __commonJS({ - "node_modules/date-fns/isFriday.js"(exports2) { +// node_modules/date-fns/getMilliseconds/index.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(); + return milliseconds; + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/getMinutes/index.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(); + return minutes; + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/getMonth/index.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(); + return month; + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/getOverlappingDaysInIntervals/index.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) { + 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); + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/getSeconds/index.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(); + return seconds; + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/getTime/index.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(); + return timestamp; + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/getUnixTime/index.js +var require_getUnixTime = __commonJS({ + "node_modules/date-fns/getUnixTime/index.js"(exports2, module2) { "use strict"; - exports2.isFriday = isFriday; - var _index = require_toDate(); - function isFriday(date) { - return (0, _index.toDate)(date).getDay() === 5; + 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/isFuture.js -var require_isFuture = __commonJS({ - "node_modules/date-fns/isFuture.js"(exports2) { +// node_modules/date-fns/getWeekYear/index.js +var require_getWeekYear = __commonJS({ + "node_modules/date-fns/getWeekYear/index.js"(exports2, module2) { "use strict"; - exports2.isFuture = isFuture; - var _index = require_toDate(); - function isFuture(date) { - return +(0, _index.toDate)(date) > Date.now(); + 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/transpose.js -var require_transpose = __commonJS({ - "node_modules/date-fns/transpose.js"(exports2) { +// node_modules/date-fns/startOfWeekYear/index.js +var require_startOfWeekYear = __commonJS({ + "node_modules/date-fns/startOfWeekYear/index.js"(exports2, module2) { "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() - ); + 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/parse/_lib/Setter.js -var require_Setter = __commonJS({ - "node_modules/date-fns/parse/_lib/Setter.js"(exports2) { +// node_modules/date-fns/getWeek/index.js +var require_getWeek = __commonJS({ + "node_modules/date-fns/getWeek/index.js"(exports2, module2) { "use strict"; - exports2.ValueSetter = exports2.Setter = exports2.DateToSystemTimezoneSetter = void 0; - var _index = require_transpose(); - var _index2 = require_constructFrom(); - var TIMEZONE_UNIT_PRIORITY = 10; - var Setter = class { - subPriority = 0; - validate(_utcDate, _options) { - return true; - } - }; - exports2.Setter = Setter; - 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; - } - } - 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 = 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; + 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; + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/Parser.js -var require_Parser = __commonJS({ - "node_modules/date-fns/parse/_lib/Parser.js"(exports2) { +// node_modules/date-fns/getWeekOfMonth/index.js +var require_getWeekOfMonth = __commonJS({ + "node_modules/date-fns/getWeekOfMonth/index.js"(exports2, module2) { "use strict"; - exports2.Parser = void 0; - var _Setter = require_Setter(); - var Parser = class { - run(dateString, token, match, options) { - const 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 - }; - } - validate(_utcDate, _value, _options) { - return true; - } - }; - exports2.Parser = Parser; + 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()); + 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); + if (isNaN(currentDayOfMonth)) + return NaN; + var startWeekDay = (0, _index3.default)((0, _index4.default)(date)); + var lastDayOfFirstWeek = weekStartsOn - startWeekDay; + if (lastDayOfFirstWeek <= 0) + lastDayOfFirstWeek += 7; + var remainingDaysAfterFirstWeek = currentDayOfMonth - lastDayOfFirstWeek; + return Math.ceil(remainingDaysAfterFirstWeek / 7) + 1; + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/parsers/EraParser.js -var require_EraParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/EraParser.js"(exports2) { +// node_modules/date-fns/lastDayOfMonth/index.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; + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/getWeeksInMonth/index.js +var require_getWeeksInMonth = __commonJS({ + "node_modules/date-fns/getWeeksInMonth/index.js"(exports2, module2) { "use strict"; - exports2.EraParser = void 0; - 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" }); - } - } - 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; + 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()); + function getWeeksInMonth(date, options) { + (0, _index4.default)(1, arguments); + return (0, _index.default)((0, _index2.default)(date), (0, _index3.default)(date), options) + 1; + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/constants.js -var require_constants2 = __commonJS({ - "node_modules/date-fns/parse/_lib/constants.js"(exports2) { +// node_modules/date-fns/getYear/index.js +var require_getYear = __commonJS({ + "node_modules/date-fns/getYear/index.js"(exports2, module2) { "use strict"; - exports2.timezonePatterns = exports2.numericPatterns = void 0; - var numericPatterns = exports2.numericPatterns = { - month: /^(1[0-2]|0?\d)/, - // 0 to 12 - date: /^(3[0-1]|[0-2]?\d)/, - // 0 to 31 - dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, - // 0 to 366 - week: /^(5[0-3]|[0-4]?\d)/, - // 0 to 53 - hour23h: /^(2[0-3]|[0-1]?\d)/, - // 0 to 23 - hour24h: /^(2[0-4]|[0-1]?\d)/, - // 0 to 24 - hour11h: /^(1[0-1]|0?\d)/, - // 0 to 11 - hour12h: /^(1[0-2]|0?\d)/, - // 0 to 12 - minute: /^[0-5]?\d/, - // 0 to 59 - second: /^[0-5]?\d/, - // 0 to 59 - singleDigit: /^\d/, - // 0 to 9 - twoDigits: /^\d{1,2}/, - // 0 to 99 - threeDigits: /^\d{1,3}/, - // 0 to 999 - fourDigits: /^\d{1,4}/, - // 0 to 9999 - anyDigitsSigned: /^-?\d+/, - singleDigitSigned: /^-?\d/, - // 0 to 9, -0 to -9 - twoDigitsSigned: /^-?\d{1,2}/, - // 0 to 99, -0 to -99 - threeDigitsSigned: /^-?\d{1,3}/, - // 0 to 999, -0 to -999 - fourDigitsSigned: /^-?\d{1,4}/ - // 0 to 9999, -0 to -9999 - }; - 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/ - }; + 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(); + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/utils.js -var require_utils2 = __commonJS({ - "node_modules/date-fns/parse/_lib/utils.js"(exports2) { +// node_modules/date-fns/hoursToMilliseconds/index.js +var require_hoursToMilliseconds = __commonJS({ + "node_modules/date-fns/hoursToMilliseconds/index.js"(exports2, module2) { "use strict"; - exports2.dayPeriodEnumToHours = dayPeriodEnumToHours; - exports2.isLeapYearIndex = isLeapYearIndex; - exports2.mapValue = mapValue; - exports2.normalizeTwoDigitYear = normalizeTwoDigitYear; - exports2.parseAnyDigitsSigned = parseAnyDigitsSigned; - exports2.parseNDigits = parseNDigits; - exports2.parseNDigitsSigned = parseNDigitsSigned; - exports2.parseNumericPattern = parseNumericPattern; - exports2.parseTimezonePattern = parseTimezonePattern; - var _index = require_constants(); - var _constants = require_constants2(); - function mapValue(parseFnResult, mapFn) { - if (!parseFnResult) { - return parseFnResult; - } - return { - value: mapFn(parseFnResult.value), - rest: parseFnResult.rest - }; + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = hoursToMilliseconds; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); + function hoursToMilliseconds(hours) { + (0, _index.default)(1, arguments); + return Math.floor(hours * _index2.millisecondsInHour); } - function parseNumericPattern(pattern, dateString) { - const matchResult = dateString.match(pattern); - if (!matchResult) { - return null; - } - return { - value: parseInt(matchResult[0], 10), - rest: dateString.slice(matchResult[0].length) - }; + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/hoursToMinutes/index.js +var require_hoursToMinutes = __commonJS({ + "node_modules/date-fns/hoursToMinutes/index.js"(exports2, module2) { + "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(); + function hoursToMinutes(hours) { + (0, _index.default)(1, arguments); + return Math.floor(hours * _index2.minutesInHour); } - function parseTimezonePattern(pattern, dateString) { - const matchResult = dateString.match(pattern); - if (!matchResult) { - return null; - } - if (matchResult[0] === "Z") { - return { - value: 0, - rest: dateString.slice(1) - }; - } - 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 - ); - } - function parseNDigits(n, dateString) { - switch (n) { - case 1: - return parseNumericPattern( - _constants.numericPatterns.singleDigit, - dateString - ); - case 2: - return parseNumericPattern( - _constants.numericPatterns.twoDigits, - dateString - ); - case 3: - return parseNumericPattern( - _constants.numericPatterns.threeDigits, - dateString - ); - case 4: - return parseNumericPattern( - _constants.numericPatterns.fourDigits, - dateString - ); - default: - return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString); - } - } - function parseNDigitsSigned(n, dateString) { - switch (n) { - case 1: - return parseNumericPattern( - _constants.numericPatterns.singleDigitSigned, - dateString - ); - case 2: - return parseNumericPattern( - _constants.numericPatterns.twoDigitsSigned, - dateString - ); - case 3: - return parseNumericPattern( - _constants.numericPatterns.threeDigitsSigned, - dateString - ); - case 4: - return parseNumericPattern( - _constants.numericPatterns.fourDigitsSigned, - dateString - ); - default: - return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString); - } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/hoursToSeconds/index.js +var require_hoursToSeconds = __commonJS({ + "node_modules/date-fns/hoursToSeconds/index.js"(exports2, module2) { + "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(); + function hoursToSeconds(hours) { + (0, _index.default)(1, arguments); + return Math.floor(hours * _index2.secondsInHour); } - function dayPeriodEnumToHours(dayPeriod) { - switch (dayPeriod) { - case "morning": - return 4; - case "evening": - return 17; - case "pm": - case "noon": - case "afternoon": - return 12; - case "am": - case "midnight": - case "night": - default: - return 0; - } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/intervalToDuration/index.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()); + 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)); + return duration; } - function normalizeTwoDigitYear(twoDigitYear, currentYear) { - const isCommonEra = currentYear > 0; - const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear; - let result; - if (absCurrentYear <= 50) { - result = twoDigitYear || 100; + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/intlFormat/index.js +var require_intlFormat = __commonJS({ + "node_modules/date-fns/intlFormat/index.js"(exports2, module2) { + "use strict"; + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = intlFormat; + var _index = _interopRequireDefault(require_requiredArgs()); + function intlFormat(date, formatOrLocale, localeOptions) { + var _localeOptions; + (0, _index.default)(1, arguments); + var formatOptions; + if (isFormatOptions(formatOrLocale)) { + formatOptions = formatOrLocale; } else { - const rangeEnd = absCurrentYear + 50; - const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100; - const isPreviousCentury = twoDigitYear >= rangeEnd % 100; - result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0); + localeOptions = formatOrLocale; } - return isCommonEra ? result : 1 - result; + return new Intl.DateTimeFormat((_localeOptions = localeOptions) === null || _localeOptions === void 0 ? void 0 : _localeOptions.locale, formatOptions).format(date); } - function isLeapYearIndex(year) { - return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; + function isFormatOptions(opts) { + return opts !== void 0 && !("locale" in opts); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/parsers/YearParser.js -var require_YearParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/YearParser.js"(exports2) { +// node_modules/date-fns/intlFormatDistance/index.js +var require_intlFormatDistance = __commonJS({ + "node_modules/date-fns/intlFormatDistance/index.js"(exports2, module2) { "use strict"; - exports2.YearParser = void 0; - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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 - ); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = 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()); + 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); + if (Math.abs(diffInSeconds) < _index.secondsInMinute) { + value = (0, _index9.default)(dateLeft, dateRight); + unit = "second"; + } else if (Math.abs(diffInSeconds) < _index.secondsInHour) { + value = (0, _index8.default)(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); + unit = "hour"; + } else if (Math.abs(diffInSeconds) < _index.secondsInWeek && (value = (0, _index2.default)(dateLeft, dateRight)) && Math.abs(value) < 7) { + unit = "day"; + } else if (Math.abs(diffInSeconds) < _index.secondsInMonth) { + value = (0, _index5.default)(dateLeft, dateRight); + unit = "week"; + } else if (Math.abs(diffInSeconds) < _index.secondsInQuarter) { + value = (0, _index3.default)(dateLeft, dateRight); + unit = "month"; + } else if (Math.abs(diffInSeconds) < _index.secondsInYear) { + if ((0, _index4.default)(dateLeft, dateRight) < 4) { + value = (0, _index4.default)(dateLeft, dateRight); + unit = "quarter"; + } else { + value = (0, _index6.default)(dateLeft, dateRight); + unit = "year"; + } + } else { + value = (0, _index6.default)(dateLeft, dateRight); + unit = "year"; } - } - 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; + } else { + unit = options === null || options === void 0 ? void 0 : options.unit; + if (unit === "second") { + value = (0, _index9.default)(dateLeft, dateRight); + } else if (unit === "minute") { + value = (0, _index8.default)(dateLeft, dateRight); + } else if (unit === "hour") { + value = (0, _index7.default)(dateLeft, dateRight); + } else if (unit === "day") { + value = (0, _index2.default)(dateLeft, dateRight); + } else if (unit === "week") { + value = (0, _index5.default)(dateLeft, dateRight); + } else if (unit === "month") { + value = (0, _index3.default)(dateLeft, dateRight); + } else if (unit === "quarter") { + value = (0, _index4.default)(dateLeft, dateRight); + } else if (unit === "year") { + value = (0, _index6.default)(dateLeft, dateRight); } - 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; + 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 + }); + return rtf.format(value, unit); + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js -var require_LocalWeekYearParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js"(exports2) { +// node_modules/date-fns/isAfter/index.js +var require_isAfter = __commonJS({ + "node_modules/date-fns/isAfter/index.js"(exports2, module2) { "use strict"; - exports2.LocalWeekYearParser = void 0; - var _index = require_getWeekYear(); - var _index2 = require_startOfWeek(); - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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 - ); - } - } - 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; + 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(); + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js -var require_ISOWeekYearParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js"(exports2) { +// node_modules/date-fns/isBefore/index.js +var require_isBefore = __commonJS({ + "node_modules/date-fns/isBefore/index.js"(exports2, module2) { "use strict"; - exports2.ISOWeekYearParser = void 0; - var _index = require_startOfISOWeek(); - var _index2 = require_constructFrom(); - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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; + 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(); + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js -var require_ExtendedYearParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js"(exports2) { +// node_modules/date-fns/isEqual/index.js +var require_isEqual = __commonJS({ + "node_modules/date-fns/isEqual/index.js"(exports2, module2) { "use strict"; - exports2.ExtendedYearParser = void 0; - var _Parser = require_Parser(); - var _utils = require_utils2(); - var ExtendedYearParser = class extends _Parser.Parser { - priority = 130; - parse(dateString, token) { - if (token === "u") { - return (0, _utils.parseNDigitsSigned)(4, dateString); - } - 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; + 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(); + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/parsers/QuarterParser.js -var require_QuarterParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/QuarterParser.js"(exports2) { +// node_modules/date-fns/isExists/index.js +var require_isExists = __commonJS({ + "node_modules/date-fns/isExists/index.js"(exports2, module2) { "use strict"; - exports2.QuarterParser = void 0; - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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" - }); - } - } - 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; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isExists; + function isExists(year, month, day) { + if (arguments.length < 3) { + throw new TypeError("3 argument required, but only " + arguments.length + " present"); } - incompatibleTokens = [ - "Y", - "R", - "q", - "M", - "L", - "w", - "I", - "d", - "D", - "i", - "e", - "c", - "t", - "T" - ]; - }; - exports2.QuarterParser = QuarterParser; + var date = new Date(year, month, day); + return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day; + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js -var require_StandAloneQuarterParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js"(exports2) { +// node_modules/date-fns/isFirstDayOfMonth/index.js +var require_isFirstDayOfMonth = __commonJS({ + "node_modules/date-fns/isFirstDayOfMonth/index.js"(exports2, module2) { "use strict"; - exports2.StandAloneQuarterParser = void 0; - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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" - }); - } - } - 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; + 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; + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/parsers/MonthParser.js -var require_MonthParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/MonthParser.js"(exports2) { +// node_modules/date-fns/isFriday/index.js +var require_isFriday = __commonJS({ + "node_modules/date-fns/isFriday/index.js"(exports2, module2) { "use strict"; - exports2.MonthParser = void 0; - var _constants = require_constants2(); - 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" }); - } - } - 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; + 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; + } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js -var require_StandAloneMonthParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js"(exports2) { - "use strict"; - exports2.StandAloneMonthParser = void 0; - var _constants = require_constants2(); - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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" }); +// node_modules/date-fns/isFuture/index.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."); } - validate(_date, value) { - return value >= 0 && value <= 11; - } - set(date, _flags, value) { - date.setMonth(value, 1); - date.setHours(0, 0, 0, 0); - return date; + 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"); } - incompatibleTokens = [ - "Y", - "R", - "q", - "Q", - "M", - "w", - "I", - "D", - "i", - "e", - "c", - "t", - "T" - ]; - }; - exports2.StandAloneMonthParser = StandAloneMonthParser; + return self; + } + module2.exports = _assertThisInitialized, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; } }); -// node_modules/date-fns/setWeek.js -var require_setWeek = __commonJS({ - "node_modules/date-fns/setWeek.js"(exports2) { - "use strict"; - 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; +// 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/date-fns/parse/_lib/parsers/LocalWeekParser.js -var require_LocalWeekParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js"(exports2) { - "use strict"; - exports2.LocalWeekParser = void 0; - var _index = require_setWeek(); - var _index2 = require_startOfWeek(); - var _constants = require_constants2(); - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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); - } - } - validate(_date, value) { - return value >= 1 && value <= 53; +// 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"); } - 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; + 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/date-fns/setISOWeek.js -var require_setISOWeek = __commonJS({ - "node_modules/date-fns/setISOWeek.js"(exports2) { - "use strict"; - 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; +// 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/date-fns/parse/_lib/parsers/ISOWeekParser.js -var require_ISOWeekParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js"(exports2) { - "use strict"; - exports2.ISOWeekParser = void 0; - var _index = require_setISOWeek(); - var _index2 = require_startOfISOWeek(); - var _constants = require_constants2(); - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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; +// 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/date-fns/parse/_lib/parsers/DateParser.js -var require_DateParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/DateParser.js"(exports2) { - "use strict"; - exports2.DateParser = void 0; - 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 = 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); - } - } - 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]; - } - } - set(date, _flags, value) { - date.setDate(value); - date.setHours(0, 0, 0, 0); - return date; +// 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"); } - incompatibleTokens = [ - "Y", - "R", - "q", - "Q", - "w", - "I", - "D", - "i", - "e", - "c", - "t", - "T" - ]; - }; - exports2.DateParser = DateParser; + return assertThisInitialized(self); + } + module2.exports = _possibleConstructorReturn, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; } }); -// node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js -var require_DayOfYearParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js"(exports2) { - "use strict"; - exports2.DayOfYearParser = void 0; - var _constants = require_constants2(); - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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); - } - } - validate(date, value) { - const year = date.getFullYear(); - const isLeapYear = (0, _utils.isLeapYearIndex)(year); - if (isLeapYear) { - return value >= 1 && value <= 366; +// 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 { - return value >= 1 && value <= 365; + 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"); } - set(date, _flags, value) { - date.setMonth(0, value); - date.setHours(0, 0, 0, 0); - return date; + } + 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."); } - incompatibleTokens = [ - "Y", - "R", - "q", - "Q", - "M", - "L", - "w", - "I", - "d", - "E", - "i", - "e", - "c", - "t", - "T" - ]; - }; - exports2.DayOfYearParser = DayOfYearParser; + return (hint === "string" ? String : Number)(input); + } + module2.exports = _toPrimitive, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; } }); -// node_modules/date-fns/setDay.js -var require_setDay = __commonJS({ - "node_modules/date-fns/setDay.js"(exports2) { - "use strict"; - 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); +// 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/date-fns/parse/_lib/parsers/DayParser.js -var require_DayParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/DayParser.js"(exports2) { - "use strict"; - exports2.DayParser = void 0; - 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" }); - } - } - validate(_date, value) { - return value >= 0 && value <= 6; +// 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); } - set(date, _flags, value, options) { - date = (0, _index.setDay)(date, value, options); - date.setHours(0, 0, 0, 0); - return date; + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) + _defineProperties(Constructor.prototype, protoProps); + if (staticProps) + _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + 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; } - incompatibleTokens = ["D", "i", "e", "c", "t", "T"]; - }; - exports2.DayParser = DayParser; + return obj; + } + module2.exports = _defineProperty, module2.exports.__esModule = true, module2.exports["default"] = module2.exports; } }); -// node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js -var require_LocalDayParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js"(exports2) { +// node_modules/date-fns/parse/_lib/Setter.js +var require_Setter = __commonJS({ + "node_modules/date-fns/parse/_lib/Setter.js"(exports2) { "use strict"; - exports2.LocalDayParser = void 0; - var _index = require_setDay(); - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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" }); + 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 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; + }(); + 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; + if (subPriority) { + _this.subPriority = subPriority; + } + return _this; } - 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; + (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); + 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); + exports2.DateToSystemTimezoneSetter = DateToSystemTimezoneSetter; + } +}); + +// node_modules/date-fns/parse/_lib/Parser.js +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; + } + }]); + return Parser2; + }(); + exports2.Parser = Parser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/EraParser.js +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; + } + }]); + return EraParser2; + }(_Parser2.Parser); + exports2.EraParser = EraParser; + } +}); + +// node_modules/date-fns/parse/_lib/constants.js +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 = { + month: /^(1[0-2]|0?\d)/, + // 0 to 12 + date: /^(3[0-1]|[0-2]?\d)/, + // 0 to 31 + dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, + // 0 to 366 + week: /^(5[0-3]|[0-4]?\d)/, + // 0 to 53 + hour23h: /^(2[0-3]|[0-1]?\d)/, + // 0 to 23 + hour24h: /^(2[0-4]|[0-1]?\d)/, + // 0 to 24 + hour11h: /^(1[0-1]|0?\d)/, + // 0 to 11 + hour12h: /^(1[0-2]|0?\d)/, + // 0 to 12 + minute: /^[0-5]?\d/, + // 0 to 59 + second: /^[0-5]?\d/, + // 0 to 59 + singleDigit: /^\d/, + // 0 to 9 + twoDigits: /^\d{1,2}/, + // 0 to 99 + threeDigits: /^\d{1,3}/, + // 0 to 999 + fourDigits: /^\d{1,4}/, + // 0 to 9999 + anyDigitsSigned: /^-?\d+/, + singleDigitSigned: /^-?\d/, + // 0 to 9, -0 to -9 + twoDigitsSigned: /^-?\d{1,2}/, + // 0 to 99, -0 to -99 + threeDigitsSigned: /^-?\d{1,3}/, + // 0 to 999, -0 to -999 + fourDigitsSigned: /^-?\d{1,4}/ + // 0 to 9999, -0 to -9999 + }; + exports2.numericPatterns = numericPatterns; + var 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; + } +}); + +// node_modules/date-fns/parse/_lib/utils.js +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; + exports2.normalizeTwoDigitYear = normalizeTwoDigitYear; + exports2.parseAnyDigitsSigned = parseAnyDigitsSigned; + exports2.parseNDigits = parseNDigits; + exports2.parseNDigitsSigned = parseNDigitsSigned; + exports2.parseNumericPattern = parseNumericPattern; + exports2.parseTimezonePattern = parseTimezonePattern; + var _index = require_constants(); + var _constants = require_constants2(); + function mapValue(parseFnResult, mapFn) { + if (!parseFnResult) { + return parseFnResult; + } + return { + value: mapFn(parseFnResult.value), + rest: parseFnResult.rest + }; + } + function parseNumericPattern(pattern, dateString) { + var matchResult = dateString.match(pattern); + if (!matchResult) { + return null; + } + return { + value: parseInt(matchResult[0], 10), + rest: dateString.slice(matchResult[0].length) + }; + } + function parseTimezonePattern(pattern, dateString) { + var matchResult = dateString.match(pattern); + if (!matchResult) { + return null; + } + if (matchResult[0] === "Z") { + return { + value: 0, + 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; + 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); + } + function parseNDigits(n, dateString) { + switch (n) { + case 1: + return parseNumericPattern(_constants.numericPatterns.singleDigit, dateString); + case 2: + return parseNumericPattern(_constants.numericPatterns.twoDigits, dateString); + case 3: + return parseNumericPattern(_constants.numericPatterns.threeDigits, dateString); + case 4: + return parseNumericPattern(_constants.numericPatterns.fourDigits, dateString); + default: + return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString); + } + } + function parseNDigitsSigned(n, dateString) { + switch (n) { + case 1: + return parseNumericPattern(_constants.numericPatterns.singleDigitSigned, dateString); + case 2: + return parseNumericPattern(_constants.numericPatterns.twoDigitsSigned, dateString); + case 3: + return parseNumericPattern(_constants.numericPatterns.threeDigitsSigned, dateString); + case 4: + return parseNumericPattern(_constants.numericPatterns.fourDigitsSigned, dateString); + default: + return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString); + } + } + function dayPeriodEnumToHours(dayPeriod) { + switch (dayPeriod) { + case "morning": + return 4; + case "evening": + return 17; + case "pm": + case "noon": + case "afternoon": + return 12; + case "am": + case "midnight": + case "night": + default: + return 0; + } + } + function normalizeTwoDigitYear(twoDigitYear, currentYear) { + var isCommonEra = currentYear > 0; + var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear; + var result; + if (absCurrentYear <= 50) { + result = twoDigitYear || 100; + } else { + var rangeEnd = absCurrentYear + 50; + var rangeEndCentury = Math.floor(rangeEnd / 100) * 100; + var isPreviousCentury = twoDigitYear >= rangeEnd % 100; + result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0); + } + return isCommonEra ? result : 1 - result; + } + function isLeapYearIndex(year) { + return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; + } + } +}); + +// node_modules/date-fns/parse/_lib/parsers/YearParser.js +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 _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, { + unit: "year" + }), 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); + return date; + } + }]); + return YearParser2; + }(_Parser2.Parser); + exports2.YearParser = YearParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +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 _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, { + unit: "year" + }), 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); + exports2.LocalWeekYearParser = LocalWeekYearParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +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 _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); + exports2.ISOWeekYearParser = ISOWeekYearParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js +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 _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; + } + }]); + return ExtendedYearParser2; + }(_Parser2.Parser); + exports2.ExtendedYearParser = ExtendedYearParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/QuarterParser.js +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 _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; + } + }]); + return QuarterParser2; + }(_Parser2.Parser); + exports2.QuarterParser = QuarterParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +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 _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; + } + }]); + return StandAloneQuarterParser2; + }(_Parser2.Parser); + exports2.StandAloneQuarterParser = StandAloneQuarterParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/MonthParser.js +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, { + 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; + } + }]); + return MonthParser2; + }(_Parser2.Parser); + exports2.MonthParser = MonthParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +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 _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, { + 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; + } + }]); + return StandAloneMonthParser2; + }(_Parser2.Parser); + 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) { + "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; + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js +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 _constants = require_constants2(); + 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); + } + }]); + return LocalWeekParser2; + }(_Parser2.Parser); + 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) { + "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; + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js +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 _constants = require_constants2(); + 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); + exports2.ISOWeekParser = ISOWeekParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/DateParser.js +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 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]; + } + } + }, { + key: "set", + value: function set(date, _flags, value) { + date.setUTCDate(value); + date.setUTCHours(0, 0, 0, 0); + return date; + } + }]); + return DateParser2; + }(_Parser2.Parser); + exports2.DateParser = DateParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js +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 _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; + } + } + }, { + key: "set", + value: function set(date, _flags, value) { + date.setUTCMonth(0, value); + date.setUTCHours(0, 0, 0, 0); + return date; + } + }]); + return DayOfYearParser2; + }(_Parser2.Parser); + 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) { + "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; + } + module2.exports = exports2.default; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/DayParser.js +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; + } + }]); + return DayParser2; + }(_Parser2.Parser); + exports2.DayParser = DayParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js +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 _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, { + 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; + } + }]); + return LocalDayParser2; + }(_Parser2.Parser); + exports2.LocalDayParser = LocalDayParser; } }); @@ -8251,95 +10352,137 @@ 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 _index = require_setDay(); - var _Parser = require_Parser(); + 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 _utils = require_utils2(); - 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, { + 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, { 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" }); + }), 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" + }); + } } - } - 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" - ]; - }; + }, { + 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; + } + }]); + return StandAloneLocalDayParser2; + }(_Parser2.Parser); exports2.StandAloneLocalDayParser = StandAloneLocalDayParser; } }); -// node_modules/date-fns/setISODay.js -var require_setISODay = __commonJS({ - "node_modules/date-fns/setISODay.js"(exports2) { +// node_modules/date-fns/_lib/setUTCISODay/index.js +var require_setUTCISODay = __commonJS({ + "node_modules/date-fns/_lib/setUTCISODay/index.js"(exports2, module2) { "use strict"; - 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); + 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; } + module2.exports = exports2.default; } }); @@ -8347,28 +10490,53 @@ var require_setISODay = __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 _index = require_setISODay(); - var _Parser = require_Parser(); + 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 _utils = require_utils2(); - 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, { + 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, { width: "abbreviated", context: "formatting" }) || match.day(dateString, { @@ -8377,32 +10545,23 @@ 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, { @@ -8414,87 +10573,101 @@ var require_ISODayParser = __commonJS({ }) || match.day(dateString, { width: "narrow", context: "formatting" - }), - valueCallback - ); + }), valueCallback); + } } - } - 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; - } -}); - -// node_modules/date-fns/parse/_lib/parsers/AMPMParser.js -var require_AMPMParser = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers/AMPMParser.js"(exports2) { - "use strict"; - exports2.AMPMParser = void 0; - var _Parser = require_Parser(); - var _utils = require_utils2(); - 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" - }); + }, { + 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; + } + }]); + return ISODayParser2; + }(_Parser2.Parser); + exports2.ISODayParser = ISODayParser; + } +}); + +// node_modules/date-fns/parse/_lib/parsers/AMPMParser.js +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 _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" + }); + } } - } - set(date, _flags, value) { - date.setHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); - return date; - } - incompatibleTokens = ["b", "B", "H", "k", "t", "T"]; - }; + }, { + key: "set", + value: function set(date, _flags, value) { + date.setUTCHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); + return date; + } + }]); + return AMPMParser2; + }(_Parser2.Parser); exports2.AMPMParser = AMPMParser; } }); @@ -8503,48 +10676,75 @@ 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 _Parser = require_Parser(); + 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 _utils = require_utils2(); - 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" - }); + 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" + }); + } } - } - set(date, _flags, value) { - date.setHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); - return date; - } - incompatibleTokens = ["a", "B", "H", "k", "t", "T"]; - }; + }, { + key: "set", + value: function set(date, _flags, value) { + date.setUTCHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); + return date; + } + }]); + return AMPMMidnightParser2; + }(_Parser2.Parser); exports2.AMPMMidnightParser = AMPMMidnightParser; } }); @@ -8553,48 +10753,75 @@ 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 _Parser = require_Parser(); + 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 _utils = require_utils2(); - 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" - }); + 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" + }); + } } - } - set(date, _flags, value) { - date.setHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); - return date; - } - incompatibleTokens = ["a", "b", "t", "T"]; - }; + }, { + key: "set", + value: function set(date, _flags, value) { + date.setUTCHours((0, _utils.dayPeriodEnumToHours)(value), 0, 0, 0); + return date; + } + }]); + return DayPeriodParser2; + }(_Parser2.Parser); exports2.DayPeriodParser = DayPeriodParser; } }); @@ -8603,41 +10830,69 @@ 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 = 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); + 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); + } } - } - 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); + }, { + 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; } - return date; - } - incompatibleTokens = ["H", "K", "k", "t", "T"]; - }; + }]); + return Hour1to12Parser2; + }(_Parser2.Parser); exports2.Hour1to12Parser = Hour1to12Parser; } }); @@ -8646,34 +10901,62 @@ 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 = 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); + 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); + } } - } - 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"]; - }; + }, { + 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; + } + }]); + return Hour0to23Parser2; + }(_Parser2.Parser); exports2.Hour0to23Parser = Hour0to23Parser; } }); @@ -8682,39 +10965,67 @@ 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 = 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); + 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); + } } - } - 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); + }, { + 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; } - return date; - } - incompatibleTokens = ["h", "H", "k", "t", "T"]; - }; + }]); + return Hour0To11Parser2; + }(_Parser2.Parser); exports2.Hour0To11Parser = Hour0To11Parser; } }); @@ -8723,35 +11034,63 @@ 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 = 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); + 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); + } } - } - 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"]; - }; + }, { + 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; + } + }]); + return Hour1To24Parser2; + }(_Parser2.Parser); exports2.Hour1To24Parser = Hour1To24Parser; } }); @@ -8760,34 +11099,62 @@ 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 = 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); + 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); + } } - } - validate(_date, value) { - return value >= 0 && value <= 59; - } - set(date, _flags, value) { - date.setMinutes(value, 0, 0); - return date; - } - incompatibleTokens = ["t", "T"]; - }; + }, { + 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; + } + }]); + return MinuteParser2; + }(_Parser2.Parser); exports2.MinuteParser = MinuteParser; } }); @@ -8796,34 +11163,62 @@ 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 = 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); + 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); + } } - } - validate(_date, value) { - return value >= 0 && value <= 59; - } - set(date, _flags, value) { - date.setSeconds(value, 0); - return date; - } - incompatibleTokens = ["t", "T"]; - }; + }, { + 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; + } + }]); + return SecondParser2; + }(_Parser2.Parser); exports2.SecondParser = SecondParser; } }); @@ -8832,24 +11227,50 @@ 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 _Parser = require_Parser(); + 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 _utils = require_utils2(); - 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"]; - }; + 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); exports2.FractionOfSecondParser = FractionOfSecondParser; } }); @@ -8858,54 +11279,62 @@ 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 _index = require_constructFrom(); - var _index2 = require_getTimezoneOffsetInMilliseconds(); + 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 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 - ); + 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); + } } - } - 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"]; - }; + }, { + key: "set", + value: function set(date, flags, value) { + if (flags.timestampIsSet) { + return date; + } + return new Date(date.getTime() - value); + } + }]); + return ISOTimezoneWithZParser2; + }(_Parser2.Parser); exports2.ISOTimezoneWithZParser = ISOTimezoneWithZParser; } }); @@ -8914,54 +11343,62 @@ 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 _index = require_constructFrom(); - var _index2 = require_getTimezoneOffsetInMilliseconds(); + 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 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 - ); + 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); } - } - 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"]; - }; + }]); + return ISOTimezoneParser2; + }(_Parser2.Parser); exports2.ISOTimezoneParser = ISOTimezoneParser; } }); @@ -8970,23 +11407,48 @@ 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 _index = require_constructFrom(); - var _Parser = require_Parser(); + 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 _utils = require_utils2(); - 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 = "*"; - }; + 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); exports2.TimestampSecondsParser = TimestampSecondsParser; } }); @@ -8995,28 +11457,59 @@ 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 _index = require_constructFrom(); - var _Parser = require_Parser(); + 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 _utils = require_utils2(); - 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 = "*"; - }; + 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); exports2.TimestampMillisecondsParser = TimestampMillisecondsParser; } }); -// node_modules/date-fns/parse/_lib/parsers.js +// node_modules/date-fns/parse/_lib/parsers/index.js var require_parsers = __commonJS({ - "node_modules/date-fns/parse/_lib/parsers.js"(exports2) { + "node_modules/date-fns/parse/_lib/parsers/index.js"(exports2) { "use strict"; + Object.defineProperty(exports2, "__esModule", { + value: true + }); exports2.parsers = void 0; var _EraParser = require_EraParser(); var _YearParser = require_YearParser(); @@ -9049,7 +11542,7 @@ var require_parsers = __commonJS({ var _ISOTimezoneParser = require_ISOTimezoneParser(); var _TimestampSecondsParser = require_TimestampSecondsParser(); var _TimestampMillisecondsParser = require_TimestampMillisecondsParser(); - var parsers = exports2.parsers = { + var parsers = { G: new _EraParser.EraParser(), y: new _YearParser.YearParser(), Y: new _LocalWeekYearParser.LocalWeekYearParser(), @@ -9082,969 +11575,1393 @@ var require_parsers = __commonJS({ t: new _TimestampSecondsParser.TimestampSecondsParser(), T: new _TimestampMillisecondsParser.TimestampMillisecondsParser() }; + exports2.parsers = parsers; } }); -// node_modules/date-fns/parse.js +// node_modules/date-fns/parse/index.js var require_parse = __commonJS({ - "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(); + "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()); 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(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); + 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); } else { - return (0, _index.constructFrom)(referenceDate, NaN); + return /* @__PURE__ */ new Date(NaN); } } - const subFnOptions = { + var subFnOptions = { firstWeekContainsDate, weekStartsOn, locale }; - 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]; + 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]; return longFormatter(substring, locale.formatLong); } return substring; }).join("").match(formattingTokensRegExp); - 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` - ); - } - usedTokens.push({ token: firstCharacter, fullToken: token }); - const parseResult = parser.run( - dateStr, - token, - locale.match, - subFnOptions - ); - if (!parseResult) { - return (0, _index.constructFrom)(referenceDate, NaN); - } - setters.push(parseResult.setter); - dateStr = parseResult.rest; - } else { - if (firstCharacter.match(unescapedLatinCharacterRegExp)) { - throw new RangeError( - "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" - ); + 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); } - if (token === "''") { - token = "'"; - } else if (firstCharacter === "'") { - token = cleanEscapedString(token); + if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && (0, _index7.isProtectedDayOfYearToken)(token)) { + (0, _index7.throwProtectedError)(token, formatString, dirtyDateString); } - if (dateStr.indexOf(token) === 0) { - dateStr = dateStr.slice(token.length); + 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; } else { - return (0, _index.constructFrom)(referenceDate, NaN); + 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) + }; + } } + }; + 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 (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) { - return (0, _index.constructFrom)(referenceDate, NaN); + if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) { + return /* @__PURE__ */ new Date(NaN); } - 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); + 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); if (isNaN(date.getTime())) { - return (0, _index.constructFrom)(referenceDate, NaN); + return /* @__PURE__ */ new Date(NaN); } - 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; + 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; + } } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); } - return (0, _index.constructFrom)(referenceDate, date); + return utcDate; } function cleanEscapedString(input) { return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'"); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isMatch.js +// node_modules/date-fns/isMatch/index.js var require_isMatch = __commonJS({ - "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) - ); + "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)); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isMonday.js +// node_modules/date-fns/isMonday/index.js var require_isMonday = __commonJS({ - "node_modules/date-fns/isMonday.js"(exports2) { + "node_modules/date-fns/isMonday/index.js"(exports2, module2) { "use strict"; - exports2.isMonday = isMonday; - var _index = require_toDate(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = isMonday; + var _index = _interopRequireDefault(require_toDate()); + var _index2 = _interopRequireDefault(require_requiredArgs()); function isMonday(date) { - return (0, _index.toDate)(date).getDay() === 1; + (0, _index2.default)(1, arguments); + return (0, _index.default)(date).getDay() === 1; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isPast.js +// node_modules/date-fns/isPast/index.js var require_isPast = __commonJS({ - "node_modules/date-fns/isPast.js"(exports2) { + "node_modules/date-fns/isPast/index.js"(exports2, module2) { "use strict"; - exports2.isPast = isPast; - var _index = require_toDate(); - function isPast(date) { - return +(0, _index.toDate)(date) < Date.now(); + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfHour.js +// node_modules/date-fns/startOfHour/index.js var require_startOfHour = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameHour.js +// node_modules/date-fns/isSameHour/index.js var require_isSameHour = __commonJS({ - "node_modules/date-fns/isSameHour.js"(exports2) { + "node_modules/date-fns/isSameHour/index.js"(exports2, module2) { "use strict"; - 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; + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameWeek.js +// node_modules/date-fns/isSameWeek/index.js var require_isSameWeek = __commonJS({ - "node_modules/date-fns/isSameWeek.js"(exports2) { + "node_modules/date-fns/isSameWeek/index.js"(exports2, module2) { "use strict"; - 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; + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameISOWeek.js +// node_modules/date-fns/isSameISOWeek/index.js var require_isSameISOWeek = __commonJS({ - "node_modules/date-fns/isSameISOWeek.js"(exports2) { + "node_modules/date-fns/isSameISOWeek/index.js"(exports2, module2) { "use strict"; - exports2.isSameISOWeek = isSameISOWeek; - var _index = require_isSameWeek(); - function isSameISOWeek(dateLeft, dateRight) { - return (0, _index.isSameWeek)(dateLeft, dateRight, { weekStartsOn: 1 }); + 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 + }); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameISOWeekYear.js +// node_modules/date-fns/isSameISOWeekYear/index.js var require_isSameISOWeekYear = __commonJS({ - "node_modules/date-fns/isSameISOWeekYear.js"(exports2) { + "node_modules/date-fns/isSameISOWeekYear/index.js"(exports2, module2) { "use strict"; - 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; + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameMinute.js +// node_modules/date-fns/isSameMinute/index.js var require_isSameMinute = __commonJS({ - "node_modules/date-fns/isSameMinute.js"(exports2) { + "node_modules/date-fns/isSameMinute/index.js"(exports2, module2) { "use strict"; - 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; + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameMonth.js +// node_modules/date-fns/isSameMonth/index.js var require_isSameMonth = __commonJS({ - "node_modules/date-fns/isSameMonth.js"(exports2) { + "node_modules/date-fns/isSameMonth/index.js"(exports2, module2) { "use strict"; - 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(); + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameQuarter.js +// node_modules/date-fns/isSameQuarter/index.js var require_isSameQuarter = __commonJS({ - "node_modules/date-fns/isSameQuarter.js"(exports2) { + "node_modules/date-fns/isSameQuarter/index.js"(exports2, module2) { "use strict"; - 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; + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfSecond.js +// node_modules/date-fns/startOfSecond/index.js var require_startOfSecond = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameSecond.js +// node_modules/date-fns/isSameSecond/index.js var require_isSameSecond = __commonJS({ - "node_modules/date-fns/isSameSecond.js"(exports2) { + "node_modules/date-fns/isSameSecond/index.js"(exports2, module2) { "use strict"; - 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; + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isSameYear.js +// node_modules/date-fns/isSameYear/index.js var require_isSameYear = __commonJS({ - "node_modules/date-fns/isSameYear.js"(exports2) { + "node_modules/date-fns/isSameYear/index.js"(exports2, module2) { "use strict"; - 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(); + 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(); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisHour.js +// node_modules/date-fns/isThisHour/index.js var require_isThisHour = __commonJS({ - "node_modules/date-fns/isThisHour.js"(exports2) { + "node_modules/date-fns/isThisHour/index.js"(exports2, module2) { "use strict"; - exports2.isThisHour = isThisHour; - var _index = require_constructNow(); - var _index2 = require_isSameHour(); - function isThisHour(date) { - return (0, _index2.isSameHour)(date, (0, _index.constructNow)(date)); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisISOWeek.js +// node_modules/date-fns/isThisISOWeek/index.js var require_isThisISOWeek = __commonJS({ - "node_modules/date-fns/isThisISOWeek.js"(exports2) { + "node_modules/date-fns/isThisISOWeek/index.js"(exports2, module2) { "use strict"; - exports2.isThisISOWeek = isThisISOWeek; - var _index = require_constructNow(); - var _index2 = require_isSameISOWeek(); - function isThisISOWeek(date) { - return (0, _index2.isSameISOWeek)(date, (0, _index.constructNow)(date)); + 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()); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisMinute.js +// node_modules/date-fns/isThisMinute/index.js var require_isThisMinute = __commonJS({ - "node_modules/date-fns/isThisMinute.js"(exports2) { + "node_modules/date-fns/isThisMinute/index.js"(exports2, module2) { "use strict"; - exports2.isThisMinute = isThisMinute; - var _index = require_constructNow(); - var _index2 = require_isSameMinute(); - function isThisMinute(date) { - return (0, _index2.isSameMinute)(date, (0, _index.constructNow)(date)); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisMonth.js +// node_modules/date-fns/isThisMonth/index.js var require_isThisMonth = __commonJS({ - "node_modules/date-fns/isThisMonth.js"(exports2) { + "node_modules/date-fns/isThisMonth/index.js"(exports2, module2) { "use strict"; - exports2.isThisMonth = isThisMonth; - var _index = require_constructNow(); - var _index2 = require_isSameMonth(); - function isThisMonth(date) { - return (0, _index2.isSameMonth)(date, (0, _index.constructNow)(date)); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisQuarter.js +// node_modules/date-fns/isThisQuarter/index.js var require_isThisQuarter = __commonJS({ - "node_modules/date-fns/isThisQuarter.js"(exports2) { + "node_modules/date-fns/isThisQuarter/index.js"(exports2, module2) { "use strict"; - exports2.isThisQuarter = isThisQuarter; - var _index = require_constructNow(); - var _index2 = require_isSameQuarter(); - function isThisQuarter(date) { - return (0, _index2.isSameQuarter)(date, (0, _index.constructNow)(date)); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisSecond.js +// node_modules/date-fns/isThisSecond/index.js var require_isThisSecond = __commonJS({ - "node_modules/date-fns/isThisSecond.js"(exports2) { + "node_modules/date-fns/isThisSecond/index.js"(exports2, module2) { "use strict"; - exports2.isThisSecond = isThisSecond; - var _index = require_constructNow(); - var _index2 = require_isSameSecond(); - function isThisSecond(date) { - return (0, _index2.isSameSecond)(date, (0, _index.constructNow)(date)); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisWeek.js +// node_modules/date-fns/isThisWeek/index.js var require_isThisWeek = __commonJS({ - "node_modules/date-fns/isThisWeek.js"(exports2) { + "node_modules/date-fns/isThisWeek/index.js"(exports2, module2) { "use strict"; - 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); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isThisYear.js +// node_modules/date-fns/isThisYear/index.js var require_isThisYear = __commonJS({ - "node_modules/date-fns/isThisYear.js"(exports2) { + "node_modules/date-fns/isThisYear/index.js"(exports2, module2) { "use strict"; - exports2.isThisYear = isThisYear; - var _index = require_constructNow(); - var _index2 = require_isSameYear(); - function isThisYear(date) { - return (0, _index2.isSameYear)(date, (0, _index.constructNow)(date)); + 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()); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isThursday.js +// node_modules/date-fns/isThursday/index.js var require_isThursday = __commonJS({ - "node_modules/date-fns/isThursday.js"(exports2) { + "node_modules/date-fns/isThursday/index.js"(exports2, module2) { "use strict"; - exports2.isThursday = isThursday; - var _index = require_toDate(); - function isThursday(date) { - return (0, _index.toDate)(date).getDay() === 4; + 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isToday.js +// node_modules/date-fns/isToday/index.js var require_isToday = __commonJS({ - "node_modules/date-fns/isToday.js"(exports2) { + "node_modules/date-fns/isToday/index.js"(exports2, module2) { "use strict"; - exports2.isToday = isToday; - var _index = require_constructNow(); - var _index2 = require_isSameDay(); - function isToday(date) { - return (0, _index2.isSameDay)(date, (0, _index.constructNow)(date)); + 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()); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isTomorrow.js +// node_modules/date-fns/isTomorrow/index.js var require_isTomorrow = __commonJS({ - "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) - ); + "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)); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isTuesday.js +// node_modules/date-fns/isTuesday/index.js var require_isTuesday = __commonJS({ - "node_modules/date-fns/isTuesday.js"(exports2) { + "node_modules/date-fns/isTuesday/index.js"(exports2, module2) { "use strict"; - exports2.isTuesday = isTuesday; - var _index = require_toDate(); - function isTuesday(date) { - return (0, _index.toDate)(date).getDay() === 2; + 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isWednesday.js +// node_modules/date-fns/isWednesday/index.js var require_isWednesday = __commonJS({ - "node_modules/date-fns/isWednesday.js"(exports2) { + "node_modules/date-fns/isWednesday/index.js"(exports2, module2) { "use strict"; - exports2.isWednesday = isWednesday; - var _index = require_toDate(); - function isWednesday(date) { - return (0, _index.toDate)(date).getDay() === 3; + 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isWithinInterval.js +// node_modules/date-fns/isWithinInterval/index.js var require_isWithinInterval = __commonJS({ - "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); + "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"); + } return time >= startTime && time <= endTime; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/subDays.js +// node_modules/date-fns/subDays/index.js var require_subDays = __commonJS({ - "node_modules/date-fns/subDays.js"(exports2) { + "node_modules/date-fns/subDays/index.js"(exports2, module2) { "use strict"; - exports2.subDays = subDays; - var _index = require_addDays(); - function subDays(date, amount) { - return (0, _index.addDays)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/isYesterday.js +// node_modules/date-fns/isYesterday/index.js var require_isYesterday = __commonJS({ - "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) - ); + "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)); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfDecade.js +// node_modules/date-fns/lastDayOfDecade/index.js var require_lastDayOfDecade = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfWeek.js +// node_modules/date-fns/lastDayOfWeek/index.js var require_lastDayOfWeek = __commonJS({ - "node_modules/date-fns/lastDayOfWeek.js"(exports2) { + "node_modules/date-fns/lastDayOfWeek/index.js"(exports2, module2) { "use strict"; - 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; + 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfISOWeek.js +// node_modules/date-fns/lastDayOfISOWeek/index.js var require_lastDayOfISOWeek = __commonJS({ - "node_modules/date-fns/lastDayOfISOWeek.js"(exports2) { + "node_modules/date-fns/lastDayOfISOWeek/index.js"(exports2, module2) { "use strict"; - exports2.lastDayOfISOWeek = lastDayOfISOWeek; - var _index = require_lastDayOfWeek(); - function lastDayOfISOWeek(date) { - return (0, _index.lastDayOfWeek)(date, { weekStartsOn: 1 }); + 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 + }); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfISOWeekYear.js +// node_modules/date-fns/lastDayOfISOWeekYear/index.js var require_lastDayOfISOWeekYear = __commonJS({ - "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); + "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); fourthOfJanuary.setFullYear(year + 1, 0, 4); fourthOfJanuary.setHours(0, 0, 0, 0); - const _date = (0, _index2.startOfISOWeek)(fourthOfJanuary); - _date.setDate(_date.getDate() - 1); - return _date; + var date = (0, _index2.default)(fourthOfJanuary); + date.setDate(date.getDate() - 1); + return date; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfQuarter.js +// node_modules/date-fns/lastDayOfQuarter/index.js var require_lastDayOfQuarter = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/lastDayOfYear.js +// node_modules/date-fns/lastDayOfYear/index.js var require_lastDayOfYear = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/lightFormat.js +// node_modules/date-fns/lightFormat/index.js var require_lightFormat = __commonJS({ - "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(); + "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()); var formattingTokensRegExp = /(\w)\1*|''|'(''|[^'])+('|$)|./g; var escapedStringRegExp = /^'([^]*?)'?$/; var doubleQuoteRegExp = /''/g; var unescapedLatinCharacterRegExp = /[a-zA-Z]/; - function lightFormat(date, formatStr) { - const _date = (0, _index2.toDate)(date); - if (!(0, _index.isValid)(_date)) { + function lightFormat(dirtyDate, formatStr) { + (0, _index6.default)(2, arguments); + var originalDate = (0, _index.default)(dirtyDate); + if (!(0, _index4.default)(originalDate)) { throw new RangeError("Invalid time value"); } - const tokens = formatStr.match(formattingTokensRegExp); + var timezoneOffset = (0, _index3.default)(originalDate); + var utcDate = (0, _index5.default)(originalDate, timezoneOffset); + var tokens = formatStr.match(formattingTokensRegExp); if (!tokens) return ""; - const result = tokens.map((substring) => { + var result = tokens.map(function(substring) { if (substring === "''") { return "'"; } - const firstCharacter = substring[0]; + var firstCharacter = substring[0]; if (firstCharacter === "'") { return cleanEscapedString(substring); } - const formatter = _index3.lightFormatters[firstCharacter]; + var formatter = _index2.default[firstCharacter]; if (formatter) { - return formatter(_date, substring); + return formatter(utcDate, 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) { - const matches = input.match(escapedStringRegExp); + var matches = input.match(escapedStringRegExp); if (!matches) { return input; } return matches[1].replace(doubleQuoteRegExp, "'"); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/milliseconds.js +// node_modules/date-fns/milliseconds/index.js var require_milliseconds = __commonJS({ - "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; + "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; if (years) - totalDays += years * _index.daysInYear; + totalDays += years * daysInYear; if (months) - totalDays += months * (_index.daysInYear / 12); + totalDays += months * (daysInYear / 12); if (weeks) totalDays += weeks * 7; if (days) totalDays += days; - let totalSeconds = totalDays * 24 * 60 * 60; + var totalSeconds = totalDays * 24 * 60 * 60; if (hours) totalSeconds += hours * 60 * 60; if (minutes) totalSeconds += minutes * 60; if (seconds) totalSeconds += seconds; - return Math.trunc(totalSeconds * 1e3); + return Math.round(totalSeconds * 1e3); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/millisecondsToHours.js +// node_modules/date-fns/millisecondsToHours/index.js var require_millisecondsToHours = __commonJS({ - "node_modules/date-fns/millisecondsToHours.js"(exports2) { + "node_modules/date-fns/millisecondsToHours/index.js"(exports2, module2) { "use strict"; - exports2.millisecondsToHours = millisecondsToHours; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = millisecondsToHours; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function millisecondsToHours(milliseconds) { - const hours = milliseconds / _index.millisecondsInHour; - return Math.trunc(hours); + (0, _index.default)(1, arguments); + var hours = milliseconds / _index2.millisecondsInHour; + return Math.floor(hours); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/millisecondsToMinutes.js +// node_modules/date-fns/millisecondsToMinutes/index.js var require_millisecondsToMinutes = __commonJS({ - "node_modules/date-fns/millisecondsToMinutes.js"(exports2) { + "node_modules/date-fns/millisecondsToMinutes/index.js"(exports2, module2) { "use strict"; - exports2.millisecondsToMinutes = millisecondsToMinutes; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = millisecondsToMinutes; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function millisecondsToMinutes(milliseconds) { - const minutes = milliseconds / _index.millisecondsInMinute; - return Math.trunc(minutes); + (0, _index.default)(1, arguments); + var minutes = milliseconds / _index2.millisecondsInMinute; + return Math.floor(minutes); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/millisecondsToSeconds.js +// node_modules/date-fns/millisecondsToSeconds/index.js var require_millisecondsToSeconds = __commonJS({ - "node_modules/date-fns/millisecondsToSeconds.js"(exports2) { + "node_modules/date-fns/millisecondsToSeconds/index.js"(exports2, module2) { "use strict"; - exports2.millisecondsToSeconds = millisecondsToSeconds; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = millisecondsToSeconds; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function millisecondsToSeconds(milliseconds) { - const seconds = milliseconds / _index.millisecondsInSecond; - return Math.trunc(seconds); + (0, _index.default)(1, arguments); + var seconds = milliseconds / _index2.millisecondsInSecond; + return Math.floor(seconds); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/minutesToHours.js +// node_modules/date-fns/minutesToHours/index.js var require_minutesToHours = __commonJS({ - "node_modules/date-fns/minutesToHours.js"(exports2) { + "node_modules/date-fns/minutesToHours/index.js"(exports2, module2) { "use strict"; - exports2.minutesToHours = minutesToHours; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = minutesToHours; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function minutesToHours(minutes) { - const hours = minutes / _index.minutesInHour; - return Math.trunc(hours); + (0, _index.default)(1, arguments); + var hours = minutes / _index2.minutesInHour; + return Math.floor(hours); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/minutesToMilliseconds.js +// node_modules/date-fns/minutesToMilliseconds/index.js var require_minutesToMilliseconds = __commonJS({ - "node_modules/date-fns/minutesToMilliseconds.js"(exports2) { + "node_modules/date-fns/minutesToMilliseconds/index.js"(exports2, module2) { "use strict"; - exports2.minutesToMilliseconds = minutesToMilliseconds; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = minutesToMilliseconds; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function minutesToMilliseconds(minutes) { - return Math.trunc(minutes * _index.millisecondsInMinute); + (0, _index.default)(1, arguments); + return Math.floor(minutes * _index2.millisecondsInMinute); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/minutesToSeconds.js +// node_modules/date-fns/minutesToSeconds/index.js var require_minutesToSeconds = __commonJS({ - "node_modules/date-fns/minutesToSeconds.js"(exports2) { + "node_modules/date-fns/minutesToSeconds/index.js"(exports2, module2) { "use strict"; - exports2.minutesToSeconds = minutesToSeconds; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = minutesToSeconds; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function minutesToSeconds(minutes) { - return Math.trunc(minutes * _index.secondsInMinute); + (0, _index.default)(1, arguments); + return Math.floor(minutes * _index2.secondsInMinute); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/monthsToQuarters.js +// node_modules/date-fns/monthsToQuarters/index.js var require_monthsToQuarters = __commonJS({ - "node_modules/date-fns/monthsToQuarters.js"(exports2) { + "node_modules/date-fns/monthsToQuarters/index.js"(exports2, module2) { "use strict"; - exports2.monthsToQuarters = monthsToQuarters; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = monthsToQuarters; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function monthsToQuarters(months) { - const quarters = months / _index.monthsInQuarter; - return Math.trunc(quarters); + (0, _index.default)(1, arguments); + var quarters = months / _index2.monthsInQuarter; + return Math.floor(quarters); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/monthsToYears.js +// node_modules/date-fns/monthsToYears/index.js var require_monthsToYears = __commonJS({ - "node_modules/date-fns/monthsToYears.js"(exports2) { + "node_modules/date-fns/monthsToYears/index.js"(exports2, module2) { "use strict"; - exports2.monthsToYears = monthsToYears; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = monthsToYears; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function monthsToYears(months) { - const years = months / _index.monthsInYear; - return Math.trunc(years); + (0, _index.default)(1, arguments); + var years = months / _index2.monthsInYear; + return Math.floor(years); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/nextDay.js +// node_modules/date-fns/nextDay/index.js var require_nextDay = __commonJS({ - "node_modules/date-fns/nextDay.js"(exports2) { + "node_modules/date-fns/nextDay/index.js"(exports2, module2) { "use strict"; - exports2.nextDay = nextDay; - var _index = require_addDays(); - var _index2 = require_getDay(); + 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()); function nextDay(date, day) { - let delta = day - (0, _index2.getDay)(date); + (0, _index3.default)(2, arguments); + var delta = day - (0, _index2.default)(date); if (delta <= 0) delta += 7; - return (0, _index.addDays)(date, delta); + return (0, _index.default)(date, delta); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/nextFriday.js +// node_modules/date-fns/nextFriday/index.js var require_nextFriday = __commonJS({ - "node_modules/date-fns/nextFriday.js"(exports2) { + "node_modules/date-fns/nextFriday/index.js"(exports2, module2) { "use strict"; - exports2.nextFriday = nextFriday; - var _index = require_nextDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = nextFriday; + var _index = _interopRequireDefault(require_nextDay()); + var _index2 = _interopRequireDefault(require_requiredArgs()); function nextFriday(date) { - return (0, _index.nextDay)(date, 5); + (0, _index2.default)(1, arguments); + return (0, _index.default)(date, 5); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/nextMonday.js +// node_modules/date-fns/nextMonday/index.js var require_nextMonday = __commonJS({ - "node_modules/date-fns/nextMonday.js"(exports2) { + "node_modules/date-fns/nextMonday/index.js"(exports2, module2) { "use strict"; - exports2.nextMonday = nextMonday; - var _index = require_nextDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = nextMonday; + var _index = _interopRequireDefault(require_nextDay()); + var _index2 = _interopRequireDefault(require_requiredArgs()); function nextMonday(date) { - return (0, _index.nextDay)(date, 1); + (0, _index2.default)(1, arguments); + return (0, _index.default)(date, 1); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/nextSaturday.js +// node_modules/date-fns/nextSaturday/index.js var require_nextSaturday = __commonJS({ - "node_modules/date-fns/nextSaturday.js"(exports2) { + "node_modules/date-fns/nextSaturday/index.js"(exports2, module2) { "use strict"; - exports2.nextSaturday = nextSaturday; - var _index = require_nextDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = nextSaturday; + var _index = _interopRequireDefault(require_nextDay()); + var _index2 = _interopRequireDefault(require_requiredArgs()); function nextSaturday(date) { - return (0, _index.nextDay)(date, 6); + (0, _index2.default)(1, arguments); + return (0, _index.default)(date, 6); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/nextSunday.js +// node_modules/date-fns/nextSunday/index.js var require_nextSunday = __commonJS({ - "node_modules/date-fns/nextSunday.js"(exports2) { + "node_modules/date-fns/nextSunday/index.js"(exports2, module2) { "use strict"; - exports2.nextSunday = nextSunday; - var _index = require_nextDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = nextSunday; + var _index = _interopRequireDefault(require_nextDay()); + var _index2 = _interopRequireDefault(require_requiredArgs()); function nextSunday(date) { - return (0, _index.nextDay)(date, 0); + (0, _index2.default)(1, arguments); + return (0, _index.default)(date, 0); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/nextThursday.js +// node_modules/date-fns/nextThursday/index.js var require_nextThursday = __commonJS({ - "node_modules/date-fns/nextThursday.js"(exports2) { + "node_modules/date-fns/nextThursday/index.js"(exports2, module2) { "use strict"; - exports2.nextThursday = nextThursday; - var _index = require_nextDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = nextThursday; + var _index = _interopRequireDefault(require_nextDay()); + var _index2 = _interopRequireDefault(require_requiredArgs()); function nextThursday(date) { - return (0, _index.nextDay)(date, 4); + (0, _index2.default)(1, arguments); + return (0, _index.default)(date, 4); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/nextTuesday.js +// node_modules/date-fns/nextTuesday/index.js var require_nextTuesday = __commonJS({ - "node_modules/date-fns/nextTuesday.js"(exports2) { + "node_modules/date-fns/nextTuesday/index.js"(exports2, module2) { "use strict"; - exports2.nextTuesday = nextTuesday; - var _index = require_nextDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = nextTuesday; + var _index = _interopRequireDefault(require_nextDay()); + var _index2 = _interopRequireDefault(require_requiredArgs()); function nextTuesday(date) { - return (0, _index.nextDay)(date, 2); + (0, _index2.default)(1, arguments); + return (0, _index.default)(date, 2); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/nextWednesday.js +// node_modules/date-fns/nextWednesday/index.js var require_nextWednesday = __commonJS({ - "node_modules/date-fns/nextWednesday.js"(exports2) { + "node_modules/date-fns/nextWednesday/index.js"(exports2, module2) { "use strict"; - exports2.nextWednesday = nextWednesday; - var _index = require_nextDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = nextWednesday; + var _index = _interopRequireDefault(require_nextDay()); + var _index2 = _interopRequireDefault(require_requiredArgs()); function nextWednesday(date) { - return (0, _index.nextDay)(date, 3); + (0, _index2.default)(1, arguments); + return (0, _index.default)(date, 3); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parseISO.js +// node_modules/date-fns/parseISO/index.js var require_parseISO = __commonJS({ - "node_modules/date-fns/parseISO.js"(exports2) { + "node_modules/date-fns/parseISO/index.js"(exports2, module2) { "use strict"; - exports2.parseISO = parseISO; + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = parseISO; var _index = require_constants(); + var _index2 = _interopRequireDefault(require_requiredArgs()); + var _index3 = _interopRequireDefault(require_toInteger()); function parseISO(argument, options) { - const additionalDigits = options?.additionalDigits ?? 2; - const dateStrings = splitDateString(argument); - let date; + 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; if (dateStrings.date) { - const parseYearResult = parseYear(dateStrings.date, additionalDigits); + var parseYearResult = parseYear(dateStrings.date, additionalDigits); date = parseDate(parseYearResult.restDateString, parseYearResult.year); } if (!date || isNaN(date.getTime())) { return /* @__PURE__ */ new Date(NaN); } - const timestamp = date.getTime(); - let time = 0; - let offset; + var timestamp = date.getTime(); + var time = 0; + var offset; if (dateStrings.time) { time = parseTime(dateStrings.time); if (isNaN(time)) { @@ -10057,19 +12974,10 @@ var require_parseISO = __commonJS({ return /* @__PURE__ */ new Date(NaN); } } else { - 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() - ); + 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()); return result; } return new Date(timestamp + time + offset); @@ -10083,9 +12991,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) { - const dateStrings = {}; - const array = dateString.split(patterns.dateTimeDelimiter); - let timeString; + var dateStrings = {}; + var array = dateString.split(patterns.dateTimeDelimiter); + var timeString; if (array.length > 2) { return dateStrings; } @@ -10096,14 +13004,11 @@ 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) { - const token = patterns.timezone.exec(timeString); + var token = patterns.timezone.exec(timeString); if (token) { dateStrings.time = timeString.replace(token[1], ""); dateStrings.timezone = token[1]; @@ -10114,14 +13019,15 @@ var require_parseISO = __commonJS({ return dateStrings; } function parseYear(dateString, additionalDigits) { - const regex = new RegExp( - "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)" - ); - const captures = dateString.match(regex); + var regex = new RegExp("^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"); + var captures = dateString.match(regex); if (!captures) - return { year: NaN, restDateString: "" }; - const year = captures[1] ? parseInt(captures[1]) : null; - const century = captures[2] ? parseInt(captures[2]) : null; + return { + year: NaN, + restDateString: "" + }; + var year = captures[1] ? parseInt(captures[1]) : null; + var century = captures[2] ? parseInt(captures[2]) : null; return { year: century === null ? year : century * 100, restDateString: dateString.slice((captures[1] || captures[2]).length) @@ -10130,22 +13036,22 @@ var require_parseISO = __commonJS({ function parseDate(dateString, year) { if (year === null) return /* @__PURE__ */ new Date(NaN); - const captures = dateString.match(dateRegex); + var captures = dateString.match(dateRegex); if (!captures) return /* @__PURE__ */ new Date(NaN); - 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; + 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; if (isWeekDate) { if (!validateWeekDate(year, week, dayOfWeek)) { return /* @__PURE__ */ new Date(NaN); } return dayOfISOWeekYear(year, week, dayOfWeek); } else { - const date = /* @__PURE__ */ new Date(0); + var date = /* @__PURE__ */ new Date(0); if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) { return /* @__PURE__ */ new Date(NaN); } @@ -10157,12 +13063,12 @@ var require_parseISO = __commonJS({ return value ? parseInt(value) : 1; } function parseTime(timeString) { - const captures = timeString.match(timeRegex); + var captures = timeString.match(timeRegex); if (!captures) return NaN; - const hours = parseTimeUnit(captures[1]); - const minutes = parseTimeUnit(captures[2]); - const seconds = parseTimeUnit(captures[3]); + var hours = parseTimeUnit(captures[1]); + var minutes = parseTimeUnit(captures[2]); + var seconds = parseTimeUnit(captures[3]); if (!validateTime(hours, minutes, seconds)) { return NaN; } @@ -10174,22 +13080,22 @@ var require_parseISO = __commonJS({ function parseTimezone(timezoneString) { if (timezoneString === "Z") return 0; - const captures = timezoneString.match(timezoneRegex); + var captures = timezoneString.match(timezoneRegex); if (!captures) return 0; - const sign = captures[1] === "+" ? -1 : 1; - const hours = parseInt(captures[2]); - const minutes = captures[3] && parseInt(captures[3]) || 0; + var sign = captures[1] === "+" ? -1 : 1; + var hours = parseInt(captures[2]); + var 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) { - const date = /* @__PURE__ */ new Date(0); + var date = /* @__PURE__ */ new Date(0); date.setUTCFullYear(isoWeekYear, 0, 4); - const fourthOfJanuaryDay = date.getUTCDay() || 7; - const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; + var fourthOfJanuaryDay = date.getUTCDay() || 7; + var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; date.setUTCDate(date.getUTCDate() + diff); return date; } @@ -10215,741 +13121,1120 @@ var require_parseISO = __commonJS({ function validateTimezone(_hours, minutes) { return minutes >= 0 && minutes <= 59; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/parseJSON.js +// node_modules/date-fns/parseJSON/index.js var require_parseJSON = __commonJS({ - "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) - ) - ); + "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); } - return /* @__PURE__ */ new Date(NaN); + return (0, _index.default)(argument); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/previousDay.js +// node_modules/date-fns/previousDay/index.js var require_previousDay = __commonJS({ - "node_modules/date-fns/previousDay.js"(exports2) { + "node_modules/date-fns/previousDay/index.js"(exports2, module2) { "use strict"; - exports2.previousDay = previousDay; - var _index = require_getDay(); - var _index2 = require_subDays(); + 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()); function previousDay(date, day) { - let delta = (0, _index.getDay)(date) - day; + (0, _index.default)(2, arguments); + var delta = (0, _index2.default)(date) - day; if (delta <= 0) delta += 7; - return (0, _index2.subDays)(date, delta); + return (0, _index3.default)(date, delta); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/previousFriday.js +// node_modules/date-fns/previousFriday/index.js var require_previousFriday = __commonJS({ - "node_modules/date-fns/previousFriday.js"(exports2) { + "node_modules/date-fns/previousFriday/index.js"(exports2, module2) { "use strict"; - exports2.previousFriday = previousFriday; - var _index = require_previousDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = previousFriday; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = _interopRequireDefault(require_previousDay()); function previousFriday(date) { - return (0, _index.previousDay)(date, 5); + (0, _index.default)(1, arguments); + return (0, _index2.default)(date, 5); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/previousMonday.js +// node_modules/date-fns/previousMonday/index.js var require_previousMonday = __commonJS({ - "node_modules/date-fns/previousMonday.js"(exports2) { + "node_modules/date-fns/previousMonday/index.js"(exports2, module2) { "use strict"; - exports2.previousMonday = previousMonday; - var _index = require_previousDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = previousMonday; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = _interopRequireDefault(require_previousDay()); function previousMonday(date) { - return (0, _index.previousDay)(date, 1); + (0, _index.default)(1, arguments); + return (0, _index2.default)(date, 1); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/previousSaturday.js +// node_modules/date-fns/previousSaturday/index.js var require_previousSaturday = __commonJS({ - "node_modules/date-fns/previousSaturday.js"(exports2) { + "node_modules/date-fns/previousSaturday/index.js"(exports2, module2) { "use strict"; - exports2.previousSaturday = previousSaturday; - var _index = require_previousDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = previousSaturday; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = _interopRequireDefault(require_previousDay()); function previousSaturday(date) { - return (0, _index.previousDay)(date, 6); + (0, _index.default)(1, arguments); + return (0, _index2.default)(date, 6); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/previousSunday.js +// node_modules/date-fns/previousSunday/index.js var require_previousSunday = __commonJS({ - "node_modules/date-fns/previousSunday.js"(exports2) { + "node_modules/date-fns/previousSunday/index.js"(exports2, module2) { "use strict"; - exports2.previousSunday = previousSunday; - var _index = require_previousDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = previousSunday; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = _interopRequireDefault(require_previousDay()); function previousSunday(date) { - return (0, _index.previousDay)(date, 0); + (0, _index.default)(1, arguments); + return (0, _index2.default)(date, 0); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/previousThursday.js +// node_modules/date-fns/previousThursday/index.js var require_previousThursday = __commonJS({ - "node_modules/date-fns/previousThursday.js"(exports2) { + "node_modules/date-fns/previousThursday/index.js"(exports2, module2) { "use strict"; - exports2.previousThursday = previousThursday; - var _index = require_previousDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = previousThursday; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = _interopRequireDefault(require_previousDay()); function previousThursday(date) { - return (0, _index.previousDay)(date, 4); + (0, _index.default)(1, arguments); + return (0, _index2.default)(date, 4); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/previousTuesday.js +// node_modules/date-fns/previousTuesday/index.js var require_previousTuesday = __commonJS({ - "node_modules/date-fns/previousTuesday.js"(exports2) { + "node_modules/date-fns/previousTuesday/index.js"(exports2, module2) { "use strict"; - exports2.previousTuesday = previousTuesday; - var _index = require_previousDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = previousTuesday; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = _interopRequireDefault(require_previousDay()); function previousTuesday(date) { - return (0, _index.previousDay)(date, 2); + (0, _index.default)(1, arguments); + return (0, _index2.default)(date, 2); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/previousWednesday.js +// node_modules/date-fns/previousWednesday/index.js var require_previousWednesday = __commonJS({ - "node_modules/date-fns/previousWednesday.js"(exports2) { + "node_modules/date-fns/previousWednesday/index.js"(exports2, module2) { "use strict"; - exports2.previousWednesday = previousWednesday; - var _index = require_previousDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = previousWednesday; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = _interopRequireDefault(require_previousDay()); function previousWednesday(date) { - return (0, _index.previousDay)(date, 3); + (0, _index.default)(1, arguments); + return (0, _index2.default)(date, 3); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/quartersToMonths.js +// node_modules/date-fns/quartersToMonths/index.js var require_quartersToMonths = __commonJS({ - "node_modules/date-fns/quartersToMonths.js"(exports2) { + "node_modules/date-fns/quartersToMonths/index.js"(exports2, module2) { "use strict"; - exports2.quartersToMonths = quartersToMonths; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = quartersToMonths; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function quartersToMonths(quarters) { - return Math.trunc(quarters * _index.monthsInQuarter); + (0, _index.default)(1, arguments); + return Math.floor(quarters * _index2.monthsInQuarter); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/quartersToYears.js +// node_modules/date-fns/quartersToYears/index.js var require_quartersToYears = __commonJS({ - "node_modules/date-fns/quartersToYears.js"(exports2) { + "node_modules/date-fns/quartersToYears/index.js"(exports2, module2) { "use strict"; - exports2.quartersToYears = quartersToYears; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = quartersToYears; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function quartersToYears(quarters) { - 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; + (0, _index.default)(1, arguments); + var years = quarters / _index2.quartersInYear; + return Math.floor(years); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/roundToNearestMinutes.js +// node_modules/date-fns/roundToNearestMinutes/index.js var require_roundToNearestMinutes = __commonJS({ - "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; + "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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/secondsToHours.js +// node_modules/date-fns/secondsToHours/index.js var require_secondsToHours = __commonJS({ - "node_modules/date-fns/secondsToHours.js"(exports2) { + "node_modules/date-fns/secondsToHours/index.js"(exports2, module2) { "use strict"; - exports2.secondsToHours = secondsToHours; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = secondsToHours; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function secondsToHours(seconds) { - const hours = seconds / _index.secondsInHour; - return Math.trunc(hours); + (0, _index.default)(1, arguments); + var hours = seconds / _index2.secondsInHour; + return Math.floor(hours); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/secondsToMilliseconds.js +// node_modules/date-fns/secondsToMilliseconds/index.js var require_secondsToMilliseconds = __commonJS({ - "node_modules/date-fns/secondsToMilliseconds.js"(exports2) { + "node_modules/date-fns/secondsToMilliseconds/index.js"(exports2, module2) { "use strict"; - exports2.secondsToMilliseconds = secondsToMilliseconds; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = secondsToMilliseconds; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function secondsToMilliseconds(seconds) { - return seconds * _index.millisecondsInSecond; + (0, _index.default)(1, arguments); + return seconds * _index2.millisecondsInSecond; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/secondsToMinutes.js +// node_modules/date-fns/secondsToMinutes/index.js var require_secondsToMinutes = __commonJS({ - "node_modules/date-fns/secondsToMinutes.js"(exports2) { + "node_modules/date-fns/secondsToMinutes/index.js"(exports2, module2) { "use strict"; - exports2.secondsToMinutes = secondsToMinutes; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = secondsToMinutes; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function secondsToMinutes(seconds) { - const minutes = seconds / _index.secondsInMinute; - return Math.trunc(minutes); + (0, _index.default)(1, arguments); + var minutes = seconds / _index2.secondsInMinute; + return Math.floor(minutes); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setMonth.js +// node_modules/date-fns/setMonth/index.js var require_setMonth = __commonJS({ - "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); + "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); dateWithDesiredMonth.setFullYear(year, month, 15); dateWithDesiredMonth.setHours(0, 0, 0, 0); - const daysInMonth = (0, _index2.getDaysInMonth)(dateWithDesiredMonth); - _date.setMonth(month, Math.min(day, daysInMonth)); - return _date; + var daysInMonth = (0, _index3.default)(dateWithDesiredMonth); + date.setMonth(month, Math.min(day, daysInMonth)); + return date; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/set.js +// node_modules/date-fns/set/index.js var require_set = __commonJS({ - "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); + "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); } if (values.year != null) { - _date.setFullYear(values.year); + date.setFullYear(values.year); } if (values.month != null) { - _date = (0, _index2.setMonth)(_date, values.month); + date = (0, _index2.default)(date, values.month); } if (values.date != null) { - _date.setDate(values.date); + date.setDate((0, _index3.default)(values.date)); } if (values.hours != null) { - _date.setHours(values.hours); + date.setHours((0, _index3.default)(values.hours)); } if (values.minutes != null) { - _date.setMinutes(values.minutes); + date.setMinutes((0, _index3.default)(values.minutes)); } if (values.seconds != null) { - _date.setSeconds(values.seconds); + date.setSeconds((0, _index3.default)(values.seconds)); } if (values.milliseconds != null) { - _date.setMilliseconds(values.milliseconds); + date.setMilliseconds((0, _index3.default)(values.milliseconds)); } - return _date; + return date; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setDate.js +// node_modules/date-fns/setDate/index.js var require_setDate = __commonJS({ - "node_modules/date-fns/setDate.js"(exports2) { + "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) { "use strict"; - exports2.setDate = setDate; - var _index = require_toDate(); - function setDate(date, dayOfMonth) { - const _date = (0, _index.toDate)(date); - _date.setDate(dayOfMonth); - return _date; + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setDayOfYear.js +// node_modules/date-fns/setDayOfYear/index.js var require_setDayOfYear = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setDefaultOptions.js +// node_modules/date-fns/setDefaultOptions/index.js var require_setDefaultOptions = __commonJS({ - "node_modules/date-fns/setDefaultOptions.js"(exports2) { + "node_modules/date-fns/setDefaultOptions/index.js"(exports2, module2) { "use strict"; - exports2.setDefaultOptions = setDefaultOptions; + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = setDefaultOptions; var _index = require_defaultOptions(); - function setDefaultOptions(options) { - const result = {}; - const defaultOptions = (0, _index.getDefaultOptions)(); - for (const property in 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) { if (Object.prototype.hasOwnProperty.call(defaultOptions, property)) { + ; result[property] = defaultOptions[property]; } } - for (const property in options) { - if (Object.prototype.hasOwnProperty.call(options, property)) { - if (options[property] === void 0) { - delete result[property]; + for (var _property in newOptions) { + if (Object.prototype.hasOwnProperty.call(newOptions, _property)) { + if (newOptions[_property] === void 0) { + delete result[_property]; } else { - result[property] = options[property]; + ; + result[_property] = newOptions[_property]; } } } (0, _index.setDefaultOptions)(result); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setHours.js +// node_modules/date-fns/setHours/index.js var require_setHours = __commonJS({ - "node_modules/date-fns/setHours.js"(exports2) { + "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"; - exports2.setHours = setHours; - var _index = require_toDate(); - function setHours(date, hours) { - const _date = (0, _index.toDate)(date); - _date.setHours(hours); - return _date; + 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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setMilliseconds.js +// node_modules/date-fns/setMilliseconds/index.js var require_setMilliseconds = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setMinutes.js +// node_modules/date-fns/setMinutes/index.js var require_setMinutes = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setQuarter.js +// node_modules/date-fns/setQuarter/index.js var require_setQuarter = __commonJS({ - "node_modules/date-fns/setQuarter.js"(exports2) { + "node_modules/date-fns/setQuarter/index.js"(exports2, module2) { "use strict"; - 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); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setSeconds.js +// node_modules/date-fns/setSeconds/index.js var require_setSeconds = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setWeekYear.js +// node_modules/date-fns/setWeekYear/index.js var require_setWeekYear = __commonJS({ - "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); + "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); firstWeek.setFullYear(weekYear, 0, firstWeekContainsDate); firstWeek.setHours(0, 0, 0, 0); - _date = (0, _index3.startOfWeekYear)(firstWeek, options); - _date.setDate(_date.getDate() + diff); - return _date; + date = (0, _index2.default)(firstWeek, options); + date.setDate(date.getDate() + diff); + return date; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/setYear.js +// node_modules/date-fns/setYear/index.js var require_setYear = __commonJS({ - "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); + "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); } - _date.setFullYear(year); - return _date; + date.setFullYear(year); + return date; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfDecade.js +// node_modules/date-fns/startOfDecade/index.js var require_startOfDecade = __commonJS({ - "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; + "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; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfToday.js +// node_modules/date-fns/startOfToday/index.js var require_startOfToday = __commonJS({ - "node_modules/date-fns/startOfToday.js"(exports2) { + "node_modules/date-fns/startOfToday/index.js"(exports2, module2) { "use strict"; - exports2.startOfToday = startOfToday; - var _index = require_startOfDay(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = startOfToday; + var _index = _interopRequireDefault(require_startOfDay()); function startOfToday() { - return (0, _index.startOfDay)(Date.now()); + return (0, _index.default)(Date.now()); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/startOfTomorrow.js +// node_modules/date-fns/startOfTomorrow/index.js var require_startOfTomorrow = __commonJS({ - "node_modules/date-fns/startOfTomorrow.js"(exports2) { + "node_modules/date-fns/startOfTomorrow/index.js"(exports2, module2) { "use strict"; - exports2.startOfTomorrow = startOfTomorrow; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = startOfTomorrow; function startOfTomorrow() { - const now = /* @__PURE__ */ new Date(); - const year = now.getFullYear(); - const month = now.getMonth(); - const day = now.getDate(); - const date = /* @__PURE__ */ new Date(0); + var now = /* @__PURE__ */ new Date(); + var year = now.getFullYear(); + var month = now.getMonth(); + var day = now.getDate(); + var 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.js +// node_modules/date-fns/startOfYesterday/index.js var require_startOfYesterday = __commonJS({ - "node_modules/date-fns/startOfYesterday.js"(exports2) { + "node_modules/date-fns/startOfYesterday/index.js"(exports2, module2) { "use strict"; - exports2.startOfYesterday = startOfYesterday; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = startOfYesterday; function startOfYesterday() { - const now = /* @__PURE__ */ new Date(); - const year = now.getFullYear(); - const month = now.getMonth(); - const day = now.getDate(); - const date = /* @__PURE__ */ new Date(0); + var now = /* @__PURE__ */ new Date(); + var year = now.getFullYear(); + var month = now.getMonth(); + var day = now.getDate(); + var 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.js +// node_modules/date-fns/subMonths/index.js var require_subMonths = __commonJS({ - "node_modules/date-fns/subMonths.js"(exports2) { + "node_modules/date-fns/subMonths/index.js"(exports2, module2) { "use strict"; - exports2.subMonths = subMonths; - var _index = require_addMonths(); - function subMonths(date, amount) { - return (0, _index.addMonths)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/sub.js +// node_modules/date-fns/sub/index.js var require_sub = __commonJS({ - "node_modules/date-fns/sub.js"(exports2) { - "use strict"; - exports2.sub = sub; - var _index = require_subDays(); - var _index2 = require_subMonths(); - var _index3 = require_constructFrom(); + "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()); function sub(date, duration) { - 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 - ); + (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); return finalDate; } + module2.exports = exports2.default; } }); -// node_modules/date-fns/subBusinessDays.js +// node_modules/date-fns/subBusinessDays/index.js var require_subBusinessDays = __commonJS({ - "node_modules/date-fns/subBusinessDays.js"(exports2) { + "node_modules/date-fns/subBusinessDays/index.js"(exports2, module2) { "use strict"; - exports2.subBusinessDays = subBusinessDays; - var _index = require_addBusinessDays(); - function subBusinessDays(date, amount) { - return (0, _index.addBusinessDays)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/subHours.js +// node_modules/date-fns/subHours/index.js var require_subHours = __commonJS({ - "node_modules/date-fns/subHours.js"(exports2) { - "use strict"; - 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) { + "node_modules/date-fns/subHours/index.js"(exports2, module2) { "use strict"; - exports2.subMilliseconds = subMilliseconds; - var _index = require_addMilliseconds(); - function subMilliseconds(date, amount) { - return (0, _index.addMilliseconds)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/subMinutes.js +// node_modules/date-fns/subMinutes/index.js var require_subMinutes = __commonJS({ - "node_modules/date-fns/subMinutes.js"(exports2) { + "node_modules/date-fns/subMinutes/index.js"(exports2, module2) { "use strict"; - exports2.subMinutes = subMinutes; - var _index = require_addMinutes(); - function subMinutes(date, amount) { - return (0, _index.addMinutes)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/subQuarters.js +// node_modules/date-fns/subQuarters/index.js var require_subQuarters = __commonJS({ - "node_modules/date-fns/subQuarters.js"(exports2) { + "node_modules/date-fns/subQuarters/index.js"(exports2, module2) { "use strict"; - exports2.subQuarters = subQuarters; - var _index = require_addQuarters(); - function subQuarters(date, amount) { - return (0, _index.addQuarters)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/subSeconds.js +// node_modules/date-fns/subSeconds/index.js var require_subSeconds = __commonJS({ - "node_modules/date-fns/subSeconds.js"(exports2) { + "node_modules/date-fns/subSeconds/index.js"(exports2, module2) { "use strict"; - exports2.subSeconds = subSeconds; - var _index = require_addSeconds(); - function subSeconds(date, amount) { - return (0, _index.addSeconds)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/subWeeks.js +// node_modules/date-fns/subWeeks/index.js var require_subWeeks = __commonJS({ - "node_modules/date-fns/subWeeks.js"(exports2) { + "node_modules/date-fns/subWeeks/index.js"(exports2, module2) { "use strict"; - exports2.subWeeks = subWeeks; - var _index = require_addWeeks(); - function subWeeks(date, amount) { - return (0, _index.addWeeks)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/subYears.js +// node_modules/date-fns/subYears/index.js var require_subYears = __commonJS({ - "node_modules/date-fns/subYears.js"(exports2) { + "node_modules/date-fns/subYears/index.js"(exports2, module2) { "use strict"; - exports2.subYears = subYears; - var _index = require_addYears(); - function subYears(date, amount) { - return (0, _index.addYears)(date, -amount); + 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); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/weeksToDays.js +// node_modules/date-fns/weeksToDays/index.js var require_weeksToDays = __commonJS({ - "node_modules/date-fns/weeksToDays.js"(exports2) { + "node_modules/date-fns/weeksToDays/index.js"(exports2, module2) { "use strict"; - exports2.weeksToDays = weeksToDays; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = weeksToDays; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function weeksToDays(weeks) { - return Math.trunc(weeks * _index.daysInWeek); + (0, _index.default)(1, arguments); + return Math.floor(weeks * _index2.daysInWeek); } + module2.exports = exports2.default; } }); -// 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); - } - } -}); - -// node_modules/date-fns/yearsToMonths.js +// node_modules/date-fns/yearsToMonths/index.js var require_yearsToMonths = __commonJS({ - "node_modules/date-fns/yearsToMonths.js"(exports2) { + "node_modules/date-fns/yearsToMonths/index.js"(exports2, module2) { "use strict"; - exports2.yearsToMonths = yearsToMonths; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = yearsToMonths; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function yearsToMonths(years) { - return Math.trunc(years * _index.monthsInYear); + (0, _index.default)(1, arguments); + return Math.floor(years * _index2.monthsInYear); } + module2.exports = exports2.default; } }); -// node_modules/date-fns/yearsToQuarters.js +// node_modules/date-fns/yearsToQuarters/index.js var require_yearsToQuarters = __commonJS({ - "node_modules/date-fns/yearsToQuarters.js"(exports2) { + "node_modules/date-fns/yearsToQuarters/index.js"(exports2, module2) { "use strict"; - exports2.yearsToQuarters = yearsToQuarters; - var _index = require_constants(); + var _interopRequireDefault = require_interopRequireDefault().default; + Object.defineProperty(exports2, "__esModule", { + value: true + }); + exports2.default = yearsToQuarters; + var _index = _interopRequireDefault(require_requiredArgs()); + var _index2 = require_constants(); function yearsToQuarters(years) { - return Math.trunc(years * _index.quartersInYear); + (0, _index.default)(1, arguments); + return Math.floor(years * _index2.quartersInYear); } + module2.exports = exports2.default; } }); @@ -10957,3188 +14242,1936 @@ var require_yearsToQuarters = __commonJS({ var require_date_fns = __commonJS({ "node_modules/date-fns/index.js"(exports2) { "use strict"; - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); - }); - 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]; - } - }); + 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 _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, "addBusinessDays", { + enumerable: true, + get: function get() { + return _index2.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, "addDays", { + enumerable: true, + get: function get() { + return _index3.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, "addHours", { + enumerable: true, + get: function get() { + return _index4.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, "addISOWeekYears", { + enumerable: true, + get: function get() { + return _index5.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, "addMilliseconds", { + enumerable: true, + get: function get() { + return _index6.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, "addMinutes", { + enumerable: true, + get: function get() { + return _index7.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, "addMonths", { + enumerable: true, + get: function get() { + return _index8.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, "addQuarters", { + enumerable: true, + get: function get() { + return _index9.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, "addSeconds", { + enumerable: true, + get: function get() { + return _index10.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, "addWeeks", { + enumerable: true, + get: function get() { + return _index11.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, "addYears", { + enumerable: true, + get: function get() { + return _index12.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, "areIntervalsOverlapping", { + enumerable: true, + get: function get() { + return _index13.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, "clamp", { + enumerable: true, + get: function get() { + return _index14.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, "closestIndexTo", { + enumerable: true, + get: function get() { + return _index15.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, "closestTo", { + enumerable: true, + get: function get() { + return _index16.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, "compareAsc", { + enumerable: true, + get: function get() { + return _index17.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, "compareDesc", { + enumerable: true, + get: function get() { + return _index18.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, "daysToWeeks", { + enumerable: true, + get: function get() { + return _index19.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, "differenceInBusinessDays", { + enumerable: true, + get: function get() { + return _index20.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, "differenceInCalendarDays", { + enumerable: true, + get: function get() { + return _index21.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, "differenceInCalendarISOWeekYears", { + enumerable: true, + get: function get() { + return _index22.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, "differenceInCalendarISOWeeks", { + enumerable: true, + get: function get() { + return _index23.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, "differenceInCalendarMonths", { + enumerable: true, + get: function get() { + return _index24.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, "differenceInCalendarQuarters", { + enumerable: true, + get: function get() { + return _index25.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, "differenceInCalendarWeeks", { + enumerable: true, + get: function get() { + return _index26.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, "differenceInCalendarYears", { + enumerable: true, + get: function get() { + return _index27.default; + } + }); + Object.defineProperty(exports2, "differenceInDays", { + enumerable: true, + get: function get() { + return _index28.default; + } + }); + Object.defineProperty(exports2, "differenceInHours", { + enumerable: true, + get: function get() { + return _index29.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, "differenceInISOWeekYears", { + enumerable: true, + get: function get() { + return _index30.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, "differenceInMilliseconds", { + enumerable: true, + get: function get() { + return _index31.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, "differenceInMinutes", { + enumerable: true, + get: function get() { + return _index32.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, "differenceInMonths", { + enumerable: true, + get: function get() { + return _index33.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, "differenceInQuarters", { + enumerable: true, + get: function get() { + return _index34.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, "differenceInSeconds", { + enumerable: true, + get: function get() { + return _index35.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, "differenceInWeeks", { + enumerable: true, + get: function get() { + return _index36.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, "differenceInYears", { + enumerable: true, + get: function get() { + return _index37.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, "eachDayOfInterval", { + enumerable: true, + get: function get() { + return _index38.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, "eachHourOfInterval", { + enumerable: true, + get: function get() { + return _index39.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, "eachMinuteOfInterval", { + enumerable: true, + get: function get() { + return _index40.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, "eachMonthOfInterval", { + enumerable: true, + get: function get() { + return _index41.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, "eachQuarterOfInterval", { + enumerable: true, + get: function get() { + return _index42.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, "eachWeekOfInterval", { + enumerable: true, + get: function get() { + return _index43.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, "eachWeekendOfInterval", { + enumerable: true, + get: function get() { + return _index44.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, "eachWeekendOfMonth", { + enumerable: true, + get: function get() { + return _index45.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, "eachWeekendOfYear", { + enumerable: true, + get: function get() { + return _index46.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, "eachYearOfInterval", { + enumerable: true, + get: function get() { + return _index47.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, "endOfDay", { + enumerable: true, + get: function get() { + return _index48.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, "endOfDecade", { + enumerable: true, + get: function get() { + return _index49.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, "endOfHour", { + enumerable: true, + get: function get() { + return _index50.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, "endOfISOWeek", { + enumerable: true, + get: function get() { + return _index51.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, "endOfISOWeekYear", { + enumerable: true, + get: function get() { + return _index52.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, "endOfMinute", { + enumerable: true, + get: function get() { + return _index53.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, "endOfMonth", { + enumerable: true, + get: function get() { + return _index54.default; + } + }); + Object.defineProperty(exports2, "endOfQuarter", { + enumerable: true, + get: function get() { + return _index55.default; + } + }); + Object.defineProperty(exports2, "endOfSecond", { + enumerable: true, + get: function get() { + return _index56.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, "endOfToday", { + enumerable: true, + get: function get() { + return _index57.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, "endOfTomorrow", { + enumerable: true, + get: function get() { + return _index58.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, "endOfWeek", { + enumerable: true, + get: function get() { + return _index59.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, "endOfYear", { + enumerable: true, + get: function get() { + return _index60.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, "endOfYesterday", { + enumerable: true, + get: function get() { + return _index61.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, "format", { + enumerable: true, + get: function get() { + return _index62.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, "formatDistance", { + enumerable: true, + get: function get() { + return _index63.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, "formatDistanceStrict", { + enumerable: true, + get: function get() { + return _index64.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, "formatDistanceToNow", { + enumerable: true, + get: function get() { + return _index65.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, "formatDistanceToNowStrict", { + enumerable: true, + get: function get() { + return _index66.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, "formatDuration", { + enumerable: true, + get: function get() { + return _index67.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, "formatISO", { + enumerable: true, + get: function get() { + return _index68.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, "formatISO9075", { + enumerable: true, + get: function get() { + return _index69.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, "formatISODuration", { + enumerable: true, + get: function get() { + return _index70.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, "formatRFC3339", { + enumerable: true, + get: function get() { + return _index71.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, "formatRFC7231", { + enumerable: true, + get: function get() { + return _index72.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, "formatRelative", { + enumerable: true, + get: function get() { + return _index73.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, "fromUnixTime", { + enumerable: true, + get: function get() { + return _index74.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, "getDate", { + enumerable: true, + get: function get() { + return _index75.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, "getDay", { + enumerable: true, + get: function get() { + return _index76.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, "getDayOfYear", { + enumerable: true, + get: function get() { + return _index77.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, "getDaysInMonth", { + enumerable: true, + get: function get() { + return _index78.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, "getDaysInYear", { + enumerable: true, + get: function get() { + return _index79.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, "getDecade", { + enumerable: true, + get: function get() { + return _index80.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, "getDefaultOptions", { + enumerable: true, + get: function get() { + return _index81.default; + } + }); + Object.defineProperty(exports2, "getHours", { + enumerable: true, + get: function get() { + return _index82.default; + } + }); + Object.defineProperty(exports2, "getISODay", { + enumerable: true, + get: function get() { + return _index83.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, "getISOWeek", { + enumerable: true, + get: function get() { + return _index84.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, "getISOWeekYear", { + enumerable: true, + get: function get() { + return _index85.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, "getISOWeeksInYear", { + enumerable: true, + get: function get() { + return _index86.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, "getMilliseconds", { + enumerable: true, + get: function get() { + return _index87.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, "getMinutes", { + enumerable: true, + get: function get() { + return _index88.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, "getMonth", { + enumerable: true, + get: function get() { + return _index89.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, "getOverlappingDaysInIntervals", { + enumerable: true, + get: function get() { + return _index90.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, "getQuarter", { + enumerable: true, + get: function get() { + return _index91.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, "getSeconds", { + enumerable: true, + get: function get() { + return _index92.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, "getTime", { + enumerable: true, + get: function get() { + return _index93.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, "getUnixTime", { + enumerable: true, + get: function get() { + return _index94.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, "getWeek", { + enumerable: true, + get: function get() { + return _index95.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, "getWeekOfMonth", { + enumerable: true, + get: function get() { + return _index96.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, "getWeekYear", { + enumerable: true, + get: function get() { + return _index97.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, "getWeeksInMonth", { + enumerable: true, + get: function get() { + return _index98.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, "getYear", { + enumerable: true, + get: function get() { + return _index99.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, "hoursToMilliseconds", { + enumerable: true, + get: function get() { + return _index100.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, "hoursToMinutes", { + enumerable: true, + get: function get() { + return _index101.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, "hoursToSeconds", { + enumerable: true, + get: function get() { + return _index102.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, "intervalToDuration", { + enumerable: true, + get: function get() { + return _index103.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, "intlFormat", { + enumerable: true, + get: function get() { + return _index104.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, "intlFormatDistance", { + enumerable: true, + get: function get() { + return _index105.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, "isAfter", { + enumerable: true, + get: function get() { + return _index106.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, "isBefore", { + enumerable: true, + get: function get() { + return _index107.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, "isDate", { + enumerable: true, + get: function get() { + return _index108.default; + } + }); + Object.defineProperty(exports2, "isEqual", { + enumerable: true, + get: function get() { + return _index109.default; + } + }); + Object.defineProperty(exports2, "isExists", { + enumerable: true, + get: function get() { + return _index110.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, "isFirstDayOfMonth", { + enumerable: true, + get: function get() { + return _index111.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, "isFriday", { + enumerable: true, + get: function get() { + return _index112.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, "isFuture", { + enumerable: true, + get: function get() { + return _index113.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, "isLastDayOfMonth", { + enumerable: true, + get: function get() { + return _index114.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, "isLeapYear", { + enumerable: true, + get: function get() { + return _index115.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, "isMatch", { + enumerable: true, + get: function get() { + return _index116.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, "isMonday", { + enumerable: true, + get: function get() { + return _index117.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, "isPast", { + enumerable: true, + get: function get() { + return _index118.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, "isSameDay", { + enumerable: true, + get: function get() { + return _index119.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, "isSameHour", { + enumerable: true, + get: function get() { + return _index120.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, "isSameISOWeek", { + enumerable: true, + get: function get() { + return _index121.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, "isSameISOWeekYear", { + enumerable: true, + get: function get() { + return _index122.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, "isSameMinute", { + enumerable: true, + get: function get() { + return _index123.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, "isSameMonth", { + enumerable: true, + get: function get() { + return _index124.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, "isSameQuarter", { + enumerable: true, + get: function get() { + return _index125.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, "isSameSecond", { + enumerable: true, + get: function get() { + return _index126.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, "isSameWeek", { + enumerable: true, + get: function get() { + return _index127.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, "isSameYear", { + enumerable: true, + get: function get() { + return _index128.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, "isSaturday", { + enumerable: true, + get: function get() { + return _index129.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, "isSunday", { + enumerable: true, + get: function get() { + return _index130.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, "isThisHour", { + enumerable: true, + get: function get() { + return _index131.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, "isThisISOWeek", { + enumerable: true, + get: function get() { + return _index132.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, "isThisMinute", { + enumerable: true, + get: function get() { + return _index133.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, "isThisMonth", { + enumerable: true, + get: function get() { + return _index134.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, "isThisQuarter", { + enumerable: true, + get: function get() { + return _index135.default; + } + }); + Object.defineProperty(exports2, "isThisSecond", { + enumerable: true, + get: function get() { + return _index136.default; + } + }); + Object.defineProperty(exports2, "isThisWeek", { + enumerable: true, + get: function get() { + return _index137.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, "isThisYear", { + enumerable: true, + get: function get() { + return _index138.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, "isThursday", { + enumerable: true, + get: function get() { + return _index139.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, "isToday", { + enumerable: true, + get: function get() { + return _index140.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, "isTomorrow", { + enumerable: true, + get: function get() { + return _index141.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, "isTuesday", { + enumerable: true, + get: function get() { + return _index142.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, "isValid", { + enumerable: true, + get: function get() { + return _index143.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, "isWednesday", { + enumerable: true, + get: function get() { + return _index144.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, "isWeekend", { + enumerable: true, + get: function get() { + return _index145.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, "isWithinInterval", { + enumerable: true, + get: function get() { + return _index146.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, "isYesterday", { + enumerable: true, + get: function get() { + return _index147.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, "lastDayOfDecade", { + enumerable: true, + get: function get() { + return _index148.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, "lastDayOfISOWeek", { + enumerable: true, + get: function get() { + return _index149.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, "lastDayOfISOWeekYear", { + enumerable: true, + get: function get() { + return _index150.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, "lastDayOfMonth", { + enumerable: true, + get: function get() { + return _index151.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, "lastDayOfQuarter", { + enumerable: true, + get: function get() { + return _index152.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, "lastDayOfWeek", { + enumerable: true, + get: function get() { + return _index153.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, "lastDayOfYear", { + enumerable: true, + get: function get() { + return _index154.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, "lightFormat", { + enumerable: true, + get: function get() { + return _index155.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, "max", { + enumerable: true, + get: function get() { + return _index156.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, "milliseconds", { + enumerable: true, + get: function get() { + return _index157.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, "millisecondsToHours", { + enumerable: true, + get: function get() { + return _index158.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, "millisecondsToMinutes", { + enumerable: true, + get: function get() { + return _index159.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, "millisecondsToSeconds", { + enumerable: true, + get: function get() { + return _index160.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, "min", { + enumerable: true, + get: function get() { + return _index161.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, "minutesToHours", { + enumerable: true, + get: function get() { + return _index162.default; + } + }); + Object.defineProperty(exports2, "minutesToMilliseconds", { + enumerable: true, + get: function get() { + return _index163.default; + } + }); + Object.defineProperty(exports2, "minutesToSeconds", { + enumerable: true, + get: function get() { + return _index164.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, "monthsToQuarters", { + enumerable: true, + get: function get() { + return _index165.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, "monthsToYears", { + enumerable: true, + get: function get() { + return _index166.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, "nextDay", { + enumerable: true, + get: function get() { + return _index167.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, "nextFriday", { + enumerable: true, + get: function get() { + return _index168.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, "nextMonday", { + enumerable: true, + get: function get() { + return _index169.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, "nextSaturday", { + enumerable: true, + get: function get() { + return _index170.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, "nextSunday", { + enumerable: true, + get: function get() { + return _index171.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, "nextThursday", { + enumerable: true, + get: function get() { + return _index172.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, "nextTuesday", { + enumerable: true, + get: function get() { + return _index173.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, "nextWednesday", { + enumerable: true, + get: function get() { + return _index174.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, "parse", { + enumerable: true, + get: function get() { + return _index175.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, "parseISO", { + enumerable: true, + get: function get() { + return _index176.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, "parseJSON", { + enumerable: true, + get: function get() { + return _index177.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, "previousDay", { + enumerable: true, + get: function get() { + return _index178.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, "previousFriday", { + enumerable: true, + get: function get() { + return _index179.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, "previousMonday", { + enumerable: true, + get: function get() { + return _index180.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, "previousSaturday", { + enumerable: true, + get: function get() { + return _index181.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, "previousSunday", { + enumerable: true, + get: function get() { + return _index182.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, "previousThursday", { + enumerable: true, + get: function get() { + return _index183.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, "previousTuesday", { + enumerable: true, + get: function get() { + return _index184.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, "previousWednesday", { + enumerable: true, + get: function get() { + return _index185.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, "quartersToMonths", { + enumerable: true, + get: function get() { + return _index186.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, "quartersToYears", { + enumerable: true, + get: function get() { + return _index187.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, "roundToNearestMinutes", { + enumerable: true, + get: function get() { + return _index188.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, "secondsToHours", { + enumerable: true, + get: function get() { + return _index189.default; + } + }); + Object.defineProperty(exports2, "secondsToMilliseconds", { + enumerable: true, + get: function get() { + return _index190.default; + } + }); + Object.defineProperty(exports2, "secondsToMinutes", { + enumerable: true, + get: function get() { + return _index191.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, "set", { + enumerable: true, + get: function get() { + return _index192.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, "setDate", { + enumerable: true, + get: function get() { + return _index193.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, "setDay", { + enumerable: true, + get: function get() { + return _index194.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, "setDayOfYear", { + enumerable: true, + get: function get() { + return _index195.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, "setDefaultOptions", { + enumerable: true, + get: function get() { + return _index196.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, "setHours", { + enumerable: true, + get: function get() { + return _index197.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, "setISODay", { + enumerable: true, + get: function get() { + return _index198.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, "setISOWeek", { + enumerable: true, + get: function get() { + return _index199.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, "setISOWeekYear", { + enumerable: true, + get: function get() { + return _index200.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, "setMilliseconds", { + enumerable: true, + get: function get() { + return _index201.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, "setMinutes", { + enumerable: true, + get: function get() { + return _index202.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, "setMonth", { + enumerable: true, + get: function get() { + return _index203.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, "setQuarter", { + enumerable: true, + get: function get() { + return _index204.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, "setSeconds", { + enumerable: true, + get: function get() { + return _index205.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, "setWeek", { + enumerable: true, + get: function get() { + return _index206.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, "setWeekYear", { + enumerable: true, + get: function get() { + return _index207.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, "setYear", { + enumerable: true, + get: function get() { + return _index208.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, "startOfDay", { + enumerable: true, + get: function get() { + return _index209.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, "startOfDecade", { + enumerable: true, + get: function get() { + return _index210.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, "startOfHour", { + enumerable: true, + get: function get() { + return _index211.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, "startOfISOWeek", { + enumerable: true, + get: function get() { + return _index212.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, "startOfISOWeekYear", { + enumerable: true, + get: function get() { + return _index213.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, "startOfMinute", { + enumerable: true, + get: function get() { + return _index214.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, "startOfMonth", { + enumerable: true, + get: function get() { + return _index215.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, "startOfQuarter", { + enumerable: true, + get: function get() { + return _index216.default; + } + }); + Object.defineProperty(exports2, "startOfSecond", { + enumerable: true, + get: function get() { + return _index217.default; + } + }); + Object.defineProperty(exports2, "startOfToday", { + enumerable: true, + get: function get() { + return _index218.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, "startOfTomorrow", { + enumerable: true, + get: function get() { + return _index219.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, "startOfWeek", { + enumerable: true, + get: function get() { + return _index220.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, "startOfWeekYear", { + enumerable: true, + get: function get() { + return _index221.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, "startOfYear", { + enumerable: true, + get: function get() { + return _index222.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, "startOfYesterday", { + enumerable: true, + get: function get() { + return _index223.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, "sub", { + enumerable: true, + get: function get() { + return _index224.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, "subBusinessDays", { + enumerable: true, + get: function get() { + return _index225.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, "subDays", { + enumerable: true, + get: function get() { + return _index226.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, "subHours", { + enumerable: true, + get: function get() { + return _index227.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, "subISOWeekYears", { + enumerable: true, + get: function get() { + return _index228.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, "subMilliseconds", { + enumerable: true, + get: function get() { + return _index229.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, "subMinutes", { + enumerable: true, + get: function get() { + return _index230.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, "subMonths", { + enumerable: true, + get: function get() { + return _index231.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, "subQuarters", { + enumerable: true, + get: function get() { + return _index232.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, "subSeconds", { + enumerable: true, + get: function get() { + return _index233.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, "subWeeks", { + enumerable: true, + get: function get() { + return _index234.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, "subYears", { + enumerable: true, + get: function get() { + return _index235.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, "toDate", { + enumerable: true, + get: function get() { + return _index236.default; + } }); - var _index244 = require_yearsToMonths(); - Object.keys(_index244).forEach(function(key) { - if (key === "default" || key === "__esModule") - return; - if (key in exports2 && exports2[key] === _index244[key]) - return; - Object.defineProperty(exports2, key, { - enumerable: true, - get: function() { - return _index244[key]; - } - }); + Object.defineProperty(exports2, "weeksToDays", { + enumerable: true, + get: function get() { + return _index237.default; + } + }); + Object.defineProperty(exports2, "yearsToMonths", { + enumerable: true, + get: function get() { + return _index238.default; + } }); - var _index245 = require_yearsToQuarters(); - Object.keys(_index245).forEach(function(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) { if (key === "default" || key === "__esModule") return; - if (key in exports2 && exports2[key] === _index245[key]) + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) + return; + if (key in exports2 && exports2[key] === _index240[key]) return; Object.defineProperty(exports2, key, { enumerable: true, - get: function() { - return _index245[key]; + get: function get() { + return _index240[key]; } }); }); @@ -14291,7 +16324,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs2.read); - fs2.readSync = typeof fs2.readSync !== "function" ? fs2.readSync : /* @__PURE__ */ function(fs$readSync) { + fs2.readSync = typeof fs2.readSync !== "function" ? fs2.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -15186,23 +17219,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path2, atime, mtime) { const fd = fs2.openSync(path2, "r+"); @@ -15210,7 +17238,7 @@ var require_utimes = __commonJS({ return fs2.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -15222,7 +17250,7 @@ var require_stat = __commonJS({ "use strict"; var fs2 = require_fs(); var path2 = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs2.stat(file, { bigint: true }) : (file) => fs2.lstat(file, { bigint: true }); return Promise.all([ @@ -15247,28 +17275,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -15293,23 +17325,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path2.resolve(path2.dirname(src)); const destParent = path2.resolve(path2.dirname(dest)); if (destParent === srcParent || destParent === path2.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path2.resolve(path2.dirname(src)); @@ -15335,19 +17366,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -15358,16 +17386,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs2 = require_fs(); + var fs2 = require_graceful_fs(); var path2 = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -15377,111 +17411,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path2.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - 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}`); - } - async function onFile(srcStat, destStat, src, dest, opts) { + 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); - if (opts.overwrite) { - await fs2.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); } - 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); + function mayCopyFile(srcStat, src, dest, opts, cb) { + 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); + }); } - return fs2.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs2.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs2.unlink(dest, (err) => { + if (err) + return cb(err); + return fs2.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -15632,7 +17759,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -15702,36 +17829,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path2 = require("path"); - var fs2 = require_fs(); + var fs2 = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs2.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -15765,33 +17899,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path2 = require("path"); - var fs2 = require_fs(); + var fs2 = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs2.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs2.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs2.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -15826,71 +17969,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs2 = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path2.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path2.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path2.isAbsolute(srcpath)) { - const exists2 = fs2.existsSync(srcpath); - if (!exists2) + exists = fs2.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -15900,23 +18050,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs2 = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs2.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs2.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs2.lstatSync(srcpath); } catch { @@ -15925,7 +18075,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -15935,36 +18085,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path2 = require("path"); var fs2 = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -16131,23 +18304,35 @@ 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().fromPromise; - var fs2 = require_fs(); + var u = require_universalify().fromCallback; + var fs2 = require_graceful_fs(); var path2 = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path2.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs2.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path2.dirname(file); - if (!fs2.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs2.existsSync(dir)) { + return fs2.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs2.writeFileSync(file, ...args); } module2.exports = { @@ -16207,49 +18392,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs2 = require_fs(); + var fs2 = require_graceful_fs(); var path2 = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); + } + 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 moveAcrossDevice(src, dest, overwrite) { + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -16316,7 +18532,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().fromPromise; + var u = require_universalify().fromCallback; 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 ea4748d1..8364727a 100644 --- a/dist/actions/catalog-status/index.js +++ b/dist/actions/catalog-status/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/check-solution/index.js b/dist/actions/check-solution/index.js index 74b664f7..5f51123d 100644 --- a/dist/actions/check-solution/index.js +++ b/dist/actions/check-solution/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/clone-solution/index.js b/dist/actions/clone-solution/index.js index e9dee4e0..7a3121fb 100644 --- a/dist/actions/clone-solution/index.js +++ b/dist/actions/clone-solution/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/copy-environment/index.js b/dist/actions/copy-environment/index.js index a53e0937..89c6be5a 100644 --- a/dist/actions/copy-environment/index.js +++ b/dist/actions/copy-environment/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/create-environment/index.js b/dist/actions/create-environment/index.js index e0576f18..11445e1f 100644 --- a/dist/actions/create-environment/index.js +++ b/dist/actions/create-environment/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/delete-environment/index.js b/dist/actions/delete-environment/index.js index 736dddb7..23cd7ad2 100644 --- a/dist/actions/delete-environment/index.js +++ b/dist/actions/delete-environment/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/delete-solution/index.js b/dist/actions/delete-solution/index.js index 5023b2a9..ab2c7c90 100644 --- a/dist/actions/delete-solution/index.js +++ b/dist/actions/delete-solution/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/deploy-package/index.js b/dist/actions/deploy-package/index.js index 34e32ca3..5f892883 100644 --- a/dist/actions/deploy-package/index.js +++ b/dist/actions/deploy-package/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/download-paportal/index.js b/dist/actions/download-paportal/index.js index aede8389..e2d8f143 100644 --- a/dist/actions/download-paportal/index.js +++ b/dist/actions/download-paportal/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/export-data/index.js b/dist/actions/export-data/index.js index 70b88d91..b4292b3d 100644 --- a/dist/actions/export-data/index.js +++ b/dist/actions/export-data/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -24007,8 +24129,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24016,6 +24146,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24028,6 +24161,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/export-solution/index.js b/dist/actions/export-solution/index.js index 8fc49b85..bc6c68d4 100644 --- a/dist/actions/export-solution/index.js +++ b/dist/actions/export-solution/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/import-data/index.js b/dist/actions/import-data/index.js index b7770d5e..425d7672 100644 --- a/dist/actions/import-data/index.js +++ b/dist/actions/import-data/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/import-solution/index.js b/dist/actions/import-solution/index.js index 7be7717d..598076ec 100644 --- a/dist/actions/import-solution/index.js +++ b/dist/actions/import-solution/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/install-catalog/index.js b/dist/actions/install-catalog/index.js index ccfb8f68..e94a6241 100644 --- a/dist/actions/install-catalog/index.js +++ b/dist/actions/install-catalog/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/pack-solution/index.js b/dist/actions/pack-solution/index.js index 53c9cf8e..fc82aa3c 100644 --- a/dist/actions/pack-solution/index.js +++ b/dist/actions/pack-solution/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); + } + 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 moveAcrossDevice(src, dest, overwrite) { + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; diff --git a/dist/actions/publish-solution/index.js b/dist/actions/publish-solution/index.js index bf70e4de..d5ad47e2 100644 --- a/dist/actions/publish-solution/index.js +++ b/dist/actions/publish-solution/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -16913,8 +17035,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -16922,6 +17052,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -16934,6 +17067,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); @@ -18297,7 +18433,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18352,7 +18488,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; diff --git a/dist/actions/reset-environment/index.js b/dist/actions/reset-environment/index.js index 54736a53..1572de7c 100644 --- a/dist/actions/reset-environment/index.js +++ b/dist/actions/reset-environment/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/restore-environment/index.js b/dist/actions/restore-environment/index.js index ac844863..64e7e4fd 100644 --- a/dist/actions/restore-environment/index.js +++ b/dist/actions/restore-environment/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/set-online-solution-version/index.js b/dist/actions/set-online-solution-version/index.js index 1ba7a7c4..c39368f4 100644 --- a/dist/actions/set-online-solution-version/index.js +++ b/dist/actions/set-online-solution-version/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/submit-catalog/index.js b/dist/actions/submit-catalog/index.js index 04c7ad59..af3d4ee9 100644 --- a/dist/actions/submit-catalog/index.js +++ b/dist/actions/submit-catalog/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/unpack-solution/index.js b/dist/actions/unpack-solution/index.js index f7eefd2e..ee7cc052 100644 --- a/dist/actions/unpack-solution/index.js +++ b/dist/actions/unpack-solution/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); + } + 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 moveAcrossDevice(src, dest, overwrite) { + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; diff --git a/dist/actions/update-solution-version/index.js b/dist/actions/update-solution-version/index.js index 3b53f9bc..d6b7eef7 100644 --- a/dist/actions/update-solution-version/index.js +++ b/dist/actions/update-solution-version/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); + } + 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 moveAcrossDevice(src, dest, overwrite) { + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; diff --git a/dist/actions/upgrade-solution/index.js b/dist/actions/upgrade-solution/index.js index 0495b9c1..56c5d82e 100644 --- a/dist/actions/upgrade-solution/index.js +++ b/dist/actions/upgrade-solution/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/upload-paportal/index.js b/dist/actions/upload-paportal/index.js index 3a22da80..961d0800 100644 --- a/dist/actions/upload-paportal/index.js +++ b/dist/actions/upload-paportal/index.js @@ -4540,9 +4540,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -4914,8 +4914,6 @@ var require_commonjs = __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(); @@ -4942,16 +4940,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -5135,11 +5131,6 @@ var require_commonjs = __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). @@ -5197,35 +5188,6 @@ var require_commonjs = __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() @@ -5458,11 +5420,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -5759,10 +5720,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -5824,9 +5783,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -6716,9 +6675,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -6754,14 +6713,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -7334,7 +7293,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7359,7 +7318,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -7371,9 +7330,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -8690,10 +8647,6 @@ 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] === "**"; @@ -8983,7 +8936,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -9056,17 +9009,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -9079,14 +9025,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -9315,7 +9254,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -9537,7 +9476,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -9760,7 +9699,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -10655,23 +10594,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -10679,7 +10613,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -10691,7 +10625,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -10716,28 +10650,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -10762,23 +10700,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -10804,19 +10741,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -10827,16 +10761,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -10846,111 +10786,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -11101,7 +11134,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -11171,36 +11204,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -11234,33 +11274,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -11295,71 +11344,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -11369,23 +11425,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -11394,7 +11450,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -11404,36 +11460,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -11600,23 +11679,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -11676,49 +11767,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -11785,7 +11907,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -11847,7 +11969,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -18236,7 +18358,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -18291,7 +18413,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; @@ -23994,8 +24116,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -24003,6 +24133,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -24015,6 +24148,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); diff --git a/dist/actions/who-am-i/index.js b/dist/actions/who-am-i/index.js index d34660e7..7e3c50f6 100644 --- a/dist/actions/who-am-i/index.js +++ b/dist/actions/who-am-i/index.js @@ -2374,9 +2374,9 @@ var require_cjs = __commonJS({ } }); -// 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) { +// 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) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.LRUCache = void 0; @@ -2748,8 +2748,6 @@ var require_commonjs = __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(); @@ -2776,16 +2774,14 @@ var require_commonjs = __commonJS({ } const ttl = ttls[index]; const start = starts[index]; - if (!ttl || !start) { + if (ttl === 0 || start === 0) { return Infinity; } const age = (cachedNow || getNow()) - start; return ttl - age; }; this.#isStale = (index) => { - const s = starts[index]; - const t = ttls[index]; - return !!t && !!s && (cachedNow || getNow()) - s > t; + return ttls[index] !== 0 && starts[index] !== 0 && (cachedNow || getNow()) - starts[index] > ttls[index]; }; } // conditionally set private methods related to TTL @@ -2969,11 +2965,6 @@ var require_commonjs = __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). @@ -3031,35 +3022,6 @@ var require_commonjs = __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() @@ -3292,11 +3254,10 @@ var require_commonjs = __commonJS({ peek(k, peekOptions = {}) { const { allowStale = this.allowStale } = peekOptions; const index = this.#keyMap.get(k); - if (index === void 0 || !allowStale && this.#isStale(index)) { - return; + if (index !== void 0 && (allowStale || !this.#isStale(index))) { + const v = this.#valList[index]; + return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; } - 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]; @@ -3593,10 +3554,8 @@ var require_commonjs = __commonJS({ } else if (index === this.#head) { this.#head = this.#next[index]; } else { - const pi = this.#prev[index]; - this.#next[pi] = this.#next[index]; - const ni = this.#next[index]; - this.#prev[ni] = this.#prev[index]; + this.#next[this.#prev[index]] = this.#next[index]; + this.#prev[this.#next[index]] = this.#prev[index]; } this.#size--; this.#free.push(index); @@ -3658,9 +3617,9 @@ var require_commonjs = __commonJS({ } }); -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs2 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { +// node_modules/minipass/dist/cjs/index.js +var require_cjs3 = __commonJS({ + "node_modules/minipass/dist/cjs/index.js"(exports2) { "use strict"; var __importDefault = exports2 && exports2.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { "default": mod }; @@ -4550,9 +4509,9 @@ var require_commonjs2 = __commonJS({ } }); -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs3 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { +// node_modules/path-scurry/dist/cjs/index.js +var require_cjs4 = __commonJS({ + "node_modules/path-scurry/dist/cjs/index.js"(exports2) { "use strict"; var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { if (k2 === void 0) @@ -4588,14 +4547,14 @@ var require_commonjs3 = __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_commonjs(); + var lru_cache_1 = require_cjs2(); 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_commonjs2(); + var minipass_1 = require_cjs3(); var defaultFS = { lstatSync: fs_1.lstatSync, readdir: fs_1.readdir, @@ -5168,7 +5127,7 @@ var require_commonjs3 = __commonJS({ } try { const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5193,7 +5152,7 @@ var require_commonjs3 = __commonJS({ } try { const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); + const linkTarget = this.parent.resolve(read); if (linkTarget) { return this.#linkTarget = linkTarget; } @@ -5205,9 +5164,7 @@ var require_commonjs3 = __commonJS({ #readdirSuccess(children) { this.#type |= READDIR_CALLED; for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + children[p].#markENOENT(); } } #markENOENT() { @@ -6524,10 +6481,6 @@ 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] === "**"; @@ -6817,7 +6770,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_commonjs2(); + var minipass_1 = require_cjs3(); 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; @@ -6890,17 +6843,10 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? await e.lstat() : e, ifDir); } matchCheckTest(e, ifDir) { - 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; + return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && !this.#ignored(e) ? e : void 0; } matchCheckSync(e, ifDir) { if (ifDir && this.opts.nodir) @@ -6913,14 +6859,7 @@ var require_walker = __commonJS({ e = rpc; } const needStat = e.isUnknown() || this.opts.stat; - 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); + return this.matchCheckTest(needStat ? e.lstatSync() : e, ifDir); } matchFinish(e, absolute) { if (this.#ignored(e)) @@ -7149,7 +7088,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_commonjs3(); + var path_scurry_1 = require_cjs4(); var url_1 = require("url"); var pattern_js_1 = require_pattern(); var walker_js_1 = require_walker(); @@ -7371,7 +7310,7 @@ var require_has_magic = __commonJS({ }); // node_modules/glob/dist/commonjs/index.js -var require_commonjs4 = __commonJS({ +var require_commonjs = __commonJS({ "node_modules/glob/dist/commonjs/index.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); @@ -7594,7 +7533,7 @@ var require_polyfills = __commonJS({ Object.setPrototypeOf(read, fs$read); return read; }(fs.read); - fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) { + fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { @@ -8489,23 +8428,18 @@ var require_path_exists = __commonJS({ var require_utimes = __commonJS({ "node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; - 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; - } + 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); + }); + }); + }); } function utimesMillisSync(path, atime, mtime) { const fd = fs.openSync(path, "r+"); @@ -8513,7 +8447,7 @@ var require_utimes = __commonJS({ return fs.closeSync(fd); } module2.exports = { - utimesMillis: u(utimesMillis), + utimesMillis, utimesMillisSync }; } @@ -8525,7 +8459,7 @@ var require_stat = __commonJS({ "use strict"; var fs = require_fs(); var path = require("path"); - var u = require_universalify().fromPromise; + var util = require("util"); function getStats(src, dest, opts) { const statFunc = opts.dereference ? (file) => fs.stat(file, { bigint: true }) : (file) => fs.lstat(file, { bigint: true }); return Promise.all([ @@ -8550,28 +8484,32 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - 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 }; + 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}'.`)); } - 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() && destStat.isDirectory()) { - throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`); + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))); } - } - if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { - throw new Error(errMsg(src, dest, funcName)); - } - return { srcStat, destStat }; + return cb(null, { srcStat, destStat }); + }); } function checkPathsSync(src, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src, dest, opts); @@ -8596,23 +8534,22 @@ var require_stat = __commonJS({ } return { srcStat, destStat }; } - async function checkParentPaths(src, srcStat, dest, funcName) { + function checkParentPaths(src, srcStat, dest, funcName, cb) { const srcParent = path.resolve(path.dirname(src)); const destParent = path.resolve(path.dirname(dest)); if (destParent === srcParent || destParent === path.parse(destParent).root) - 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); + 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); + }); } function checkParentPathsSync(src, srcStat, dest, funcName) { const srcParent = path.resolve(path.dirname(src)); @@ -8638,19 +8575,16 @@ 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.every((cur, i) => destArr[i] === cur); + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true); } function errMsg(src, dest, funcName) { return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`; } module2.exports = { - // checkPaths - checkPaths: u(checkPaths), + checkPaths, checkPathsSync, - // checkParent - checkParentPaths: u(checkParentPaths), + checkParentPaths, checkParentPathsSync, - // Misc isSrcSubdir, areIdentical }; @@ -8661,16 +8595,22 @@ var require_stat = __commonJS({ var require_copy = __commonJS({ "node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { mkdirs } = require_mkdirs(); - var { pathExists } = require_path_exists(); - var { utimesMillis } = require_utimes(); + var mkdirs = require_mkdirs().mkdirs; + var pathExists = require_path_exists().pathExists; + var utimesMillis = require_utimes().utimesMillis; var stat = require_stat(); - async function copy(src, dest, opts = {}) { - if (typeof opts === "function") { + function copy(src, dest, opts, cb) { + if (typeof opts === "function" && !cb) { + cb = opts; + opts = {}; + } else 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") { @@ -8680,111 +8620,204 @@ var require_copy = __commonJS({ "fs-extra-WARN0001" ); } - 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; + 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 destParent = path.dirname(dest); - const dirExists = await pathExists(destParent); - if (!dirExists) { - await mkdirs(destParent); - } - await getStatsAndPerformCopy(destStat, src, dest, opts); + 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); + }); + }); } - async function runFilter(src, dest, opts) { + function runFilter(src, dest, opts, cb) { if (!opts.filter) - return true; - return opts.filter(src, dest); + return cb(null, true); + Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error)); } - 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 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 onFile(srcStat, destStat, src, dest, opts) { + function onFile(srcStat, destStat, src, dest, opts, cb) { if (!destStat) - return copyFile(srcStat, src, dest, opts); + return copyFile(srcStat, src, dest, opts, cb); + return mayCopyFile(srcStat, src, dest, opts, cb); + } + function mayCopyFile(srcStat, src, dest, opts, cb) { if (opts.overwrite) { - await fs.unlink(dest); - return copyFile(srcStat, src, dest, opts); - } - if (opts.errorOnExist) { - throw new Error(`'${dest}' already exists`); - } + 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(); } - 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); + 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); + }); + } + 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); + }); } - return fs.chmod(dest, srcStat.mode); + return setDestTimestampsAndMode(srcMode, src, dest, cb); } function fileIsNotWritable(srcMode) { return (srcMode & 128) === 0; } - function makeFileWritable(dest, srcMode) { - return fs.chmod(dest, srcMode | 128); + function makeFileWritable(dest, srcMode, cb) { + return setDestMode(dest, srcMode | 128, cb); } - 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); + 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 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); if (!include) - 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); - } + 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); + }); + }); + }); } - 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); + 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); + }); + } + }); + } + function copyLink(resolvedSrc, dest, cb) { + fs.unlink(dest, (err) => { + if (err) + return cb(err); + return fs.symlink(resolvedSrc, dest, cb); + }); } module2.exports = copy; } @@ -8935,7 +8968,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { copy: u(require_copy()), copySync: require_copy_sync() @@ -9005,36 +9038,43 @@ var require_empty = __commonJS({ var require_file = __commonJS({ "node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - 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); + function createFile(file, callback) { + function makeFile() { + fs.writeFile(file, "", (err) => { + if (err) + return callback(err); + callback(); + }); } + 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; @@ -9068,33 +9108,42 @@ var require_file = __commonJS({ var require_link = __commonJS({ "node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) { "use strict"; - var u = require_universalify().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); - var fs = require_fs(); + var fs = require_graceful_fs(); var mkdir = require_mkdirs(); - var { pathExists } = require_path_exists(); + var pathExists = require_path_exists().pathExists; var { areIdentical } = require_stat(); - async function createLink(srcpath, dstpath) { - let dstStat; - try { - dstStat = await fs.lstat(dstpath); - } catch { - } - 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); + function createLink(srcpath, dstpath, callback) { + function makeLink(srcpath2, dstpath2) { + fs.link(srcpath2, dstpath2, (err) => { + if (err) + return callback(err); + callback(null); + }); } - await fs.link(srcpath, dstpath); + 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); + }); + }); + }); + }); } function createLinkSync(srcpath, dstpath) { let dstStat; @@ -9129,71 +9178,78 @@ 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_fs(); - var { pathExists } = require_path_exists(); - var u = require_universalify().fromPromise; - async function symlinkPaths(srcpath, dstpath) { + var fs = require_graceful_fs(); + var pathExists = require_path_exists().pathExists; + function symlinkPaths(srcpath, dstpath, callback) { if (path.isAbsolute(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 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) + }); + }); + } + }); } - return { - toCwd: srcpath, - toDst: path.relative(dstdir, srcpath) - }; } function symlinkPathsSync(srcpath, dstpath) { + let exists; if (path.isAbsolute(srcpath)) { - const exists2 = fs.existsSync(srcpath); - if (!exists2) + exists = fs.existsSync(srcpath); + if (!exists) 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: u(symlinkPaths), + symlinkPaths, symlinkPathsSync }; } @@ -9203,23 +9259,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_fs(); - var u = require_universalify().fromPromise; - async function symlinkType(srcpath, type) { + var fs = require_graceful_fs(); + function symlinkType(srcpath, type, callback) { + callback = typeof type === "function" ? type : callback; + type = typeof type === "function" ? false : type; if (type) - return type; - let stats; - try { - stats = await fs.lstat(srcpath); - } catch { - return "file"; - } - return stats && stats.isDirectory() ? "dir" : "file"; + return callback(null, type); + fs.lstat(srcpath, (err, stats) => { + if (err) + return callback(null, "file"); + type = stats && stats.isDirectory() ? "dir" : "file"; + callback(null, type); + }); } function symlinkTypeSync(srcpath, type) { + let stats; if (type) return type; - let stats; try { stats = fs.lstatSync(srcpath); } catch { @@ -9228,7 +9284,7 @@ var require_symlink_type = __commonJS({ return stats && stats.isDirectory() ? "dir" : "file"; } module2.exports = { - symlinkType: u(symlinkType), + symlinkType, symlinkTypeSync }; } @@ -9238,36 +9294,59 @@ 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().fromPromise; + var u = require_universalify().fromCallback; var path = require("path"); var fs = require_fs(); - var { mkdirs, mkdirsSync } = require_mkdirs(); - var { symlinkPaths, symlinkPathsSync } = require_symlink_paths(); - var { symlinkType, symlinkTypeSync } = require_symlink_type(); - var { pathExists } = require_path_exists(); + 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 { areIdentical } = require_stat(); - 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 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); + }); + }); + }); + }); } function createSymlinkSync(srcpath, dstpath, type) { let stats; @@ -9434,23 +9513,35 @@ 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().fromPromise; - var fs = require_fs(); + var u = require_universalify().fromCallback; + var fs = require_graceful_fs(); var path = require("path"); var mkdir = require_mkdirs(); var pathExists = require_path_exists().pathExists; - async function outputFile(file, data, encoding = "utf-8") { - const dir = path.dirname(file); - if (!await pathExists(dir)) { - await mkdir.mkdirs(dir); + function outputFile(file, data, encoding, callback) { + if (typeof encoding === "function") { + callback = encoding; + encoding = "utf8"; } - return fs.writeFile(file, data, encoding); + 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); + }); + }); } function outputFileSync(file, ...args) { const dir = path.dirname(file); - if (!fs.existsSync(dir)) { - mkdir.mkdirsSync(dir); + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args); } + mkdir.mkdirsSync(dir); fs.writeFileSync(file, ...args); } module2.exports = { @@ -9510,49 +9601,80 @@ var require_json = __commonJS({ var require_move = __commonJS({ "node_modules/fs-extra/lib/move/move.js"(exports2, module2) { "use strict"; - var fs = require_fs(); + var fs = require_graceful_fs(); var path = require("path"); - var { copy } = require_copy2(); - var { remove } = require_remove(); - var { mkdirp } = require_mkdirs(); - var { pathExists } = require_path_exists(); + var copy = require_copy2().copy; + var remove = require_remove().remove; + var mkdirp = require_mkdirs().mkdirp; + var pathExists = require_path_exists().pathExists; var stat = require_stat(); - async function move(src, dest, opts = {}) { - const overwrite = opts.overwrite || opts.clobber || false; - 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); + function move(src, dest, opts, cb) { + if (typeof opts === "function") { + cb = opts; + opts = {}; } - return doRename(src, dest, overwrite, isChangingCase); + opts = 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); + }); + }); + }); } - 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 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); + }); } + pathExists(dest, (err, destExists) => { + if (err) + return cb(err); + if (destExists) + return cb(new Error("dest already exists.")); + return rename(src, dest, overwrite, cb); + }); } - async function moveAcrossDevice(src, dest, overwrite) { + 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); + }); + } + function moveAcrossDevice(src, dest, overwrite, cb) { const opts = { overwrite, errorOnExist: true, preserveTimestamps: true }; - await copy(src, dest, opts); - return remove(src); + copy(src, dest, opts, (err) => { + if (err) + return cb(err); + return remove(src, cb); + }); } module2.exports = move; } @@ -9619,7 +9741,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().fromPromise; + var u = require_universalify().fromCallback; module2.exports = { move: u(require_move()), moveSync: require_move_sync() @@ -9681,7 +9803,7 @@ var require_checkSolution = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.checkSolution = void 0; - var glob = require_commonjs4(); + var glob = require_commonjs(); var os = require("os"); var path = require("path"); var InputValidator_1 = require_InputValidator(); @@ -13992,8 +14114,16 @@ var require_getCredentials = __commonJS({ // no MgtIdentity support for Actions yet }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { - throw new Error("Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow."); + const federatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: "WorkloadIdentityFederation" + }; + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + if (isUpValid && (isCcValid || isFcValid)) { + throw new Error("Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow."); } if (isUpValid) { return usernamePassword; @@ -14001,6 +14131,9 @@ var require_getCredentials = __commonJS({ if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error("Must provide either username/password or app-id/client-secret/tenant-id for authentication!"); } exports2.default = getCredentials; @@ -14013,6 +14146,9 @@ var require_getCredentials = __commonJS({ function isClientCredentialsValid(clientCredentials) { return !!clientCredentials.appId && !!clientCredentials.clientSecret && !!clientCredentials.tenantId; } + function isFederatedCredentialsValid(federatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; + } } }); @@ -15560,7 +15696,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(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); + entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); entry.type = isDirectory ? "Directory" : "File"; entry.isDirectory = isDirectory; var fileSizeKnown = !(vars.flags & 8); @@ -15615,7 +15751,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(() => { - self.emit("error", new Error(message)); + entry.emit("error", new Error(message)); }); this.outStreamInfo.stream.pipe(new Entry().autodrain()); return; diff --git a/src/lib/auth/getCredentials.ts b/src/lib/auth/getCredentials.ts index 1141f94b..da53d773 100644 --- a/src/lib/auth/getCredentials.ts +++ b/src/lib/auth/getCredentials.ts @@ -1,10 +1,12 @@ import { getInput as coreGetInput } from "@actions/core"; import { ClientCredentials, + FederatedCredentials, UsernamePassword, + AuthCredentials } from "@microsoft/powerplatform-cli-wrapper"; -export default function getCredentials(): UsernamePassword | ClientCredentials { +export default function getCredentials(): AuthCredentials { const usernamePassword: UsernamePassword = { username: getInput("user-name"), password: getInput("password-secret"), @@ -23,9 +25,18 @@ export default function getCredentials(): UsernamePassword | ClientCredentials { }; const isCcValid = isClientCredentialsValid(clientCredentials); - if (isUpValid && isCcValid) { + const federatedCredentials: FederatedCredentials = { + tenantId: getInput("tenant-id"), + appId: getInput("app-id"), + cloudInstance: getInput("cloud"), + federationProvider: "GitHub", + scheme: 'WorkloadIdentityFederation' + } + const isFcValid = isFederatedCredentialsValid(federatedCredentials); + + if (isUpValid && (isCcValid || isFcValid)) { throw new Error( - "Too many authentication parameters specified. Must pick either username/password or app-id/client-secret/tenant-id for the authentication flow." + "Too many authentication parameters specified. Must pick either username/password, app-id/tenant-id with Federation Credentials, or app-id/client-secret/tenant-id for the authentication flow." ); } if (isUpValid) { @@ -34,6 +45,9 @@ export default function getCredentials(): UsernamePassword | ClientCredentials { if (isCcValid) { return clientCredentials; } + if (isFcValid) { + return federatedCredentials; + } throw new Error( "Must provide either username/password or app-id/client-secret/tenant-id for authentication!" ); @@ -54,3 +68,7 @@ function isClientCredentialsValid(clientCredentials: ClientCredentials) { !!clientCredentials.tenantId ); } + +function isFederatedCredentialsValid(federatedCredentials: FederatedCredentials) { + return !!federatedCredentials.appId && !!federatedCredentials.tenantId; +} diff --git a/src/pacPackageInfo.json b/src/pacPackageInfo.json index 01efaa9b..55c5515c 100644 --- a/src/pacPackageInfo.json +++ b/src/pacPackageInfo.json @@ -2,5 +2,5 @@ "PacPackageName": "Microsoft.PowerApps.CLI", "LegacyLinuxPackage": "Microsoft.PowerApps.CLI.Core.linux-x64", "DotnetToolName": "Microsoft.PowerApps.CLI.Tool", - "PacPackageVersion": "1.31.6" + "PacPackageVersion": "1.32.5" }